[FFmpeg-devel] [PATCH] avcodec/mediacodec: fix incorrect crop info
Zhao Zhili
quinkblack at foxmail.com
Mon Oct 10 18:19:02 EEST 2022
From: Zhao Zhili <zhilizhao at tencent.com>
The crop info is optional, but used unconditionally.
Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>
---
libavcodec/mediacodecdec_common.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c
index 2a605e7f5b..c1cbb28488 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -487,6 +487,11 @@ static int mediacodec_dec_parse_format(AVCodecContext *avctx, MediaCodecDecConte
AMEDIAFORMAT_GET_INT32(s->crop_left, "crop-left", 0);
AMEDIAFORMAT_GET_INT32(s->crop_right, "crop-right", 0);
+ if (s->crop_bottom == 0 || s->crop_right == 0) {
+ s->crop_top = s->crop_left = 0;
+ s->crop_right = s->width - 1;
+ s->crop_bottom = s->height - 1;
+ }
width = s->crop_right + 1 - s->crop_left;
height = s->crop_bottom + 1 - s->crop_top;
--
2.25.1
More information about the ffmpeg-devel
mailing list