summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-22 18:02:48 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-22 18:35:43 +0100
commit985aa0be828da073d765a8c1dbb38efad43891ed (patch)
tree32172ac6b2dec6cc8294dbdc125863601bce0642 /libavcodec
parent5715d67bae08ed688a9cd1bcf14c03ca0e750763 (diff)
h264: Detect POC inconsistencies and try to handle them reasonably
Improves the file from Ticket2050 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 3bd840df12..63df2c71c4 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1517,7 +1517,13 @@ static void decode_postinit(H264Context *h, int setup_finished)
if( cur->f.pict_type == AV_PICTURE_TYPE_B
|| (h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > INT_MIN && h->last_pocs[MAX_DELAYED_PIC_COUNT-1] - h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > 2))
out_of_order = FFMAX(out_of_order, 1);
- if(s->avctx->has_b_frames < out_of_order && !h->sps.bitstream_restriction_flag){
+ if (out_of_order == MAX_DELAYED_PIC_COUNT) {
+ av_log(s->avctx, AV_LOG_VERBOSE, "Invalid POC %d<%d\n", cur->poc, h->last_pocs[0]);
+ for (i = 1; i < MAX_DELAYED_PIC_COUNT; i++)
+ h->last_pocs[i] = INT_MIN;
+ h->last_pocs[0] = cur->poc;
+ cur->mmco_reset = 1;
+ } else if(s->avctx->has_b_frames < out_of_order && !h->sps.bitstream_restriction_flag){
av_log(s->avctx, AV_LOG_VERBOSE, "Increasing reorder buffer to %d\n", out_of_order);
s->avctx->has_b_frames = out_of_order;
s->low_delay = 0;