]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9511 #resolve [Sync issues on inbound video calls]
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 14 Sep 2016 20:50:12 +0000 (15:50 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 14 Sep 2016 20:51:04 +0000 (15:51 -0500)
src/switch_core_media.c

index 982b94e1eeefc9fa517053fac246da9e0b9b6e77..58350bd4a61f8d6fa18c23871cbd7f64cbadc4aa 100644 (file)
@@ -2048,37 +2048,39 @@ static void check_jb_sync(switch_core_session_t *session)
                }
        }
        
-       fps = switch_core_media_get_video_fps(session);
-       
        switch_rtp_get_video_buffer_size(v_engine->rtp_session, &min_frames, &max_frames, &cur_frames, NULL);
 
+       fps = switch_core_media_get_video_fps(session);
+
+       if (!fps) return;
+
+
        if (!frames) {
-               if (cur_frames != min_frames) {
+               if (cur_frames && min_frames && cur_frames >= min_frames) {
                        frames = cur_frames;
                } else {
-                       frames = fps / 7.5;
+                       frames = fps / 15;
                        if (frames < 1) frames = 1;
                        sync_audio = 1;
                }
        }
        
        if (!jb_sync_msec) {
-               jb_sync_msec = frames * 75;
+               jb_sync_msec = (double)(1000 / fps) * frames;
        }
        
-
-       if (frames != cur_frames) {
+       if (frames != cur_frames && frames > min_frames) {
                switch_rtp_set_video_buffer_size(v_engine->rtp_session, frames, 0);
                sync_audio = 1;
                sync_video = 1;
        }
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
-                                         SWITCH_LOG_DEBUG1, "%s %s \"%s\" Sync A/V JB to %dms %u VFrames FPS %u a:%s v:%s\n", 
+                                         SWITCH_LOG_DEBUG1, "%s %s \"%s\" Sync A/V JB to %dms %u VFrames FPS %u a:%s v:%s sync_ms:%d\n", 
                                          switch_core_session_get_uuid(session),
                                          switch_channel_get_name(session->channel),
                                          switch_channel_get_variable_dup(session->channel, "caller_id_name", SWITCH_FALSE, -1),
-                                         jb_sync_msec, frames, video_globals.fps, sync_audio ? "yes" : "no", sync_video ? "yes" : "no");
+                                         jb_sync_msec, frames, video_globals.fps, sync_audio ? "yes" : "no", sync_video ? "yes" : "no", jb_sync_msec);
        
        if (sync_audio) {
                check_jb(session, NULL, jb_sync_msec, 0, SWITCH_TRUE);