diff options
author | John Stebbins <[email protected]> | 2017-01-25 11:47:15 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2017-01-25 11:49:12 -0700 |
commit | 2659e435ed4227399aee6ac04070dc5ea832ffe4 (patch) | |
tree | cdee1aaad32c1e94e1767909d47ef89efe22371f /libhb/platform | |
parent | 708cdb80cc38ac5b909691218bc4b9afc56700d8 (diff) |
encca_aac: Fix initial start time
encca_aac assumed the first packet start time is 0 which is no longer
the case. We now use edit lists to adjust non-zero start times.
(cherry picked from commit 33e6780967a14c876d0f329ea1c637e6b0f75a92)
Diffstat (limited to 'libhb/platform')
-rw-r--r-- | libhb/platform/macosx/encca_aac.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libhb/platform/macosx/encca_aac.c b/libhb/platform/macosx/encca_aac.c index b775b9cb4..5ffb28d5d 100644 --- a/libhb/platform/macosx/encca_aac.c +++ b/libhb/platform/macosx/encca_aac.c @@ -46,6 +46,7 @@ struct hb_work_private_s AudioConverterRef converter; unsigned long isamples, isamplesiz, omaxpacket, nchannels; + int64_t first_pts; uint64_t samples, ibytes; Float64 osamplerate; @@ -146,6 +147,7 @@ int encCoreAudioInit(hb_work_object_t *w, hb_job_t *job, enum AAC_MODE mode) w->private_data = pv; pv->job = job; + pv->first_pts = AV_NOPTS_VALUE; // pass the number of channels used into the private work data pv->nchannels = @@ -441,9 +443,9 @@ static hb_buffer_t* Encode(hb_work_object_t *w) } obuf->size = odesc.mDataByteSize; - obuf->s.start = 90000LL * pv->samples / pv->osamplerate; + obuf->s.start = pv->first_pts + 90000LL * pv->samples / pv->osamplerate; pv->samples += pv->isamples; - obuf->s.stop = 90000LL * pv->samples / pv->osamplerate; + obuf->s.stop = pv->first_pts + 90000LL * pv->samples / pv->osamplerate; obuf->s.duration = (double)90000 * pv->isamples / pv->osamplerate; obuf->s.type = AUDIO_BUF; obuf->s.frametype = HB_FRAME_AUDIO; @@ -515,6 +517,10 @@ int encCoreAudioWork(hb_work_object_t *w, hb_buffer_t **buf_in, return HB_WORK_DONE; } + if (pv->first_pts == AV_NOPTS_VALUE) + { + pv->first_pts = in->s.start; + } hb_list_add(pv->list, in); *buf_out = buf = Encode(w); |