[FFmpeg-cvslog] h264: support invalid annex B in mp4

Michael Niedermayer git at videolan.org
Tue Nov 27 18:17:55 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Nov 27 18:06:00 2012 +0100| [93b89868e139e9b45dfc8a62b4f8e1832bbfd5d8] | committer: Michael Niedermayer

h264: support invalid annex B in mp4

Fixes Ticket1914

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

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

 libavcodec/h264.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 33803bf..14843cf 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3763,6 +3763,13 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
         ff_h264_reset_sei(h);
     }
 
+    if (h->nal_length_size == 4) {
+        if (buf_size > 8 && AV_RB32(buf) == 1 && AV_RB32(buf+5) > (unsigned)buf_size) {
+            h->is_avc = 0;
+        }else if(buf_size > 3 && AV_RB32(buf) > 1 && AV_RB32(buf) <= (unsigned)buf_size)
+            h->is_avc = 1;
+    }
+
     for (; pass <= 1; pass++) {
         buf_index     = 0;
         context_count = 0;



More information about the ffmpeg-cvslog mailing list