summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2020-04-15 08:00:27 +0200
committerNiklas Haas <git@haasn.xyz>2020-04-15 08:02:28 +0200
commitec7f2388af2df27bf0f7e1801b39729f9755baed (patch)
tree4f5ef8db8fc0139b6ccbd7e305d7b7f4f1d1c324
parent7e52e727461f943a78fcc97e9b70d917930f07c4 (diff)
downloadmpv-ec7f2388af2df27bf0f7e1801b39729f9755baed.tar.bz2
mpv-ec7f2388af2df27bf0f7e1801b39729f9755baed.tar.xz
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.
-rw-r--r--player/loadfile.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index d09addeb89..5972c634be 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -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]);
}