aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-13 22:36:07 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2013-02-14 13:33:44 +0100
commit2ac6b573a4083e5b840f3577a063237ae0088401 (patch)
treef3b48e2fbc8d3d22c55d60b4361e3ccfe81964e9
parent7f8846405e8adb0d84c62226839a2995e4e89202 (diff)
downloadffmpeg-2ac6b573a4083e5b840f3577a063237ae0088401.tar.gz
h264: Reset last_pocs in case of reference or frame number inconsistencies
This prevents faulty increasing of has_b_frames Should fix Ticket 2062 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit c230af9bccc3cadb373f9007ba14fffb6c2acc75)
-rw-r--r--libavcodec/h264.c3
-rw-r--r--libavcodec/h264_refs.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 0aab4e7328..56ef1092bd 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2968,6 +2968,9 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL;
av_log(h->s.avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n",
h->frame_num, h->prev_frame_num);
+ if (!h->sps.gaps_in_frame_num_allowed_flag)
+ for(i=0; i<FF_ARRAY_ELEMS(h->last_pocs); i++)
+ h->last_pocs[i] = INT_MIN;
if (ff_h264_frame_start(h) < 0)
return -1;
h->prev_frame_num++;
diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index d09f15cacd..32c84d8e6f 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -287,7 +287,10 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h){
for(list=0; list<h->list_count; list++){
for(index= 0; index < h->ref_count[list]; index++){
if (!h->ref_list[list][index].f.data[0]) {
+ int i;
av_log(h->s.avctx, AV_LOG_ERROR, "Missing reference picture, default is %d\n", h->default_ref_list[list][0].poc);
+ for (i=0; i<FF_ARRAY_ELEMS(h->last_pocs); i++)
+ h->last_pocs[i] = INT_MIN;
if (h->default_ref_list[list][0].f.data[0])
h->ref_list[list][index]= h->default_ref_list[list][0];
else