summaryrefslogtreecommitdiffstats
path: root/libhb/decavcodec.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2012-05-01 10:05:53 +0000
committerjstebbins <[email protected]>2012-05-01 10:05:53 +0000
commit2e8be70b9910c62d8d8cb693f8c58485efbf4e97 (patch)
treeb1bccf23e518790e29948fcf11503b6cf79fc0ae /libhb/decavcodec.c
parent4dcf3fcfd9aaeca7fe7ec06ff8c0c6b2d5d3c198 (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/decavcodec.c')
-rw-r--r--libhb/decavcodec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index bb7c4c3c3..45239a29c 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -1523,7 +1523,8 @@ static void decodeAudio( hb_audio_t * audio, hb_work_private_t *pv, uint8_t *dat
{
int isamp = av_get_bytes_per_sample( context->sample_fmt );
nsamples = out_size / isamp;
- double pts_next = pv->pts_next + nsamples * pv->duration;
+ double duration = nsamples * pv->duration;
+ double pts_next = pv->pts_next + duration;
// DTS-HD can be passed through to mkv
if( audio->config.out.codec & HB_ACODEC_PASS_FLAG )
@@ -1536,6 +1537,7 @@ static void decodeAudio( hb_audio_t * audio, hb_work_private_t *pv, uint8_t *dat
buf = hb_buffer_init( avp.size );
memcpy( buf->data, avp.data, avp.size );
buf->s.start = pv->pts_next;
+ buf->s.duration = duration;
buf->s.stop = pts_next;
hb_list_add( pv->list, buf );
pv->pts_next = pts_next;
@@ -1576,6 +1578,7 @@ static void decodeAudio( hb_audio_t * audio, hb_work_private_t *pv, uint8_t *dat
hb_buffer_t * buf;
buf = downmixAudio( audio, pv, buffer, context->channels, nsamples );
buf->s.start = pv->pts_next;
+ buf->s.duration = duration;
buf->s.stop = pts_next;
hb_list_add( pv->list, buf );