summaryrefslogtreecommitdiffstats
path: root/libhb/encavcodecaudio.c
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2017-02-14 16:25:40 -0700
committerJohn Stebbins <[email protected]>2017-02-14 16:27:26 -0700
commit5429a92c51682240acbbe7b150d314d993d7d3a0 (patch)
tree51b2b4ef27d3c3a97e76cf43c6a4b15c55ffac45 /libhb/encavcodecaudio.c
parentdf5601053a8857ad8e2b59d56e82bac7f44e96fb (diff)
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.
Diffstat (limited to 'libhb/encavcodecaudio.c')
-rw-r--r--libhb/encavcodecaudio.c7
1 files changed, 3 insertions, 4 deletions
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)