From 6179995dd7ef576073e184abd01fd34890e1b59f Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Tue, 2 Apr 2024 11:00:28 -0500 Subject: player/loadfile: set track->forced_select outside of compare_track This field is used by compare_track when determining if the next track should be preferred. The only problem is that we were only setting this in compare_track which isn't used for the very first subtitle track selection. So if the first subtitle track was a forced track that was selected, this wasn't marked and the next subtitle track could mistakenly be detected as preferred. Fix this by setting the field after we set pick equal to the track in select_default track. Fixes #13804. --- player/loadfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'player') diff --git a/player/loadfile.c b/player/loadfile.c index b8ccf6723e..44ca805913 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -505,7 +505,6 @@ static bool compare_track(struct track *t1, struct track *t2, char **langs, bool return t1->program_id == preferred_program; } int l1 = match_lang(langs, t1->lang), l2 = match_lang(langs, t2->lang); - t1->forced_select = sub && forced && t1->forced_track; if (!os_langs && l1 != l2) return l1 > l2; if (forced) @@ -656,6 +655,7 @@ struct track *select_default_track(struct MPContext *mpctx, int order, (pick && compare_track(track, pick, langs, os_langs, forced, mpctx->opts, preferred_program)))) { pick = track; + pick->forced_select = forced; } } else if (!pick || compare_track(track, pick, langs, os_langs, false, mpctx->opts, preferred_program)) { pick = track; -- cgit v1.2.3