Commit 5b4bc11649 for ffmpeg
commit 5b4bc11649d334dfb49ed6f39602333b30629307
Author: Kacper Michajłow <kasper93@gmail.com>
Date: Fri Dec 4 18:42:48 2026 +0100
avformat/dashdec: seek the representation of the stream first
dash_read_seek() stopped at the first representation that failed, in the
order of the manifest. A representation that is shorter than the others
failed a seek past its end for all of them, with those before it moved
and those after it not. Let the representation of the stream decide
whether the seek works, as the mov demuxer does for its streams, and
seek the others only then. One of them that has no data at the position
has ended until the next seek.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 0f34ee5989..9df026f21d 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -2725,7 +2725,7 @@ set_seq_num:
static int dash_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
{
- int ret = 0, i;
+ int ret, i;
DASHContext *c = s->priv_data;
AVRational tb = s->streams[stream_index]->time_base;
int64_t seek_pos = rescale_pos(timestamp, tb.num * (int64_t)AV_TIME_BASE, tb.den,
@@ -2739,18 +2739,11 @@ static int dash_read_seek(AVFormatContext *s, int stream_index, int64_t timestam
break;
seek_pos = av_sat_sub64(seek_pos, presentation_timeoffset_us(rep));
- for (i = 0; i < c->n_videos; i++) {
- if (!ret)
- ret = dash_seek(s, c->videos[i], seek_pos, flags);
- }
- for (i = 0; i < c->n_audios; i++) {
- if (!ret)
- ret = dash_seek(s, c->audios[i], seek_pos, flags);
- }
- for (i = 0; i < c->n_subtitles; i++) {
- if (!ret)
- ret = dash_seek(s, c->subtitles[i], seek_pos, flags);
- }
+ ret = dash_seek(s, rep, seek_pos, flags);
+ struct representation *other;
+ for (i = 0; !ret && (other = get_representation(c, i)); i++)
+ if (other != rep)
+ dash_seek(s, other, seek_pos, flags);
if (!ret) {
c->resume_timestamp = seek_pos;