summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-12-09 12:49:59 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-12-09 12:49:59 +0000
commit52255d17466e01aea5113a21f782efc76258b3f3 (patch)
treefcbece2b9c983e5942999b38e5d4b448c27f5243
parentf543f636a5d87c93cb73845668f09eb1874324b5 (diff)
End startcode prefix search at the end of a AVC unit.
Fixes issue1550. Originally committed as revision 20784 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/h264.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 058ee42a82..898c176d53 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -7521,7 +7521,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
next_avc= buf_index + nalsize;
} else {
// start code prefix search
- for(; buf_index + 3 < buf_size; buf_index++){
+ for(; buf_index + 3 < next_avc; buf_index++){
// This should always succeed in the first iteration.
if(buf[buf_index] == 0 && buf[buf_index+1] == 0 && buf[buf_index+2] == 1)
break;
@@ -7530,6 +7530,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
if(buf_index+3 >= buf_size) break;
buf_index+=3;
+ if(buf_index >= next_avc) continue;
}
hx = h->thread_context[context_count];