[FFmpeg-cvslog] avcodec/mediacodecdec_common: Workaround MTK broken crop implementation
Zhao Zhili
git at videolan.org
Tue Apr 1 12:35:25 EEST 2025
ffmpeg | branch: release/7.1 | Zhao Zhili <zhilizhao at tencent.com> | Fri Oct 11 15:49:44 2024 +0800| [48c0f071d4b5dd3c06c9978a2edc0fdcbbc3717a] | committer: Zhao Zhili
avcodec/mediacodecdec_common: Workaround MTK broken crop implementation
MediaTek SOC return broken crop info, e.g.,
width: int32(3840) height: int32(2160) crop: Rect(0, 0, 318, 238)
It will notify the right crop info with infoOutputFormatChanged, but
too late.
Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>
(cherry picked from commit 7fe9d12f2571265b2a7b5c763d62ee80f9a9e2e2)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=48c0f071d4b5dd3c06c9978a2edc0fdcbbc3717a
---
libavcodec/mediacodecdec_common.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c
index 3770b4f3ae..8a270f2f29 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -594,7 +594,8 @@ static int mediacodec_dec_parse_video_format(AVCodecContext *avctx, MediaCodecDe
AMEDIAFORMAT_GET_INT32(s->crop_right, "crop-right", 0);
// Try "crop" for NDK
- if (!(s->crop_right && s->crop_bottom) && s->use_ndk_codec)
+ // MediaTek SOC return some default value like Rect(0, 0, 318, 238)
+ if (!(s->crop_right && s->crop_bottom) && s->use_ndk_codec && !strstr(s->codec_name, ".mtk."))
ff_AMediaFormat_getRect(s->format, "crop", &s->crop_left, &s->crop_top, &s->crop_right, &s->crop_bottom);
if (s->crop_right && s->crop_bottom) {
More information about the ffmpeg-cvslog
mailing list