diff options
author | jstebbins <[email protected]> | 2012-05-01 10:05:53 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2012-05-01 10:05:53 +0000 |
commit | 2e8be70b9910c62d8d8cb693f8c58485efbf4e97 (patch) | |
tree | b1bccf23e518790e29948fcf11503b6cf79fc0ae /libhb/sync.c | |
parent | 4dcf3fcfd9aaeca7fe7ec06ff8c0c6b2d5d3c198 (diff) |
libhb: fix problem with incorrect addition of audio silence
sync needs the precise duration of a frame of audio and has
no way to compute it for passthru audio. So add a duration
member to hb_buffer_t and set it in the audio decoders.
This should eventually supersede hb_buffer_t member "stop"
since it provides redundant information.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4618 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/sync.c')
-rw-r--r-- | libhb/sync.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libhb/sync.c b/libhb/sync.c index c76cc45d2..1a10e5e5e 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -1050,7 +1050,15 @@ static hb_buffer_t * OutputAudioFrame( hb_audio_t *audio, hb_buffer_t *buf, hb_sync_audio_t *sync ) { int64_t start = (int64_t)sync->next_start; - double duration = buf->s.stop - buf->s.start; + + // Can't count of buf->s.stop - buf->s.start for accurate duration + // due to integer rounding, so use buf->s.duration when it is set + // (which should be always if I didn't miss anything) + double duration; + if ( buf->s.duration > 0 ) + duration = buf->s.duration; + else + duration = buf->s.stop - buf->s.start; if ( !( audio->config.out.codec & HB_ACODEC_PASS_FLAG ) ) { |