1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

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.
This commit is contained in:
Justin Ruggles
2012-02-10 17:16:18 -05:00
parent 2c87c7a952
commit 70749c483c

View File

@@ -885,9 +885,11 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
if (!ret && *got_packet_ptr) { if (!ret && *got_packet_ptr) {
if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) { if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) {
avpkt->pts = frame->pts; if (avpkt->pts == AV_NOPTS_VALUE)
avpkt->duration = ff_samples_to_time_base(avctx, avpkt->pts = frame->pts;
frame->nb_samples); if (!avpkt->duration)
avpkt->duration = ff_samples_to_time_base(avctx,
frame->nb_samples);
} }
avpkt->dts = avpkt->pts; avpkt->dts = avpkt->pts;
} else { } else {