fix(conference.js): prevent presenter track leak
A duct tape fix for presenter track leak for a case when presenter GUM is in progress when screensharing is being turned off.
This commit is contained in:
parent
c8939a133d
commit
f6c94fffc4
|
@ -1425,10 +1425,23 @@ export default {
|
||||||
|
|
||||||
this._stopProxyConnection();
|
this._stopProxyConnection();
|
||||||
|
|
||||||
let promise = null;
|
// It can happen that presenter GUM is in progress while screensharing is being turned off. Here it needs to
|
||||||
|
// wait for that GUM to be resolved in order to prevent leaking the presenter track(this.localPresenterVideo
|
||||||
|
// will be null when SS is being turned off, but it will initialize once GUM resolves).
|
||||||
|
let promise = _prevMutePresenterVideo = _prevMutePresenterVideo.then(() => {
|
||||||
|
// mute the presenter track if it exists.
|
||||||
|
if (this.localPresenterVideo) {
|
||||||
|
APP.store.dispatch(setVideoMuted(true, MEDIA_TYPE.PRESENTER));
|
||||||
|
|
||||||
|
return this.localPresenterVideo.dispose().then(() => {
|
||||||
|
APP.store.dispatch(trackRemoved(this.localPresenterVideo));
|
||||||
|
this.localPresenterVideo = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (didHaveVideo) {
|
if (didHaveVideo) {
|
||||||
promise = createLocalTracksF({ devices: [ 'video' ] })
|
promise = promise.then(() => createLocalTracksF({ devices: [ 'video' ] }))
|
||||||
.then(([ stream ]) => this.useVideoStream(stream))
|
.then(([ stream ]) => this.useVideoStream(stream))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
sendAnalytics(createScreenSharingEvent('stopped'));
|
sendAnalytics(createScreenSharingEvent('stopped'));
|
||||||
|
@ -1444,17 +1457,7 @@ export default {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
promise = this.useVideoStream(null);
|
promise = promise.then(() => this.useVideoStream(null));
|
||||||
}
|
|
||||||
|
|
||||||
// mute the presenter track if it exists.
|
|
||||||
if (this.localPresenterVideo) {
|
|
||||||
APP.store.dispatch(
|
|
||||||
setVideoMuted(true, MEDIA_TYPE.PRESENTER));
|
|
||||||
this.localPresenterVideo.dispose();
|
|
||||||
APP.store.dispatch(
|
|
||||||
trackRemoved(this.localPresenterVideo));
|
|
||||||
this.localPresenterVideo = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return promise.then(
|
return promise.then(
|
||||||
|
@ -2179,6 +2182,7 @@ export default {
|
||||||
|
|
||||||
// dispose the existing presenter track and create a new
|
// dispose the existing presenter track and create a new
|
||||||
// camera track.
|
// camera track.
|
||||||
|
// FIXME JitsiLocalTrack.dispose is async and should be waited for
|
||||||
this.localPresenterVideo && this.localPresenterVideo.dispose();
|
this.localPresenterVideo && this.localPresenterVideo.dispose();
|
||||||
this.localPresenterVideo = null;
|
this.localPresenterVideo = null;
|
||||||
|
|
||||||
|
@ -2199,6 +2203,8 @@ export default {
|
||||||
const { height } = this.localVideo.track.getSettings();
|
const { height } = this.localVideo.track.getSettings();
|
||||||
|
|
||||||
this._updateVideoDeviceId();
|
this._updateVideoDeviceId();
|
||||||
|
|
||||||
|
// FIXME JitsiLocalTrack.dispose is async and should be waited for
|
||||||
this.localPresenterVideo && this.localPresenterVideo.dispose();
|
this.localPresenterVideo && this.localPresenterVideo.dispose();
|
||||||
this.localPresenterVideo = null;
|
this.localPresenterVideo = null;
|
||||||
this._createPresenterStreamEffect(height, cameraDeviceId);
|
this._createPresenterStreamEffect(height, cameraDeviceId);
|
||||||
|
|
Loading…
Reference in New Issue