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:
authorAnton Khirnov <anton@khirnov.net>2016-05-20 13:30:42 +0300
committerAnton Khirnov <anton@khirnov.net>2016-06-21 12:20:26 +0300
commite26c64148be8a20ace7512d96503172fb5e9753b (patch)
tree57cfa88685fd2b448e462ba42ee515810e9c0f8e /libavcodec/h264dec.c
parent6efc4638584e1e14d1a6152186ba28f5d48a80c0 (diff)
h264: discard slices of redundant pictures right after parsing the slice header
Going through the whole decoder initialization process for a slice we are not going to decode is unnecessary and potentially dangerous.
Diffstat (limited to 'libavcodec/h264dec.c')
-rw-r--r--libavcodec/h264dec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index b98d1416c1..38ecc9477f 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -701,6 +701,9 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
if ((err = ff_h264_decode_slice_header(h, sl, nal)))
break;
+ if (sl->redundant_pic_count > 0)
+ break;
+
if (h->sei.recovery_point.recovery_frame_cnt >= 0 && h->recovery_frame < 0) {
h->recovery_frame = (h->poc.frame_num + h->sei.recovery_point.recovery_frame_cnt) &
((1 << h->ps.sps->log2_max_frame_num) - 1);
@@ -724,8 +727,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
decode_postinit(h, i >= nals_needed);
}
- if (sl->redundant_pic_count == 0 &&
- (avctx->skip_frame < AVDISCARD_NONREF || nal->ref_idc) &&
+ if ((avctx->skip_frame < AVDISCARD_NONREF || nal->ref_idc) &&
(avctx->skip_frame < AVDISCARD_BIDIR ||
sl->slice_type_nos != AV_PICTURE_TYPE_B) &&
(avctx->skip_frame < AVDISCARD_NONKEY ||