summaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-02-10 17:16:18 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2012-02-21 15:18:51 -0500
commit70749c483c53312faa83ff3890fa4e2f7135453d (patch)
treec1e3931a146fa134f61194cde193c053167d80f5 /libavcodec/utils.c
parent2c87c7a952569c63a9f981fc0e3f8c5867ad2279 (diff)
downloadffmpeg-streaming-70749c483c53312faa83ff3890fa4e2f7135453d.zip
ffmpeg-streaming-70749c483c53312faa83ff3890fa4e2f7135453d.tar.gz
avcodec: do not override pts or duration from the audio encoder
This allows encoders to set pts and/or duration even if they do not use CODEC_CAP_DELAY.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 2ab3b8e..c88f379 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -885,9 +885,11 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
if (!ret && *got_packet_ptr) {
if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) {
- avpkt->pts = frame->pts;
- avpkt->duration = ff_samples_to_time_base(avctx,
- frame->nb_samples);
+ if (avpkt->pts == AV_NOPTS_VALUE)
+ avpkt->pts = frame->pts;
+ if (!avpkt->duration)
+ avpkt->duration = ff_samples_to_time_base(avctx,
+ frame->nb_samples);
}
avpkt->dts = avpkt->pts;
} else {
OpenPOWER on IntegriCloud