From 56701e69f1b9d94f9bc7483c2310f6687f672fe4 Mon Sep 17 00:00:00 2001 From: "jiyong.min" Date: Mon, 18 Jan 2021 16:18:18 +0900 Subject: [PATCH] fix crash issue because of high memory usage - The memory usage is high because of the invalid 'has_b_frames' value. The invalid 'has_b_frames' makes the condition in line #1239 false and 'h264_select_output_frame()' can't set the output frame in line #1241. So 'avcodec_receive_frame()' return the error(-11) due to no output frame. 'avformat_find_stream_info()' try decode frame repeatly. As the result, the internal buffer for decoding is raised in 'avformat_find_stream_info()'. - We applied the patch from ffmpeg. Change-Id: I12649d6ff7650454b9fcd5181687f20bddf0b44d (cherry picked from commit b96e080a02e9c1d5a69e7755d7f70b94395262eb) --- libavcodec/h264_slice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 7d3e4ce..a3881d6 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1154,7 +1154,7 @@ static int h264_select_output_frame(H264Context *h) int ret; if (sps->bitstream_restriction_flag || - h->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL) { + h->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT) { h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, sps->num_reorder_frames); } -- 2.7.4