summaryrefslogtreecommitdiffstats
path: root/contrib/ffmpeg/old/A19-h264-refs.patch
blob: ad38b5825022014a2e60285e44cb4ce04daceed8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From dde41279a91fce7abf2687c34bb8529b66298466 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Sun, 1 May 2011 02:32:41 +0200
Subject: [PATCH] h264_refs: Fix decode error when too many refs

This improves upon a commit that was meant to fix intra only decoding.
The prior code caused decode errors in non-intra only.

H264: Fix intra only decoding.
This possibly fixes issue2679
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

(cherry picked from commit c059d7aa57391f2216808dbf2afdcb9e0a835ab5)
---
 libavcodec/h264_refs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index b4dc49c..1b9ecc9 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -697,8 +697,8 @@ int ff_h264_execute_ref_pic_marking(H264Context *h)
         }
     }
 
-    if (h->long_ref_count + h->short_ref_count -
-        (h->short_ref[0] == h->cur_pic_ptr) > h->ps.sps->ref_frame_count) {
+    if (h->long_ref_count + h->short_ref_count >
+        FFMAX(h->ps.sps->ref_frame_count, 1)) {
 
         /* We have too many reference frames, probably due to corrupted
          * stream. Need to discard one frame. Prevents overrun of the
-- 
2.9.3