From 263bea5261f15b712879de5112ec0bc1408167de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Mon, 6 Jul 2026 01:51:23 +0200 Subject: [PATCH] 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. --- demux/demux.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/demux/demux.c b/demux/demux.c index 2e0eb0d2c4..5d93b1d892 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -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; } }