fix crash issue because of high memory usage 05/251705/1
authorjiyong.min <jiyong.min@samsung.com>
Mon, 18 Jan 2021 07:18:18 +0000 (16:18 +0900)
committerhj kim <backto.kim@samsung.com>
Mon, 18 Jan 2021 23:45:57 +0000 (23:45 +0000)
 - 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

index 7d3e4ce..a3881d6 100644 (file)
@@ -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);
     }