OSDN Git Service

Fix a bug causing the generated stream to be corrupt if the buffer
authorAndreas Öman <andreas@lonelycoder.com>
Wed, 9 Jan 2008 08:38:28 +0000 (08:38 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Wed, 9 Jan 2008 08:38:28 +0000 (08:38 +0000)
contains NAL units previous to the IDR where the SPS/PPS was inserted.

Ok:ed by Benoit on irc.

Originally committed as revision 11482 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/h264_mp4toannexb_bsf.c

index a4cbf87..03eb956 100644 (file)
@@ -41,8 +41,8 @@ static void alloc_and_copy(uint8_t **poutbuf,          int *poutbuf_size,
     if (!offset)
         AV_WB32(*poutbuf+sps_pps_size, 1);
     else {
-        (*poutbuf+offset)[0] = (*poutbuf+offset)[1] = 0;
-        (*poutbuf+offset)[2] = 1;
+        (*poutbuf+offset+sps_pps_size)[0] = (*poutbuf+offset+sps_pps_size)[1] = 0;
+        (*poutbuf+offset+sps_pps_size)[2] = 1;
     }
 }