summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/loadfile.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index 33f27d6b14..c0888466e8 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -653,8 +653,16 @@ bool mp_remove_track(struct MPContext *mpctx, struct track *track)
for (int n = mpctx->num_tracks - 1; n >= 0 && !in_use; n--)
in_use |= mpctx->tracks[n]->demuxer == d;
- if (!in_use)
+ if (!in_use) {
+ for (int n = 0; n < mpctx->num_sources; n++) {
+ if (mpctx->sources[n] == d) {
+ MP_TARRAY_REMOVE_AT(mpctx->sources, mpctx->num_sources, n);
+ break;
+ }
+ }
+ uninit_stream_sub_decoders(d);
free_demuxer_and_stream(d);
+ }
mp_notify(mpctx, MPV_EVENT_TRACKS_CHANGED, NULL);