From 963e15f9202729a86151e183841c894aaf689074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 1 May 2024 16:50:30 +0300 Subject: [PATCH] avviddec: Only use 2 ticks per frame if decoding interlaced video Part-of: --- subprojects/gst-libav/ext/libav/gstavviddec.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/subprojects/gst-libav/ext/libav/gstavviddec.c b/subprojects/gst-libav/ext/libav/gstavviddec.c index f131e99c94..fe51832d23 100644 --- a/subprojects/gst-libav/ext/libav/gstavviddec.c +++ b/subprojects/gst-libav/ext/libav/gstavviddec.c @@ -670,7 +670,9 @@ update_state: const gint fps_n = ffmpegdec->context->time_base.den; #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 31, 100) const gint ticks_per_frame = - (ffmpegdec->context-> + (GST_VIDEO_INFO_IS_INTERLACED (&ffmpegdec->input_state->info) + && ffmpegdec->context->codec_descriptor + && ffmpegdec->context-> codec_descriptor->props & AV_CODEC_PROP_FIELDS) ? 2 : 1; #else const gint ticks_per_frame = ffmpegdec->context->ticks_per_frame; @@ -1155,8 +1157,11 @@ static gboolean context_changed (GstFFMpegVidDec * ffmpegdec, AVCodecContext * context) { #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 31, 100) - const gint ticks_per_frame = (context->codec_descriptor - && context->codec_descriptor->props & AV_CODEC_PROP_FIELDS) ? 2 : 1; + const gint ticks_per_frame = + (GST_VIDEO_INFO_IS_INTERLACED (&ffmpegdec->input_state->info) + && ffmpegdec->context->codec_descriptor + && ffmpegdec->context-> + codec_descriptor->props & AV_CODEC_PROP_FIELDS) ? 2 : 1; #else const gint ticks_per_frame = context->ticks_per_frame; #endif @@ -1228,8 +1233,11 @@ update_video_context (GstFFMpegVidDec * ffmpegdec, AVCodecContext * context, ffmpegdec->pic_field_order_changed = FALSE; #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 31, 100) - const gint ticks_per_frame = (context->codec_descriptor - && context->codec_descriptor->props & AV_CODEC_PROP_FIELDS) ? 2 : 1; + const gint ticks_per_frame = + (GST_VIDEO_INFO_IS_INTERLACED (&ffmpegdec->input_state->info) + && ffmpegdec->context->codec_descriptor + && ffmpegdec->context-> + codec_descriptor->props & AV_CODEC_PROP_FIELDS) ? 2 : 1; #else const gint ticks_per_frame = context->ticks_per_frame; #endif