[FFmpeg-cvslog] avformat/concatdec: fix the h264 annexb extradata check

James Almer git at videolan.org
Wed May 17 23:04:16 EEST 2017


ffmpeg | branch: release/3.0 | James Almer <jamrial at gmail.com> | Tue Apr 25 20:23:12 2017 -0300| [30415662ef7a4d8f3a2bffd2a8c05a801b42a279] | committer: James Almer

avformat/concatdec: fix the h264 annexb extradata check

The start code can be either in the first three or four bytes.

(cherry picked from commit b4330a0e02fcbef61d630a369abe5f4421ced659)

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

 libavformat/concatdec.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index de7b89a28f..9c7484eb95 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -193,8 +193,11 @@ static int detect_stream_specific(AVFormatContext *avf, int idx)
     ConcatStream *cs = &cat->cur_file->streams[idx];
     AVBitStreamFilterContext *bsf;
 
-    if (cat->auto_convert && st->codec->codec_id == AV_CODEC_ID_H264 &&
-        (st->codec->extradata_size < 4 || AV_RB32(st->codec->extradata) != 1)) {
+    if (cat->auto_convert && st->codec->codec_id == AV_CODEC_ID_H264) {
+        if (!st->codec->extradata_size                                             ||
+            (st->codec->extradata_size >= 3 && AV_RB24(st->codec->extradata) == 1) ||
+            (st->codec->extradata_size >= 4 && AV_RB32(st->codec->extradata) == 1))
+            return 0;
         av_log(cat->avf, AV_LOG_INFO,
                "Auto-inserting h264_mp4toannexb bitstream filter\n");
         if (!(bsf = av_bitstream_filter_init("h264_mp4toannexb"))) {



More information about the ffmpeg-cvslog mailing list