aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2022-11-05 21:20:06 +0100
committerTimo Rothenpieler <timo@rothenpieler.org>2022-11-06 00:53:02 +0100
commitaa3d98227e88f316f56aa73a5c6356e3949e9808 (patch)
tree07b41151ca36a8ca62de999ab39d8a3941347c6e /libavcodec
parent6362b8cd19c72f5b7b58709729afac2a965c3e37 (diff)
downloadffmpeg-aa3d98227e88f316f56aa73a5c6356e3949e9808.tar.gz
avcodec/nvenc: don't queue and offset dts for AV1
dts != pts is actually a spec violation for AV1, given it has no reordering in the classical sense. We don't really need the whole timestamp queue in this case and can just pass through the timestamp as is for both dts and pts.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/nvenc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 0d1d68d70d..2583ec2912 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -2170,9 +2170,13 @@ static int nvenc_set_timestamp(AVCodecContext *avctx,
NvencContext *ctx = avctx->priv_data;
pkt->pts = params->outputTimeStamp;
- pkt->dts = timestamp_queue_dequeue(ctx->timestamp_list);
- pkt->dts -= FFMAX(ctx->encode_config.frameIntervalP - 1, 0) * FFMAX(avctx->ticks_per_frame, 1);
+ if (avctx->codec_descriptor->props & AV_CODEC_PROP_REORDER) {
+ pkt->dts = timestamp_queue_dequeue(ctx->timestamp_list);
+ pkt->dts -= FFMAX(ctx->encode_config.frameIntervalP - 1, 0) * FFMAX(avctx->ticks_per_frame, 1);
+ } else {
+ pkt->dts = pkt->pts;
+ }
return 0;
}
@@ -2582,7 +2586,9 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
if (frame && frame->buf[0]) {
av_fifo_write(ctx->output_surface_queue, &in_surf, 1);
- timestamp_queue_enqueue(ctx->timestamp_list, frame->pts);
+
+ if (avctx->codec_descriptor->props & AV_CODEC_PROP_REORDER)
+ timestamp_queue_enqueue(ctx->timestamp_list, frame->pts);
}
/* all the pending buffers are now ready for output */