]> sjero.net Git - linphone/blobdiff - coreapi/linphonecall.c
Merge commit 'aab6c70'
[linphone] / coreapi / linphonecall.c
index 6ec119105824ee9b1b7b3ebe521a32cc2364544c..9c3ecfd11a18976aab1d1c6883913c0bdad682bb 100644 (file)
@@ -337,6 +337,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr
        discover_mtu(lc,linphone_address_get_domain (to));
        if (params->referer){
                sal_call_set_referer(call->op,params->referer->op);
+               call->referer=linphone_call_ref(params->referer);
        }
        return call;
 }
@@ -406,6 +407,10 @@ static void linphone_call_set_terminated(LinphoneCall *call){
                linphone_core_stop_dtmf(lc);
                call->ringing_beep=FALSE;
        }
+       if (call->referer){
+               linphone_call_unref(call->referer);
+               call->referer=NULL;
+       }
 }
 
 void linphone_call_fix_call_parameters(LinphoneCall *call){
@@ -847,12 +852,18 @@ static void rendercb(void *data, const MSPicture *local, const MSPicture *remote
 
 #ifdef VIDEO_ENABLED
 static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const unsigned int event_id, const void *args){
+    LinphoneCall* call = (LinphoneCall*) user_pointer;
        ms_warning("In linphonecall.c: video_stream_event_cb");
        switch (event_id) {
                case MS_VIDEO_DECODER_DECODING_ERRORS:
                        ms_warning("Case is MS_VIDEO_DECODER_DECODING_ERRORS");
-                       linphone_call_send_vfu_request((LinphoneCall*) user_pointer);
+                       linphone_call_send_vfu_request(call);
                        break;
+        case MS_VIDEO_DECODER_FIRST_IMAGE_DECODED:
+            ms_message("First video frame decoded successfully");
+            if (call->nextVideoFrameDecoded._func != NULL)
+                call->nextVideoFrameDecoded._func(call, call->nextVideoFrameDecoded._user_data);
+            break;
                default:
                        ms_warning("Unhandled event %i", event_id);
                        break;
@@ -860,6 +871,14 @@ static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const u
 }
 #endif
 
+void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data) {
+    call->nextVideoFrameDecoded._func = cb;
+    call->nextVideoFrameDecoded._user_data = user_data;
+#ifdef VIDEO_ENABLED
+    ms_filter_call_method_noarg(call->videostream->decoder, MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION);
+#endif
+}
+
 void linphone_call_init_media_streams(LinphoneCall *call){
        LinphoneCore *lc=call->core;
        SalMediaDescription *md=call->localdesc;
@@ -903,18 +922,21 @@ void linphone_call_init_media_streams(LinphoneCall *call){
 #ifdef VIDEO_ENABLED
 
        if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].port>0){
+               int video_recv_buf_size=lp_config_get_int(lc->config,"video","recv_buf_size",0);
                call->videostream=video_stream_new(md->streams[1].port,linphone_core_ipv6_enabled(lc));
-        video_stream_enable_display_filter_auto_rotate(call->videostream, lp_config_get_int(lc->config,"video","display_filter_auto_rotate",0));
-       if( lc->video_conf.displaytype != NULL)
-               video_stream_set_display_filter_name(call->videostream,lc->video_conf.displaytype);
-       video_stream_set_event_callback(call->videostream,video_stream_event_cb, call);
-       if (lc->rtptf){
-               RtpTransport *vrtp=lc->rtptf->video_rtp_func(lc->rtptf->video_rtp_func_data, call->video_port);
-               RtpTransport *vrtcp=lc->rtptf->video_rtcp_func(lc->rtptf->video_rtcp_func_data, call->video_port+1);
-               rtp_session_set_transports(call->videostream->session,vrtp,vrtcp);
-       }
-       call->videostream_app_evq = ortp_ev_queue_new();
-       rtp_session_register_event_queue(call->videostream->session,call->videostream_app_evq);
+               video_stream_enable_display_filter_auto_rotate(call->videostream, lp_config_get_int(lc->config,"video","display_filter_auto_rotate",0));
+               if (video_recv_buf_size>0) rtp_session_set_recv_buf_size(call->videostream->session,video_recv_buf_size);
+          
+               if( lc->video_conf.displaytype != NULL)
+                       video_stream_set_display_filter_name(call->videostream,lc->video_conf.displaytype);
+               video_stream_set_event_callback(call->videostream,video_stream_event_cb, call);
+               if (lc->rtptf){
+                       RtpTransport *vrtp=lc->rtptf->video_rtp_func(lc->rtptf->video_rtp_func_data, call->video_port);
+                       RtpTransport *vrtcp=lc->rtptf->video_rtcp_func(lc->rtptf->video_rtcp_func_data, call->video_port+1);
+                       rtp_session_set_transports(call->videostream->session,vrtp,vrtcp);
+               }
+               call->videostream_app_evq = ortp_ev_queue_new();
+               rtp_session_register_event_queue(call->videostream->session,call->videostream_app_evq);
 #ifdef TEST_EXT_RENDERER
                video_stream_set_render_callback(call->videostream,rendercb,NULL);
 #endif
@@ -1276,6 +1298,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
                                cam=get_nowebcam_device();
                        }
                        if (!is_inactive){
+                call->log->video_enabled = TRUE;
                                video_stream_set_direction (call->videostream, dir);
                                ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation);
                                video_stream_set_device_rotation(call->videostream, lc->device_rotation);