]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11154: [freeswitch-core] Improve audio sync during loss #resolve
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 10 May 2018 20:54:51 +0000 (15:54 -0500)
committerMike Jerris <mike@jerris.com>
Mon, 13 Aug 2018 18:57:19 +0000 (18:57 +0000)
src/mod/endpoints/mod_verto/mod_verto.c
src/switch_core_media.c

index cc11c3d2090757276792046624881e91fb54a17f..3cd84293f94bbfe65118c8564cd33f54a9bc7d46 100644 (file)
@@ -2449,7 +2449,7 @@ static switch_status_t verto_set_media_options(verto_pvt_t *tech_pvt, verto_prof
        tech_pvt->mparams->inbound_codec_string = switch_core_session_strdup(tech_pvt->session, profile->inbound_codec_string);
        tech_pvt->mparams->outbound_codec_string = switch_core_session_strdup(tech_pvt->session, profile->outbound_codec_string);
 
-       tech_pvt->mparams->jb_msec = "-1";
+       tech_pvt->mparams->jb_msec = "1p:50p";
        switch_media_handle_set_media_flag(tech_pvt->smh, SCMF_SUPPRESS_CNG);
 
        //tech_pvt->mparams->auto_rtp_bugs = profile->auto_rtp_bugs;
index 5ec1909be9b7856617a205c1435e1d4552159ca3..4100a6ed7c97515e56127891423128ffa664f166 100644 (file)
@@ -2487,6 +2487,7 @@ static void check_jb(switch_core_session_t *session, const char *input, int32_t
 
                        if (strchr(val, 'p') && jb_msec > 0) {
                                jb_msec *= -1;
+                               if (!maxlen) maxlen = jb_msec * 50;
                        }
 
                        if ((p = strchr(val, ':'))) {
@@ -2499,6 +2500,8 @@ static void check_jb(switch_core_session_t *session, const char *input, int32_t
                        }
                }
 
+               if (!maxlen) maxlen = jb_msec * 50;
+               
                if (jb_msec < 0 && jb_msec > -1000) {
                        jb_msec = (a_engine->read_codec.implementation->microseconds_per_packet / 1000) * abs(jb_msec);
                }
@@ -2506,7 +2509,6 @@ static void check_jb(switch_core_session_t *session, const char *input, int32_t
                if (maxlen < 0 && maxlen > -1000) {
                        maxlen = (a_engine->read_codec.implementation->microseconds_per_packet / 1000) * abs(maxlen);
                }
-
                
                
                if (jb_msec < 10 || jb_msec > 10000) {
@@ -2599,7 +2601,7 @@ static void check_jb_sync(switch_core_session_t *session)
 
        fps = video_globals.fps;
 
-       if (!fps) return;
+       if (fps < 15) return;
 
        sync_audio = 1;
 
@@ -2626,7 +2628,7 @@ static void check_jb_sync(switch_core_session_t *session)
                                          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);
+               check_jb(session, NULL, jb_sync_msec, jb_sync_msec * 2, SWITCH_TRUE);
        }
 
        video_globals.synced++;