[Ffmpeg-cvslog] r8689 - trunk/libavcodec/h264.c

diego subversion
Mon Apr 9 15:39:35 CEST 2007


Author: diego
Date: Mon Apr  9 15:39:35 2007
New Revision: 8689

Modified:
   trunk/libavcodec/h264.c

Log:
Remove a NAL unit's trailing zero bytes even when dst_length is 1.
Consider the following byte sequence

    00 00 01 0a 00 00 00 01 09 ...
               ^  ^
               A  B

decode_nal() determines dst_length to be 1 (i. e. the byte between label
A and B above). However, this byte is a trailing zero byte as the spec
says the the current NAL unit is terminated by a byte sequence 00 00 00.

The current code used a loop to decrement dst_length accordingly. But the
loop doesn't start as the loop condition checks for dst_length > 1, which
should read dst_length > 0.
patch by Reinhard Nissl, rnissl gmx de


Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c	(original)
+++ trunk/libavcodec/h264.c	Mon Apr  9 15:39:35 2007
@@ -8147,7 +8147,7 @@ static int decode_nal_units(H264Context 
         if (ptr==NULL || dst_length < 0){
             return -1;
         }
-        while(ptr[dst_length - 1] == 0 && dst_length > 1)
+        while(ptr[dst_length - 1] == 0 && dst_length > 0)
             dst_length--;
         bit_length= 8*dst_length - decode_rbsp_trailing(h, ptr + dst_length - 1);
 




More information about the ffmpeg-cvslog mailing list