summaryrefslogtreecommitdiff
path: root/libavcodec/encode.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-07-12 10:42:49 +0200
committerAnton Khirnov <anton@khirnov.net>2022-10-11 11:59:11 +0200
commitadb927fa7aa9d9b9357f09117ca5a449be1fe3d7 (patch)
treea1f780f03c183646663f376a4ee02597aca95762 /libavcodec/encode.c
parent8789720d28f55ed72721cb4fe4c20c73e73114fc (diff)
downloadffmpeg-adb927fa7aa9d9b9357f09117ca5a449be1fe3d7.tar.gz
lavc/encode: combine setting no-delay pts for video/audio
Diffstat (limited to 'libavcodec/encode.c')
-rw-r--r--libavcodec/encode.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 72b92d2548..fbe2c97cd6 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -209,13 +209,13 @@ int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket *avpkt,
av_assert0(avpkt->buf);
}
- if (avctx->codec->type == AVMEDIA_TYPE_VIDEO &&
- !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
- avpkt->pts = frame->pts;
+ // set the timestamps for the simple no-delay case
+ // encoders with delay have to set the timestamps themselves
if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY)) {
+ if (avpkt->pts == AV_NOPTS_VALUE)
+ avpkt->pts = frame->pts;
+
if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
- if (avpkt->pts == AV_NOPTS_VALUE)
- avpkt->pts = frame->pts;
if (!avpkt->duration)
avpkt->duration = ff_samples_to_time_base(avctx,
frame->nb_samples);