Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-08 20:27:26 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2019-09-24 18:53:39 +0300
commit1e984a69155c8b49d6fd4cd0a052d62da42d59a6 (patch)
tree146fc234c8782cdd5b55f63c30b2e54d53b4831d /libavcodec/h264_slice.c
parent340ab13504dddb71889f518983174d7bac7cfe96 (diff)
avcodec/h264_slice: clear frame only on gaps when it is not otherwise initilaized
Fixes: Timeout (53sec -> 31sec) Fixes: 16908/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5711207859748864 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/h264_slice.c')
-rw-r--r--libavcodec/h264_slice.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 5ceee107a0..e24d41ca50 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -458,12 +458,6 @@ static int h264_frame_start(H264Context *h)
H264Picture *pic;
int i, ret;
const int pixel_shift = h->pixel_shift;
- int c[4] = {
- 1<<(h->ps.sps->bit_depth_luma-1),
- 1<<(h->ps.sps->bit_depth_chroma-1),
- 1<<(h->ps.sps->bit_depth_chroma-1),
- -1
- };
if (!ff_thread_can_start_frame(h->avctx)) {
av_log(h->avctx, AV_LOG_ERROR, "Attempt to start a frame outside SETUP state\n");
@@ -504,8 +498,6 @@ static int h264_frame_start(H264Context *h)
if ((ret = alloc_picture(h, pic)) < 0)
return ret;
- if(!h->frame_recovered && !h->avctx->hwaccel)
- ff_color_frame(pic->f, c);
h->cur_pic_ptr = pic;
ff_h264_unref_picture(h, &h->cur_pic);
@@ -1582,6 +1574,13 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
* vectors. Given we are concealing a lost frame, this probably
* is not noticeable by comparison, but it should be fixed. */
if (h->short_ref_count) {
+ int c[4] = {
+ 1<<(h->ps.sps->bit_depth_luma-1),
+ 1<<(h->ps.sps->bit_depth_chroma-1),
+ 1<<(h->ps.sps->bit_depth_chroma-1),
+ -1
+ };
+
if (prev &&
h->short_ref[0]->f->width == prev->f->width &&
h->short_ref[0]->f->height == prev->f->height &&
@@ -1597,7 +1596,8 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
prev->f->width,
prev->f->height);
h->short_ref[0]->poc = prev->poc + 2;
- }
+ } else if (!h->frame_recovered && !h->avctx->hwaccel)
+ ff_color_frame(h->short_ref[0]->f, c);
h->short_ref[0]->frame_num = h->poc.prev_frame_num;
}
}