]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11127: [freeswitch-core] Improvements to Video JB and audio jb sync #resolve
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 20 Apr 2018 18:33:57 +0000 (13:33 -0500)
committerMuteesa Fred <muteesafred@hotmail.com>
Tue, 24 Jul 2018 07:21:51 +0000 (07:21 +0000)
src/switch_core_media.c
src/switch_jitterbuffer.c

index e15dad3e0999a1f5a4d09f943b1eef88e109dc4d..1963a779549cc55bc1c289f0bd394d5af0c101cb 100644 (file)
@@ -2565,7 +2565,7 @@ static void check_jb_sync(switch_core_session_t *session)
        uint32_t cur_frames = 0;
        switch_media_handle_t *smh;
        switch_rtp_engine_t *v_engine = NULL;
-       int sync_audio = 0, sync_video = 0;
+       int sync_audio = 0;
 
        const char *var;
 
@@ -2607,34 +2607,29 @@ static void check_jb_sync(switch_core_session_t *session)
 
        if (!fps) return;
 
+       sync_audio = 1;
 
        if (!frames) {
-               sync_audio = 1;
-
                if (cur_frames && min_frames && cur_frames >= min_frames) {
                        frames = cur_frames;
+               } else if (min_frames) {
+                       frames = min_frames;
                } else {
-                       frames = fps / 15;
-                       if (frames < 1) frames = 1;
+                       frames = 0;
+                       sync_audio = 0;
                }
        }
 
-       if (!jb_sync_msec) {
+       if (!jb_sync_msec && frames) {
                jb_sync_msec = (double)(1000 / fps) * 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 sync_ms:%d\n",
+                                         SWITCH_LOG_DEBUG1, "%s %s \"%s\" Sync A/V JB to %dms %u VFrames, FPS %u a:%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);
+                                         jb_sync_msec, frames, video_globals.fps, sync_audio ? "yes" : "no", jb_sync_msec);
 
        if (sync_audio) {
                check_jb(session, NULL, jb_sync_msec, 0, SWITCH_TRUE);
index 3f1cb8d5e7025666ae6005a984a02088e27d1d9e..7f5d444f424a39b9c384e7f0ca27000524599499 100644 (file)
@@ -934,9 +934,13 @@ SWITCH_DECLARE(void) switch_jb_reset(switch_jb_t *jb)
                        switch_core_session_request_video_refresh(jb->session);
                }
        }
-
+       
        jb_debug(jb, 2, "%s", "RESET BUFFER\n");
 
+       switch_mutex_lock(jb->mutex);
+       hide_nodes(jb);
+       switch_mutex_unlock(jb->mutex);
+       
        jb->drop_flag = 0;
        jb->last_target_seq = 0;
        jb->target_seq = 0;
@@ -958,10 +962,6 @@ SWITCH_DECLARE(void) switch_jb_reset(switch_jb_t *jb)
        jb->period_miss_inc = 0;
        jb->target_ts = 0;
        jb->last_target_ts = 0;
-
-       switch_mutex_lock(jb->mutex);
-       hide_nodes(jb);
-       switch_mutex_unlock(jb->mutex);
 }
 
 SWITCH_DECLARE(switch_status_t) switch_jb_peek_frame(switch_jb_t *jb, uint32_t ts, uint16_t seq, int peek, switch_frame_t *frame)
@@ -1377,7 +1377,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
                if (!jb->read_init) jb->read_init = 1;
        } else {
                if (jb->type == SJB_VIDEO) {
-                       switch_jb_reset(jb);
+                       //switch_jb_reset(jb);
 
                        switch(status) {
                        case SWITCH_STATUS_RESTART: