aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-09-07 01:42:28 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-09-07 01:58:18 +0200
commit033a5334badd8af48f13c6fd1e6827f8e3f2c2f3 (patch)
tree87c32592709f4d53cf0bd6171956a99e0d96495d /libavcodec/h264.c
parentc2430304dfb3cc0e3a59ce6d1b59ebdcc934a0c2 (diff)
downloadffmpeg-033a5334badd8af48f13c6fd1e6827f8e3f2c2f3.tar.gz
avcodec/h264: Allow partial escaping
Fixes Ticket3923 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
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 0fcc769ef1..4b7ce9c7cb 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -248,7 +248,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
#define STARTCODE_TEST \
if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \
- if (src[i + 2] != 3) { \
+ if (src[i + 2] != 3 && src[i + 2] != 0) { \
/* startcode, so we must be past the end */ \
length = i; \
} \
@@ -320,7 +320,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
if (src[si + 2] > 3) {
dst[di++] = src[si++];
dst[di++] = src[si++];
- } else if (src[si] == 0 && src[si + 1] == 0) {
+ } else if (src[si] == 0 && src[si + 1] == 0 && src[si + 2] != 0) {
if (src[si + 2] == 3) { // escape
dst[di++] = 0;
dst[di++] = 0;