Commit 16e3d7b5a6 for ffmpeg

commit 16e3d7b5a692303ab91d9bb529ce5b8c10c84982
Author: Romain Beauxis <romain.beauxis@gmail.com>
Date:   Fri Nov 20 00:45:11 2026 -0600

    tests/fate/preroll: compare mp3 decoding after a seek with a full decode

    Only the frames that match a decode from the start exactly are printed.
    The reference records the current behavior: mp3 declares no pre-roll,
    so the first frames after the target do not match.

diff --git a/tests/fate/preroll.mak b/tests/fate/preroll.mak
index c28515aefa..cb5b959ef0 100644
--- a/tests/fate/preroll.mak
+++ b/tests/fate/preroll.mak
@@ -5,7 +5,8 @@
 # the first packets read after a seek, and the timing of the decoded output
 # after a seek, with and without the samples before the target. The output
 # is silenced, as only its timing is compared and the decoders are not
-# bit-exact across platforms.
+# bit-exact across platforms. The match tests below compare two decodes made
+# in the same run instead, which are equal on any platform once converged.

 PREROLL_SEEK_TS = 0.53
 PREROLL_OPT = -seek_flags preroll
@@ -35,6 +36,19 @@ $(eval $(call FATE_PREROLL_TEST,opus-mpegts,MPEGTS,OPUS,opus/test-8-7.1.opus-sma
 $(eval $(call FATE_PREROLL_TEST,mp3,MP3,MP3FLOAT,gapless/gapless.mp3))
 $(eval $(call FATE_PREROLL_TEST,mp3-itunes,MP3,MP3FLOAT,gapless/gapless-itunes.mp3))

+# Decoded output after a seek, compared with the same span decoded from the
+# start of the stream: only the frames that match it exactly are printed. A
+# decoder that converges to the exact output once its pre-roll is discarded
+# prints every frame from the target on.
+# 1: test name, 2: demuxer, 3: decoder, 4: decoder name, 5: sample
+define FATE_PREROLL_MATCH_TEST
+FATE_PREROLL_FFMPEG-$(call FRAMECRC, $(2), $(3), PCM_S16LE_ENCODER ARESAMPLE_FILTER AMIX_FILTER ASTATS_FILTER AMETADATA_FILTER ATRIM_FILTER ASETPTS_FILTER) += fate-preroll-$(1)-match
+fate-preroll-$(1)-match: CMD = framecrc $(PREROLL_OPT) -ss $(PREROLL_SEEK_TS) -t 0.3 -c:a $(4) -i $(TARGET_SAMPLES)/$(5) -c:a $(4) -i $(TARGET_SAMPLES)/$(5) -filter_complex "[0:a:0]asetpts=PTS-STARTPTS[seek];[1:a:0]atrim=start=$(PREROLL_SEEK_TS):duration=0.3,asetpts=PTS-STARTPTS[full];[seek][full]amix=inputs=2:weights=1|-1:duration=shortest,astats=metadata=1:reset=1:measure_overall=Peak_level:measure_perchannel=none,ametadata=mode=select:key=lavfi.astats.Overall.Peak_level:value=-inf:function=expr:expr=eq(FRAMEVAL\,USERVAL),aresample" -c:a pcm_s16le
+endef
+
+$(eval $(call FATE_PREROLL_MATCH_TEST,mp3,MP3,MP3FLOAT,mp3float,gapless/gapless.mp3))
+$(eval $(call FATE_PREROLL_MATCH_TEST,mp3-itunes,MP3,MP3FLOAT,mp3float,gapless/gapless-itunes.mp3))
+
 # A seek that lands inside the priming, which here spans the first three
 # packets: the rest of the priming, or the pre-roll if longer, is skipped.
 FATE_PREROLL_FFMPEG-$(call FRAMECRC, CAF, AAC, PCM_S16LE_ENCODER ARESAMPLE_FILTER VOLUME_FILTER) += fate-preroll-aac-caf-decode-in-priming
diff --git a/tests/ref/fate/preroll-mp3-itunes-match b/tests/ref/fate/preroll-mp3-itunes-match
new file mode 100644
index 0000000000..93f168f84d
--- /dev/null
+++ b/tests/ref/fate/preroll-mp3-itunes-match
@@ -0,0 +1,15 @@
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout_name 0: stereo
+0,       2066,       2066,     1152,     4608, 0x00000000
+0,       3218,       3218,     1152,     4608, 0x00000000
+0,       4370,       4370,     1152,     4608, 0x00000000
+0,       5522,       5522,     1152,     4608, 0x00000000
+0,       6674,       6674,     1152,     4608, 0x00000000
+0,       7826,       7826,     1152,     4608, 0x00000000
+0,       8978,       8978,     1152,     4608, 0x00000000
+0,      10130,      10130,     1152,     4608, 0x00000000
+0,      11282,      11282,     1152,     4608, 0x00000000
+0,      12434,      12434,      796,     3184, 0x00000000
diff --git a/tests/ref/fate/preroll-mp3-match b/tests/ref/fate/preroll-mp3-match
new file mode 100644
index 0000000000..e347844d6f
--- /dev/null
+++ b/tests/ref/fate/preroll-mp3-match
@@ -0,0 +1,15 @@
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout_name 0: stereo
+0,       2018,       2018,     1152,     4608, 0x00000000
+0,       3170,       3170,     1152,     4608, 0x00000000
+0,       4322,       4322,     1152,     4608, 0x00000000
+0,       5474,       5474,     1152,     4608, 0x00000000
+0,       6626,       6626,     1152,     4608, 0x00000000
+0,       7778,       7778,     1152,     4608, 0x00000000
+0,       8930,       8930,     1152,     4608, 0x00000000
+0,      10082,      10082,     1152,     4608, 0x00000000
+0,      11234,      11234,     1152,     4608, 0x00000000
+0,      12386,      12386,      844,     3376, 0x00000000