Index: libs/libavcodec/mpeg12.c
===================================================================
--- libs/libavcodec/mpeg12.c	(revision 8969)
+++ libs/libavcodec/mpeg12.c	(working copy)
@@ -3051,6 +3051,8 @@
                 pc->frame_start_found=1;
                 break;
             }
+            if (state == SEQ_END_CODE)
+                return buf_size;
         }
     }
 
