fix(screenshare) Add and then mute the camera track after SS stops instead of not adding the track.

This is a follow up for https://github.com/jitsi/lib-jitsi-meet/pull/1944. This is needed to avoid sending a soure-remove followed by a source-add for the same ssrc. This happens when a users mutes camera->starts SS->stops SS->turns on camera on a p2p connection in Unified plan mode. Chrome fails to render the media if the same SSRC is removed and added back to the same m-line.
This commit is contained in:
Jaya Allamsetty 2022-02-28 22:29:19 -05:00
parent 577d62ea53
commit c30038236a
1 changed files with 16 additions and 19 deletions

View File

@ -1612,7 +1612,6 @@ export default {
APP.store.dispatch(setScreenAudioShareState(false));
if (didHaveVideo && !ignoreDidHaveVideo) {
promise = promise.then(() => createLocalTracksF({ devices: [ 'video' ] }))
.then(([ stream ]) => {
logger.debug(`_turnScreenSharingOff using ${stream} for useVideoStream`);
@ -1628,16 +1627,14 @@ export default {
Promise.reject(error)
);
});
} else {
promise = promise.then(() => {
logger.debug('_turnScreenSharingOff using null for useVideoStream');
return this.useVideoStream(null);
});
}
return promise.then(
() => {
// Mute the video if camera video needs to be ignored or if video was muted before switching to screen
// share.
if (ignoreDidHaveVideo || !didHaveVideo) {
APP.store.dispatch(setVideoMuted(true, MEDIA_TYPE.VIDEO));
}
this.videoSwitchInProgress = false;
sendAnalytics(createScreenSharingEvent('stopped',
duration === 0 ? null : duration));