From b09e48e38898089997daee814e4b68386f11a97c Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Thu, 27 Jun 2024 22:11:41 -0400 Subject: [PATCH] player/loadfile: enable streams in order of types when loading file The previous commit to avoid refresh seeking video streams has an edge case when enabling tracks when loading files. Since the streams are initially unselected and then multiple streams are enabled, the detection only works reliably when video tracks are enabled first. This makes sure that loading file enables tracks in a predictable order. --- player/loadfile.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/player/loadfile.c b/player/loadfile.c index efdca3e17f..4aebc44916 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1724,8 +1724,10 @@ static void play_current_file(struct MPContext *mpctx) } } - for (int n = 0; n < mpctx->num_tracks; n++) - reselect_demux_stream(mpctx, mpctx->tracks[n], false); + for (int t = 0; t < STREAM_TYPE_COUNT; t++) + for (int n = 0; n < mpctx->num_tracks; n++) + if (mpctx->tracks[n]->type == t) + reselect_demux_stream(mpctx, mpctx->tracks[n], false); update_demuxer_properties(mpctx);