From 48aecf5a7dd8e914d44cb4210a09172dbd8d5d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Wed, 9 Jan 2008 08:38:28 +0000 Subject: [PATCH] Fix a bug causing the generated stream to be corrupt if the buffer 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index a4cbf87310..03eb956caf 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -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; } }