demux: read sparse still-image streams lazily

still_image streams (AV_DISPOSITION_STILL_IMAGE) consist of sparse
frames that can be minutes apart. When such a stream was selected
alongside an eager audio/video stream, its empty packet queue forced
the demuxer to keep reading ahead, buffering the whole file trying to
chase min_secs of "video". Read them lazily when other eager streams
exist, so playback drives read-ahead instead.
This commit is contained in:
Kacper Michajłow committed 2026-08-26 01:47:41 +02:00
1 parent 8c6680a868
commit 263bea5261
1 file changed
+3 -3
+3 -3
View File
@@ -913,13 +913,13 @@ static void update_stream_selection_state(struct demux_internal *in,
any_streams |= s->selected;
}
// Subtitles are only eagerly read if there are no other eagerly read
// streams.
// Subtitles and sparse still-image video are only eagerly read if there are
// no other eagerly read streams.
if (any_av_streams) {
for (int n = 0; n < in->num_streams; n++) {
struct demux_stream *s = in->streams[n]->ds;
if (s->type == STREAM_SUB)
if (s->type == STREAM_SUB || s->still_image)
s->eager = false;
}
}