1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

h264dec: support broken files with mp4 extradata/annex b data

Bug-Id: 966
This commit is contained in:
Anton Khirnov 2016-10-01 10:03:05 +02:00
parent 2124711b95
commit 5bf2454e7c

View File

@ -530,6 +530,23 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR,
"Error splitting the input into NAL units.\n");
/* There are samples in the wild with mp4-style extradata, but Annex B
* data in the packets. If we fail parsing the packet as mp4, try it again
* as Annex B. */
if (h->is_avc && !(avctx->err_recognition & AV_EF_EXPLODE)) {
int err = ff_h2645_packet_split(&h->pkt, buf, buf_size, avctx, 0, 0,
avctx->codec_id);
if (err >= 0) {
av_log(avctx, AV_LOG_WARNING,
"The stream seems to contain AVCC extradata with Annex B "
"formatted data, which is invalid.");
h->is_avc = 0;
ret = 0;
}
}
if (ret < 0)
return ret;
}