avformat/concatdec: fix the h264 annexb extradata check

The start code can be either in the first three or four bytes.
This commit is contained in:
James Almer 2017-04-25 20:23:12 -03:00
parent 91f8ccdda0
commit b4330a0e02
1 changed files with 5 additions and 2 deletions

View File

@ -199,8 +199,11 @@ static int detect_stream_specific(AVFormatContext *avf, int idx)
AVBitStreamFilterContext *bsf; AVBitStreamFilterContext *bsf;
int ret; int ret;
if (cat->auto_convert && st->codecpar->codec_id == AV_CODEC_ID_H264 && if (cat->auto_convert && st->codecpar->codec_id == AV_CODEC_ID_H264) {
(st->codecpar->extradata_size < 4 || AV_RB32(st->codecpar->extradata) != 1)) { if (!st->codecpar->extradata_size ||
(st->codecpar->extradata_size >= 3 && AV_RB24(st->codecpar->extradata) == 1) ||
(st->codecpar->extradata_size >= 4 && AV_RB32(st->codecpar->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"))) {