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.
pull/388/head
Timo Rothenpieler 2 years ago
parent 6362b8cd19
commit aa3d98227e
  1. 12
      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 */

Loading…
Cancel
Save