changeset 10663:dc61c373810e libavcodec

End startcode prefix search at the end of a AVC unit. Fixes issue1550.
author michael
date Wed, 09 Dec 2009 12:49:59 +0000
parents 80161fd66fd1
children f56b8a9be9e1
files h264.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Wed Dec 09 00:38:22 2009 +0000
+++ b/h264.c	Wed Dec 09 12:49:59 2009 +0000
@@ -7521,7 +7521,7 @@
             next_avc= buf_index + nalsize;
         } else {
             // start code prefix search
-            for(; buf_index + 3 < buf_size; buf_index++){
+            for(; buf_index + 3 < next_avc; buf_index++){
                 // This should always succeed in the first iteration.
                 if(buf[buf_index] == 0 && buf[buf_index+1] == 0 && buf[buf_index+2] == 1)
                     break;
@@ -7530,6 +7530,7 @@
             if(buf_index+3 >= buf_size) break;
 
             buf_index+=3;
+            if(buf_index >= next_avc) continue;
         }
 
         hx = h->thread_context[context_count];