changeset 7772:834a8f89b75e libavcodec

Try to support invalid h264 that does not mark IDR with POC=0. Fixes issue576.
author michael
date Tue, 02 Sep 2008 16:31:18 +0000
parents 58fdf1638bc4
children 272a13ae94c0
files h264.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Tue Sep 02 04:04:26 2008 +0000
+++ b/h264.c	Tue Sep 02 16:31:18 2008 +0000
@@ -7488,7 +7488,7 @@
 //FIXME factorize this with the output code below
         out = h->delayed_pic[0];
         out_idx = 0;
-        for(i=1; h->delayed_pic[i] && h->delayed_pic[i]->poc; i++)
+        for(i=1; h->delayed_pic[i] && (h->delayed_pic[i]->poc && !h->delayed_pic[i]->key_frame); i++)
             if(h->delayed_pic[i]->poc < out->poc){
                 out = h->delayed_pic[i];
                 out_idx = i;
@@ -7632,12 +7632,12 @@
 
             out = h->delayed_pic[0];
             out_idx = 0;
-            for(i=1; h->delayed_pic[i] && h->delayed_pic[i]->poc; i++)
+            for(i=1; h->delayed_pic[i] && (h->delayed_pic[i]->poc && !h->delayed_pic[i]->key_frame); i++)
                 if(h->delayed_pic[i]->poc < out->poc){
                     out = h->delayed_pic[i];
                     out_idx = i;
                 }
-            cross_idr = !h->delayed_pic[0]->poc || !!h->delayed_pic[i];
+            cross_idr = !h->delayed_pic[0]->poc || !!h->delayed_pic[i] || h->delayed_pic[0]->key_frame;
 
             out_of_order = !cross_idr && out->poc < h->outputed_poc;