User data following the sequence header can affect decoding, e.g. the TMPGEXS marker used by Sofdec files (handled since 5bebb6e64b). Without it in extradata, such streams decode incorrectly (wrong colors) after seeking.
Signed-off-by: dreamsyntax <[email protected]> --- I noticed that thumbfast had bad colors for Sofdec (.sfd) files, and this led me down the path to finding this bug. Details and a sample can be found here: https://github.com/po5/thumbfast/issues/116 I can reproduce it with: ffmpeg -ss 10 -i WRONG_COLORS__E8003.sfd -frames:v 1 out.png The file has a single sequence header, followed by the TMPGEXS user data, so after a seek the decoder only ever sees the extradata. I ran FATE with the full sample suite. Since this change makes the extradata include user data that follows the sequence header, I had to update muxer offsets and sizes/hashes in the FATE references. Let me know if that's the wrong way to go about this. libavcodec/bsf/extract_extradata.c | 3 ++- tests/ref/fate/matroska-encoding-delay | 16 ++++++++-------- tests/ref/fate/mpeg2-reserved-color-tags | 2 +- tests/ref/fate/mxf-probe-d10 | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/libavcodec/bsf/extract_extradata.c b/libavcodec/bsf/extract_extradata.c index 3c66f392b2..166bf998ae 100644 --- a/libavcodec/bsf/extract_extradata.c +++ b/libavcodec/bsf/extract_extradata.c @@ -534,7 +534,8 @@ static int extract_extradata_mpeg12(AVBSFContext *ctx, AVPacket *pkt, state = (state << 8) | pkt->data[i]; if (state == 0x1B3) found = 1; - else if (found && state != 0x1B5 && state < 0x200 && state >= 0x100) { + else if (found && state != 0x1B5 && state != 0x1B2 && + state < 0x200 && state >= 0x100) { *size = i - 3; *data = av_malloc(*size + AV_INPUT_BUFFER_PADDING_SIZE); if (!*data) diff --git a/tests/ref/fate/matroska-encoding-delay b/tests/ref/fate/matroska-encoding-delay index 64e6896435..2f68d7adb0 100644 --- a/tests/ref/fate/matroska-encoding-delay +++ b/tests/ref/fate/matroska-encoding-delay @@ -1,6 +1,6 @@ -bea95e8b4aca54240532ae8bd17267fa *tests/data/fate/matroska-encoding-delay.matroska -961251 tests/data/fate/matroska-encoding-delay.matroska -#extradata 0: 22, 0x32ea0490 +75e535034afd0bb3942345431e90abfb *tests/data/fate/matroska-encoding-delay.matroska +961262 tests/data/fate/matroska-encoding-delay.matroska +#extradata 0: 33, 0x6ad7054e #tb 0: 1/100000 #media_type 0: video #codec_id 0: mpeg2video @@ -32,7 +32,7 @@ dts_time=-0.010020 duration=2400 duration_time=0.024000 size=1152 -pos=1262 +pos=1273 flags=K__ [SIDE_DATA] side_data_type=Skip Samples @@ -52,7 +52,7 @@ dts_time=0.000000 duration=4000 duration_time=0.040000 size=237628 -pos=2422 +pos=2433 flags=K__ [/PACKET] [PACKET] @@ -65,7 +65,7 @@ dts_time=0.013980 duration=2400 duration_time=0.024000 size=1152 -pos=240057 +pos=240068 flags=K__ [/PACKET] [PACKET] @@ -78,7 +78,7 @@ dts_time=0.037980 duration=2400 duration_time=0.024000 size=1152 -pos=241233 +pos=241244 flags=K__ [/PACKET] [PACKET] @@ -91,7 +91,7 @@ dts_time=0.040000 duration=4000 duration_time=0.040000 size=238066 -pos=242393 +pos=242404 flags=K__ [/PACKET] [STREAM] diff --git a/tests/ref/fate/mpeg2-reserved-color-tags b/tests/ref/fate/mpeg2-reserved-color-tags index 33b7427d43..838325cf93 100644 --- a/tests/ref/fate/mpeg2-reserved-color-tags +++ b/tests/ref/fate/mpeg2-reserved-color-tags @@ -1,6 +1,6 @@ 93a1216babef80cfb659958a2890fbfb *tests/data/fate/mpeg2-reserved-color-tags.mpeg2video 268865 tests/data/fate/mpeg2-reserved-color-tags.mpeg2video -#extradata 0: 150, 0x5e531c02 +#extradata 0: 237, 0x2d5d33c2 #tb 0: 1/1200000 #media_type 0: video #codec_id 0: mpeg2video diff --git a/tests/ref/fate/mxf-probe-d10 b/tests/ref/fate/mxf-probe-d10 index a6467baac8..1ea115be58 100644 --- a/tests/ref/fate/mxf-probe-d10 +++ b/tests/ref/fate/mxf-probe-d10 @@ -34,7 +34,7 @@ bits_per_raw_sample=N/A nb_frames=N/A nb_read_frames=N/A nb_read_packets=N/A -extradata_size=22 +extradata_size=33 DISPOSITION:default=0 DISPOSITION:dub=0 DISPOSITION:original=0 -- 2.56.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
