aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2016-05-06 16:20:13 +0200
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-05-07 21:11:21 +0100
commit9cc1ab63ac0fa524ad9b6c8ef600dc4fc69e2b31 (patch)
tree41449a6be7c88267936e642d717e038769566ca5
parentc802389393094ff76cb48cd816362ca731387a45 (diff)
downloadffmpeg-9cc1ab63ac0fa524ad9b6c8ef600dc4fc69e2b31.tar.gz
h2645_parse: allow partial escaping
This ports the fix from 033a533 to the new parser module in prepartion of using it for the h264 decoder. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
-rw-r--r--libavcodec/h2645_parse.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
index 496cd8d54e..aac9f99940 100644
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@ -38,7 +38,7 @@ int ff_h2645_extract_rbsp(const uint8_t *src, int length,
nal->skipped_bytes = 0;
#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; \
} \
@@ -103,7 +103,7 @@ int ff_h2645_extract_rbsp(const uint8_t *src, int length,
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;