Commit 5ac09008c8 for ffmpeg
commit 5ac09008c89cf9a76228d1c2f9f7f61a5fd00852
Author: Zhao Zhili <quinkblack@foxmail.com>
Date: Tue Oct 13 19:16:02 2026 +0800
avcodec/mediacodecdec_common: drop the MediaTek crop workaround
MediaTek decoders report a default crop rectangle in the initial output
format, and the workaround stopped reading the "crop" rectangle from
them on the NDK path so that the default did not reach the codec
context. The initial format no longer sets the crop rectangle of the
codec context, while the workaround also discards the correct rectangle
these decoders report with INFO_OUTPUT_FORMAT_CHANGED, which leaves the
frames at the full width and height of the output buffers.
This reverts commit 7fe9d12f2571265b2a7b5c763d62ee80f9a9e2e2.
diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c
index fda5a3d9ce..4fe89982da 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -615,8 +615,7 @@ static int mediacodec_dec_parse_video_format(AVCodecContext *avctx, MediaCodecDe
AMEDIAFORMAT_GET_INT32(s->crop_right, "crop-right", 0);
// Try "crop" for NDK
- // 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."))
+ if (!(s->crop_right && s->crop_bottom) && s->use_ndk_codec)
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) {