From: Anthony Minessale Date: Tue, 28 Feb 2017 23:44:16 +0000 (-0600) Subject: FS-10076: [mod_av] File sync issues with different framerates #resolve X-Git-Tag: v1.8.0~806 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f92fa24de323c4a3d6a773ab476c58357073d92e;p=thirdparty%2Ffreeswitch.git FS-10076: [mod_av] File sync issues with different framerates #resolve --- diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index e094aea751..2d2086d178 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -2291,6 +2291,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f return SWITCH_STATUS_BREAK; } +#if 0 if (context->last_img) { if (mst->next_pts && (switch_time_now() - mst->next_pts > max_delta)) { switch_img_free(&context->last_img); // too late @@ -2311,6 +2312,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f return SWITCH_STATUS_BREAK; } } +#endif if (st->codec->time_base.num) { ticks = st->parser ? st->parser->repeat_pict + 1 : st->codec->ticks_per_frame; @@ -2325,10 +2327,16 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f again: - if ((flags & SVR_BLOCK)) { - status = switch_queue_pop(context->eh.video_queue, &pop); + if (context->last_img) { + pop = (void *) context->last_img; + context->last_img = NULL; + status = SWITCH_STATUS_SUCCESS; } else { - status = switch_queue_trypop(context->eh.video_queue, &pop); + if ((flags & SVR_BLOCK)) { + status = switch_queue_pop(context->eh.video_queue, &pop); + } else { + status = switch_queue_trypop(context->eh.video_queue, &pop); + } } if (pop && status == SWITCH_STATUS_SUCCESS) { @@ -2371,7 +2379,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f } } - if ((flags & SVR_BLOCK) || do_fl) { + if ((flags & SVR_BLOCK)) { while (switch_micro_time_now() - mst->next_pts < -10000) { // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "yield, delta=%" SWITCH_INT64_T_FMT "\n", switch_micro_time_now() - mst->next_pts); switch_yield(1000);