[FFmpeg-devel] [PATCH 07/14] mediacodec: check whether cropping is set before use
Matthieu Bouron
matthieu.bouron at gmail.com
Fri Dec 15 11:30:06 EET 2017
On Fri, Dec 15, 2017 at 03:06:49PM +0800, wbsecg1 at gmail.com wrote:
> From: wang-bin <wbsecg1 at gmail.com>
Hi,
>
> ---
> libavcodec/mediacodecdec_common.c | 23 +++++++++--------------
> 1 file changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c
> index cb2f6ae5e5..05d3bcd4b5 100644
> --- a/libavcodec/mediacodecdec_common.c
> +++ b/libavcodec/mediacodecdec_common.c
> @@ -412,20 +412,15 @@ static int mediacodec_dec_parse_format(AVCodecContext *avctx, MediaCodecDecConte
> }
>
> /* Optional fields */
> - if (ff_AMediaFormat_getInt32(s->format, "crop-top", &value))
> - s->crop_top = value;
> -
> - if (ff_AMediaFormat_getInt32(s->format, "crop-bottom", &value))
> - s->crop_bottom = value;
> -
> - if (ff_AMediaFormat_getInt32(s->format, "crop-left", &value))
> - s->crop_left = value;
> -
> - if (ff_AMediaFormat_getInt32(s->format, "crop-right", &value))
> - s->crop_right = value;
> -
> - width = s->crop_right + 1 - s->crop_left;
> - height = s->crop_bottom + 1 - s->crop_top;
> + if (ff_AMediaFormat_getInt32(s->format, "crop-top", &s->crop_top) && ff_AMediaFormat_getInt32(s->format, "crop-bottom", &s->crop_bottom))
Please break this line after &&.
> + height = s->crop_bottom + 1 - s->crop_top;
> + else
> + height = s->height;
> +
> + if (ff_AMediaFormat_getInt32(s->format, "crop-left", &s->crop_left) && ff_AMediaFormat_getInt32(s->format, "crop-right", &s->crop_right))
Same here.
> + width = s->crop_right + 1 - s->crop_left;
> + else
> + width = s->width;
>
> av_log(avctx, AV_LOG_INFO,
> "Output crop parameters top=%d bottom=%d left=%d right=%d, "
On which device does this happen ?
Thanks,
--
Matthieu B.
More information about the ffmpeg-devel
mailing list