mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
fe1de116f3
commit
6179995dd7
|
@ -505,7 +505,6 @@ static bool compare_track(struct track *t1, struct track *t2, char **langs, bool
|
||||||
return t1->program_id == preferred_program;
|
return t1->program_id == preferred_program;
|
||||||
}
|
}
|
||||||
int l1 = match_lang(langs, t1->lang), l2 = match_lang(langs, t2->lang);
|
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)
|
if (!os_langs && l1 != l2)
|
||||||
return l1 > l2;
|
return l1 > l2;
|
||||||
if (forced)
|
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 && compare_track(track, pick, langs, os_langs, forced, mpctx->opts, preferred_program))))
|
||||||
{
|
{
|
||||||
pick = track;
|
pick = track;
|
||||||
|
pick->forced_select = forced;
|
||||||
}
|
}
|
||||||
} else if (!pick || compare_track(track, pick, langs, os_langs, false, mpctx->opts, preferred_program)) {
|
} else if (!pick || compare_track(track, pick, langs, os_langs, false, mpctx->opts, preferred_program)) {
|
||||||
pick = track;
|
pick = track;
|
||||||
|
|
Loading…
Reference in New Issue