Commit 8fec7531d7 for ffmpeg
commit 8fec7531d7cfd727ceca38c76578c5ca2f0f84f4
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Mon Nov 9 20:17:56 2026 +0000
avformat/dss: let lavf infer the first presentation timestamp
A recording can start with a swapped SP frame whose preceding byte is unavailable. The reader drops that frame and returns the next one at PTS 264, so setting start_time to zero contradicts the packet timestamps. Leave the start time unset for lavf to infer it.
Cover the existing format-1 sample that starts at such a swapped frame, checking both the first packet timestamp and the reported interval.
Assisted-by: Fairy
diff --git a/libavformat/dss.c b/libavformat/dss.c
index bc144feeac..73290ebf90 100644
--- a/libavformat/dss.c
+++ b/libavformat/dss.c
@@ -222,7 +222,6 @@ static int dss_read_header(AVFormatContext *s)
st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
- st->start_time = 0;
frames = dss_count_frames(s);
if (frames < 0)
diff --git a/tests/fate/audio.mak b/tests/fate/audio.mak
index 071fcd7557..76333e3023 100644
--- a/tests/fate/audio.mak
+++ b/tests/fate/audio.mak
@@ -37,6 +37,9 @@ fate-dss-format1: CMD = framecrc -i $(TARGET_SAMPLES)/dss/olympus-format1.dss
FATE_SAMPLES_AUDIO_FFPROBE-$(CONFIG_DSS_DEMUXER) += fate-dss-format1-duration
fate-dss-format1-duration: CMD = probe -show_entries stream=duration,nb_frames $(TARGET_SAMPLES)/dss/olympus-format1.dss
+FATE_SAMPLES_AUDIO_FFPROBE-$(CONFIG_DSS_DEMUXER) += fate-dss-format1-start-time
+fate-dss-format1-start-time: CMD = probe -read_intervals %+\#1 -show_packets -show_entries stream=start_time,duration,nb_frames:packet=pts $(TARGET_SAMPLES)/dss/olympus-format1-noswap.dss
+
FATE_SAMPLES_AUDIO-$(call FRAMECRC, DSS, G723_1, ARESAMPLE_FILTER) += fate-dss-lp
fate-dss-lp: CMD = framecrc -i $(TARGET_SAMPLES)/dss/lp.dss -frames 30 -af aresample
diff --git a/tests/ref/fate/dss-format1-start-time b/tests/ref/fate/dss-format1-start-time
new file mode 100644
index 0000000000..0aae51a087
--- /dev/null
+++ b/tests/ref/fate/dss-format1-start-time
@@ -0,0 +1,8 @@
+[PACKET]
+pts=264
+[/PACKET]
+[STREAM]
+start_time=0.024000
+duration=0.408000
+nb_frames=17
+[/STREAM]