[FFmpeg-cvslog] avcodec/h264: Allow partial escaping

Michael Niedermayer git at videolan.org
Fri Oct 3 03:47:45 CEST 2014


ffmpeg | branch: release/2.3 | Michael Niedermayer <michaelni at gmx.at> | Sun Sep  7 01:42:28 2014 +0200| [f68395f7fcabc32f901deaa5dffd7d0ae0b458d6] | committer: Michael Niedermayer

avcodec/h264: Allow partial escaping

Fixes Ticket3923

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 033a5334badd8af48f13c6fd1e6827f8e3f2c2f3)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f68395f7fcabc32f901deaa5dffd7d0ae0b458d6
---

 libavcodec/h264.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index f110a67..22fd829 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;                                                 \
         }                                                               \
@@ -321,7 +321,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;



More information about the ffmpeg-cvslog mailing list