]> git.sesse.net Git - ffmpeg/commitdiff
Revert "h264: clear trailing bits in partially parsed NAL units"
authorJanne Grunau <janne-libav@jannau.net>
Mon, 12 Mar 2012 21:01:02 +0000 (22:01 +0100)
committerJanne Grunau <janne-libav@jannau.net>
Mon, 12 Mar 2012 21:46:56 +0000 (22:46 +0100)
This reverts commit 729ebb2f185244b0ff06d48edbbbbb02ceb4ed4e.

There was an off-by-one error in the bit mask calculation clearing
actually the last valid bit and causing
http://bugzilla.libav.org/show_bug.cgi?id=227

The broken sample (Mr_MrsSmith-h264_aac.mp4) the commit was fixing
does not work after correcting the off-by-one error.

CC: libav-stable@libav.org
libavcodec/h264.c

index 31a69f9a1439953b459cf9c3beea200152be5e58..20aed27fd1ceddca0fb7a4f2dae0a5e2677c1d72 100644 (file)
@@ -3764,7 +3764,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
         int consumed;
         int dst_length;
         int bit_length;
-        uint8_t *ptr;
+        const uint8_t *ptr;
         int i, nalsize = 0;
         int err;
 
@@ -3814,9 +3814,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
         }
 
         if (h->is_avc && (nalsize != consumed) && nalsize){
-            // set trailing bits in the last partial byte to zero
-            if (bit_length & 7)
-                ptr[bit_length >> 3] = ptr[bit_length >> 3] & (0xff << 8 - (bit_length & 7));
             av_log(h->s.avctx, AV_LOG_DEBUG, "AVC: Consumed only %d bytes instead of %d\n", consumed, nalsize);
         }