aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorIvan <grigoriev.ivan.a@gmail.com>2016-04-12 16:32:04 -0400
committerMichael Niedermayer <michael@niedermayer.cc>2016-04-17 02:40:53 +0200
commit76573c5239fb7d293cc350807f02cc3e91bff18d (patch)
treee9f83a811ef16410f4fffc7d878576ef50e2a700 /libavcodec/h264.c
parent14fdebc4ffcbaa202fe4568234fcb26752b416ad (diff)
downloadffmpeg-76573c5239fb7d293cc350807f02cc3e91bff18d.tar.gz
avcodec/h264: Fix for H.264 configuration parsing
Sometimes video fails to decode if H.264 configuration changes mid stream. The reason is that configuration parser assumes that nal_ref_idc is equal to 11b while actually some codecs but 01b there. The H.264 spec is somewhat vague about this but it looks like it allows any non-zero nal_ref_idc for sps/pps. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 3a727606c474d3d0b9efa3c900294a84bdb5e331) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index f1399b886a..88768af733 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1781,7 +1781,7 @@ static int is_extra(const uint8_t *buf, int buf_size)
const uint8_t *p= buf+6;
while(cnt--){
int nalsize= AV_RB16(p) + 2;
- if(nalsize > buf_size - (p-buf) || p[2]!=0x67)
+ if(nalsize > buf_size - (p-buf) || (p[2] & 0x9F) != 7)
return 0;
p += nalsize;
}
@@ -1790,7 +1790,7 @@ static int is_extra(const uint8_t *buf, int buf_size)
return 0;
while(cnt--){
int nalsize= AV_RB16(p) + 2;
- if(nalsize > buf_size - (p-buf) || p[2]!=0x68)
+ if(nalsize > buf_size - (p-buf) || (p[2] & 0x9F) != 8)
return 0;
p += nalsize;
}