[FFmpeg-devel] [PATCH] avcodec/mediacodecdec: Reset optional fields when parse format
Zhao Zhili
quinkblack at foxmail.com
Tue Apr 1 13:11:58 EEST 2025
From: Zhao Zhili <zhilizhao at tencent.com>
Parse format can be called multiple times, e.g., when resolution
changed. If getInt32 fails, optional member variables will retain
their previously set values without modification. This can be a
big problem for new resolution with old crop info.
This patch reset optional fields to zero when getInt32 failed.
---
libavcodec/mediacodecdec_common.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c
index 8a270f2f29..ae336ab835 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -537,6 +537,8 @@ static int mediacodec_wrap_sw_buffer(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", key, format); \
ret = AVERROR_EXTERNAL; \
goto fail; \
+ } else { \
+ (name) = 0; \
} \
} while (0) \
--
2.46.0
More information about the ffmpeg-devel
mailing list