diff mbox series

[FFmpeg-devel,2/7] lavc/encode: do not use pkt_duration for encoding

Message ID 20230414164244.15264-2-anton@khirnov.net
State Accepted
Commit 6118be25e15121bcd4770585900723bd9baefc9b
Headers show
Series [FFmpeg-devel,1/7] lavfi: ensure audio frame durations match the sample count | expand


Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov April 14, 2023, 4:42 p.m. UTC
Current code prefers deprecated AVFrame.pkt_duration over its
replacement AVFrame.duration whenever the former is set and not equal to
the latter. However, duration will only be actually used when the
caller sets the AV_CODEC_FLAG_FRAME_DURATION flag, which was added
_after_ AVFrame.duration.

This implies that any caller aware of AV_CODEC_FLAG_FRAME_DURATION is
also aware of AVFrame.duration. pkt_duration should then never be used.
 libavcodec/encode.c | 7 -------
 1 file changed, 7 deletions(-)
diff mbox series


diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 041fc7670e..0f11efc481 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -457,13 +457,6 @@  static int encode_send_frame_internal(AVCodecContext *avctx, const AVFrame *src)
-    if (dst->pkt_duration && dst->pkt_duration != dst->duration)
-        dst->duration = dst->pkt_duration;
     if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
         ret = encode_generate_icc_profile(avctx, dst);
         if (ret < 0)