From e26c64148be8a20ace7512d96503172fb5e9753b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 20 May 2016 12:30:42 +0200 Subject: 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. --- libavcodec/h264_slice.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libavcodec/h264_slice.c') diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index dbff1f3f8b..491039626e 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1565,6 +1565,10 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, if (ret < 0) return ret; + // discard redundant pictures + if (sl->redundant_pic_count > 0) + return 0; + if (!h->setup_finished) { if (sl->first_mb_addr == 0) { // FIXME better field boundary detection if (h->current_slice && h->cur_pic_ptr && FIELD_PICTURE(h)) { -- cgit v1.2.3