Commit 870f1e38 authored by James Almer's avatar 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 b4330a0e)
parent 0109a152
...@@ -192,8 +192,11 @@ static int detect_stream_specific(AVFormatContext *avf, int idx) ...@@ -192,8 +192,11 @@ static int detect_stream_specific(AVFormatContext *avf, int idx)
ConcatStream *cs = &cat->cur_file->streams[idx]; ConcatStream *cs = &cat->cur_file->streams[idx];
AVBitStreamFilterContext *bsf; AVBitStreamFilterContext *bsf;
if (cat->auto_convert && st->codec->codec_id == AV_CODEC_ID_H264 && if (cat->auto_convert && st->codec->codec_id == AV_CODEC_ID_H264) {
(st->codec->extradata_size < 4 || AV_RB32(st->codec->extradata) != 1)) { 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, av_log(cat->avf, AV_LOG_INFO,
"Auto-inserting h264_mp4toannexb bitstream filter\n"); "Auto-inserting h264_mp4toannexb bitstream filter\n");
if (!(bsf = av_bitstream_filter_init("h264_mp4toannexb"))) { if (!(bsf = av_bitstream_filter_init("h264_mp4toannexb"))) {
......
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