Skip to content

Commit

Permalink
fix(screenshare) Add and then mute the camera track after SS stops in…
Browse files Browse the repository at this point in the history
…stead of not adding the track.

This is a follow up for jitsi/lib-jitsi-meet#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.
  • Loading branch information
jallamsetty1 committed Mar 1, 2022
1 parent 577d62e commit c300382
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -1612,32 +1612,29 @@ 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`);
promise = promise.then(() => createLocalTracksF({ devices: [ 'video' ] }))
.then(([ stream ]) => {
logger.debug(`_turnScreenSharingOff using ${stream} for useVideoStream`);

return this.useVideoStream(stream);
})
.catch(error => {
logger.error('failed to switch back to local video', error);
return this.useVideoStream(stream);
})
.catch(error => {
logger.error('failed to switch back to local video', error);

return this.useVideoStream(null).then(() =>
return this.useVideoStream(null).then(() =>

// Still fail with the original err
Promise.reject(error)
);
});
} else {
promise = promise.then(() => {
logger.debug('_turnScreenSharingOff using null for useVideoStream');

return this.useVideoStream(null);
// Still fail with the original err
Promise.reject(error)
);
});
}

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));
Expand Down

0 comments on commit c300382

Please sign in to comment.