diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-07-12 22:18:36 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-14 03:49:41 +0200 |
commit | aa32971d2bd760228da1f3a6872731afda8d4523 (patch) | |
tree | a9af0909f81a1aff98ffd40989ba1de4e34da6b3 /libavcodec/utils.c | |
parent | 2fe186409bf3249669271502298bdc8844ce4e0b (diff) | |
download | ffmpeg-aa32971d2bd760228da1f3a6872731afda8d4523.tar.gz |
lavc: adjust timestamp in case of skiping initial samples
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 3ef52728ff..d6c1e0066d 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1658,6 +1658,12 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, } else { av_samples_copy(frame->extended_data, frame->extended_data, 0, avctx->internal->skip_samples, frame->nb_samples - avctx->internal->skip_samples, avctx->channels, frame->format); + if(avctx->pkt_timebase.num && avctx->sample_rate) { + if(frame->pkt_pts!=AV_NOPTS_VALUE) + frame->pkt_pts += av_rescale_q(avctx->internal->skip_samples,(AVRational){1, avctx->sample_rate}, avctx->pkt_timebase); + if(frame->pkt_dts!=AV_NOPTS_VALUE) + frame->pkt_dts += av_rescale_q(avctx->internal->skip_samples,(AVRational){1, avctx->sample_rate}, avctx->pkt_timebase); + } frame->nb_samples -= avctx->internal->skip_samples; avctx->internal->skip_samples = 0; } |