Commit ea7ca97a authored by Simon Morlat's avatar Simon Morlat
Browse files

fix mtu discovery and restore send_only/recv_only video_stream functions (for...

fix mtu discovery and restore send_only/recv_only video_stream functions (for backward compatibility)
parent 332d7920
......@@ -210,6 +210,8 @@ void video_stream_set_render_callback(VideoStream *s, VideoStreamRenderCallback
void video_stream_set_display_filter_name(VideoStream *s, const char *fname);
int video_stream_start(VideoStream * stream, RtpProfile *profile, const char *remip, int remport, int rem_rtcp_port,
int payload, int jitt_comp, MSWebCam *device);
void video_stream_set_relay_session_id(VideoStream *stream, const char *relay_session_id);
void video_stream_set_rtcp_information(VideoStream *st, const char *cname, const char *tool);
/*function to call periodically to handle various events */
......@@ -220,6 +222,13 @@ void video_stream_set_sent_video_size(VideoStream *stream, MSVideoSize vsize);
void video_stream_enable_self_view(VideoStream *stream, bool_t val);
unsigned long video_stream_get_native_window_id(VideoStream *stream);
/*provided for compatibility, use video_stream_set_direction() instead */
int video_stream_recv_only_start(VideoStream *videostream, RtpProfile *profile, const char *addr, int port, int used_pt, int jitt_comp);
int video_stream_send_only_start(VideoStream *videostream,
RtpProfile *profile, const char *addr, int port, int rtcp_port,
int used_pt, int jitt_comp, MSWebCam *device);
void video_stream_recv_only_stop(VideoStream *vs);
void video_stream_send_only_stop(VideoStream *vs);
VideoStream * video_preview_start(MSWebCam *device, MSVideoSize vsize);
void video_preview_stop(VideoStream *stream);
......
......@@ -209,7 +209,7 @@ int ms_discover_mtu(const char *host){
mtu=1500-28;//was the size of the inital buf
do{
int send_returned;
char *buf=ms_malloc(mtu);//avoid mtu greater than the beginning
char *buf=ms_malloc0(mtu);//avoid mtu greater than the beginning
if(buf == NULL)
{
ms_error("malloc(): %s",strerror(errno));
......@@ -220,14 +220,6 @@ int ms_discover_mtu(const char *host){
}
send_returned = send(sock,buf,mtu,0);
ms_free(buf);
if( send_returned < 0)//mtu actually change...
{
ms_error("send(): %s",strerror(errno));
err = close(sock);
if (err!=0)
ms_error("close(): %s", strerror(errno));
return -1;
}
usleep(500000);/*wait for an icmp message come back */
err=getsockopt(sock,IPPROTO_IP,IP_MTU,&new_mtu,&optlen);
if (err!=0){
......
......@@ -247,6 +247,11 @@ int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *re
JBParameters jbp;
const int socket_buf_size=2000000;
if (cam==NULL){
cam=ms_web_cam_manager_get_default_cam (
ms_web_cam_manager_get());
}
pt=rtp_profile_get_payload(profile,payload);
if (pt==NULL){
ms_error("videostream.c: undefined payload type.");
......@@ -479,3 +484,23 @@ void video_preview_stop(VideoStream *stream){
video_stream_free(stream);
}
int video_stream_recv_only_start(VideoStream *videostream, RtpProfile *profile, const char *addr, int port, int used_pt, int jitt_comp){
video_stream_set_direction(videostream,VideoStreamRecvOnly);
return video_stream_start(videostream,profile,addr,port,port+1,used_pt,jitt_comp,NULL);
}
int video_stream_send_only_start(VideoStream *videostream,
RtpProfile *profile, const char *addr, int port, int rtcp_port,
int used_pt, int jitt_comp, MSWebCam *device){
video_stream_set_direction (videostream,VideoStreamSendOnly);
return video_stream_start(videostream,profile,addr,port,rtcp_port,used_pt,jitt_comp,device);
}
void video_stream_recv_only_stop(VideoStream *vs){
video_stream_stop(vs);
}
void video_stream_send_only_stop(VideoStream *vs){
video_stream_stop(vs);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment