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.
pull/3/merge
Justin Ruggles 13 years ago
parent 2c87c7a952
commit 70749c483c
  1. 2
      libavcodec/utils.c

@ -885,7 +885,9 @@ 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)) {
if (avpkt->pts == AV_NOPTS_VALUE)
avpkt->pts = frame->pts;
if (!avpkt->duration)
avpkt->duration = ff_samples_to_time_base(avctx,
frame->nb_samples);
}

Loading…
Cancel
Save