player: don't segfault when unloading tracks

e1e714ccc introduced a regression here when unloading a track (e.g. on
VO/AO initilization error), due to no corresponding option existing for
video/audio tracks with orders above 0, but the loop in
`mp_deselect_track` being hard-coded to clear tracks up to NUM_PTRACKS.

Introduce the simplest possible hackaround.
This commit is contained in:
Niklas Haas 2020-04-15 08:00:27 +02:00
parent 7e52e72746
commit ec7f2388af
1 changed files with 2 additions and 0 deletions

View File

@ -591,6 +591,8 @@ static void mark_track_selection(struct MPContext *mpctx, int order,
{
assert(order >= 0 && order < NUM_PTRACKS);
mpctx->opts->stream_id[order][type] = value;
if (type != STREAM_SUB && order != 0)
return; // mconfig only contains one track for vid/aid
m_config_notify_change_opt_ptr(mpctx->mconfig,
&mpctx->opts->stream_id[order][type]);
}