Commit 033a5334 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/h264: Allow partial escaping

Fixes Ticket3923
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent c2430304
...@@ -248,7 +248,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, ...@@ -248,7 +248,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
#define STARTCODE_TEST \ #define STARTCODE_TEST \
if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \ 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 */ \ /* startcode, so we must be past the end */ \
length = i; \ length = i; \
} \ } \
...@@ -320,7 +320,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, ...@@ -320,7 +320,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
if (src[si + 2] > 3) { if (src[si + 2] > 3) {
dst[di++] = src[si++]; dst[di++] = src[si++];
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 if (src[si + 2] == 3) { // escape
dst[di++] = 0; dst[di++] = 0;
dst[di++] = 0; dst[di++] = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment