fix(tracks) fix disposing of local tracks

Don't just clear the storage for them, local tracks must be disposed, in order
for RN capturer to be freed for example.
This commit is contained in:
Saúl Ibarra Corretgé 2021-12-10 11:50:12 +01:00 committed by Saúl Ibarra Corretgé
parent f8908c143e
commit 9279586e8c
1 changed files with 4 additions and 2 deletions

View File

@ -31,6 +31,7 @@ import {
} from './actionTypes';
import {
createLocalTracksA,
destroyLocalTracks,
showNoDataFromSourceVideoError,
toggleScreensharing,
trackRemoved,
@ -217,10 +218,11 @@ StateListenerRegistry.register(
(conference, { dispatch, getState }, prevConference) => {
if (prevConference && !conference) {
// Clear all tracks.
const tracks = getState()['features/base/tracks'];
const remoteTracks = getState()['features/base/tracks'].filter(t => !t.local);
batch(() => {
for (const track of tracks) {
dispatch(destroyLocalTracks());
for (const track of remoteTracks) {
dispatch(trackRemoved(track.jitsiTrack));
}
});