FS-9511 #resolve [Sync issues on inbound video calls]

This commit is contained in:
Anthony Minessale 2016-09-14 15:50:12 -05:00
parent f39bad0b32
commit 66a8b5bfac
1 changed files with 11 additions and 9 deletions

View 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);