From 5429a92c51682240acbbe7b150d314d993d7d3a0 Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Tue, 14 Feb 2017 16:25:40 -0700 Subject: mux: shift timestamps by largest encoder delay This prevents libav from adding an mp4 edit list entry that causes a properly functioning player to drop the first couple of audio frames. --- libhb/encavcodecaudio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'libhb/encavcodecaudio.c') diff --git a/libhb/encavcodecaudio.c b/libhb/encavcodecaudio.c index e376d4436..9f07f4a79 100644 --- a/libhb/encavcodecaudio.c +++ b/libhb/encavcodecaudio.c @@ -200,6 +200,9 @@ static int encavcodecaInit(hb_work_object_t *w, hb_job_t *job) hb_error("encavcodecaInit: hb_avcodec_open() failed"); return 1; } + w->config->init_delay = av_rescale_q(context->delay, context->time_base, + (AVRational){1, 90000}); + // avcodec_open populates the opts dictionary with the // things it didn't recognize. AVDictionaryEntry *t = NULL; @@ -268,9 +271,6 @@ static int encavcodecaInit(hb_work_object_t *w, hb_job_t *job) w->config->extradata.length = context->extradata_size; } - audio->config.out.delay = av_rescale_q(context->delay, context->time_base, - (AVRational){1, 90000}); - return 0; } @@ -426,7 +426,6 @@ static void Encode(hb_work_object_t *w, hb_buffer_list_t *list) audio->config.out.samplerate)); frame.pts = av_rescale(frame.pts, pv->context->sample_rate, 90000); - // Encode ret = avcodec_send_frame(pv->context, &frame); if (ret < 0) -- cgit v1.2.3