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:
1 parent
8c6680a868
commit
263bea5261
1 file changed
+3
-3
+3
-3
@@ -913,13 +913,13 @@ static void update_stream_selection_state(struct demux_internal *in,
|
|||||||
any_streams |= s->selected;
|
any_streams |= s->selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subtitles are only eagerly read if there are no other eagerly read
|
// Subtitles and sparse still-image video are only eagerly read if there are
|
||||||
// streams.
|
// no other eagerly read streams.
|
||||||
if (any_av_streams) {
|
if (any_av_streams) {
|
||||||
for (int n = 0; n < in->num_streams; n++) {
|
for (int n = 0; n < in->num_streams; n++) {
|
||||||
struct demux_stream *s = in->streams[n]->ds;
|
struct demux_stream *s = in->streams[n]->ds;
|
||||||
|
|
||||||
if (s->type == STREAM_SUB)
|
if (s->type == STREAM_SUB || s->still_image)
|
||||||
s->eager = false;
|
s->eager = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user