[FFmpeg-cvslog] vc1: Fix the skip condition

Luca Barbato git at videolan.org
Sun Sep 14 15:58:38 CEST 2014


ffmpeg | branch: release/2.4 | Luca Barbato <lu_zero at gentoo.org> | Sun Aug 24 19:34:13 2014 +0200| [8c91414803e4cd26dcb27e6147424d09d19cd72a] | committer: Luca Barbato

vc1: Fix the skip condition

As written in the comment above, skip must be added only if a
start code is found.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8c91414803e4cd26dcb27e6147424d09d19cd72a
---

 libavcodec/vc1_parser.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index 43ca0ed..a653282 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -123,6 +123,7 @@ static int vc1_parse(AVCodecParserContext *s,
     uint8_t *unesc_buffer = vpc->unesc_buffer;
     size_t unesc_index = vpc->unesc_index;
     VC1ParseSearchState search_state = vpc->search_state;
+    int start_code_found;
     int next = END_NOT_FOUND;
     int i = vpc->bytes_to_skip;
 
@@ -133,8 +134,8 @@ static int vc1_parse(AVCodecParserContext *s,
         next = 0;
     }
     while (i < buf_size) {
-        int start_code_found = 0;
         uint8_t b;
+        start_code_found = 0;
         while (i < buf_size && unesc_index < UNESCAPED_THRESHOLD) {
             b = buf[i++];
             unesc_buffer[unesc_index++] = b;
@@ -232,7 +233,7 @@ static int vc1_parse(AVCodecParserContext *s,
      * the start code we've already seen, or cause extra bytes to be
      * inserted at the start of the unescaped buffer. */
     vpc->bytes_to_skip = 4;
-    if (next < 0)
+    if (next < 0 && start_code_found)
         vpc->bytes_to_skip += next;
 
     *poutbuf = buf;



More information about the ffmpeg-cvslog mailing list