Jeff Downs <[EMAIL PROTECTED]> added the comment:

Attached should fix this.  Works on the handful of samples I have that had this
problem, plus the one mentioned here.

______________________________________________________
FFmpeg issue tracker <[EMAIL PROTECTED]>
<https://roundup.mplayerhq.hu/roundup/ffmpeg/issue216>
______________________________________________________
Index: libavcodec/h264.c
===================================================================
--- libavcodec/h264.c	(revision 11213)
+++ libavcodec/h264.c	(working copy)
@@ -3911,6 +3911,11 @@
     h->slice_type= slice_type;
 
     s->pict_type= h->slice_type; // to make a few old func happy, it's wrong though
+    if (s->pict_type == B_TYPE && s->last_picture_ptr == NULL) {
+        av_log(h->s.avctx, AV_LOG_ERROR, 
+               "B picture before any references, skipping\n");
+        return -1;
+    }
 
     pps_id= get_ue_golomb(&s->gb);
     if(pps_id>=MAX_PPS_COUNT){

Reply via email to