Browse Source

fix(presence) Send a presence update on every track replace operation.

Removing and adding a track back to the conference doesn't generate new source signaling all the time so presence needs to be updated every single time.
Fixes https://community.jitsi.org/t/screen-share-doesnt-work-a-second-time-on-p2p/114024 and possibly https://github.com/jitsi/lib-jitsi-meet/issues/1997.
dev1
Jaya Allamsetty 3 years ago
parent
commit
ccf9ebedcd
1 changed files with 6 additions and 8 deletions
  1. 6
    8
      JitsiConference.js

+ 6
- 8
JitsiConference.js View File

@@ -1293,11 +1293,9 @@ JitsiConference.prototype.replaceTrack = function(oldTrack, newTrack) {
1293 1293
                 this._sendBridgeVideoTypeMessage(newTrack);
1294 1294
             }
1295 1295
 
1296
-            // updates presence when we replace the video tracks desktop with screen and screen with desktop
1297
-            if (oldTrackBelongsToConference && oldTrack?.isVideoTrack()
1298
-
1299
-                // we do not want to send presence update during setEffect switching, which does remove and then add
1300
-                && !(oldTrack?._setEffectInProgress || newTrack?._setEffectInProgress)) {
1296
+            // We do not want to send presence update during setEffect switching, which removes and then adds the same
1297
+            // track back to the conference.
1298
+            if (!(oldTrack?._setEffectInProgress || newTrack?._setEffectInProgress)) {
1301 1299
                 this._updateRoomPresence(this.getActiveMediaSession());
1302 1300
             }
1303 1301
 
@@ -3649,9 +3647,9 @@ JitsiConference.prototype._updateRoomPresence = function(jingleSession, ctx) {
3649 3647
 
3650 3648
     let presenceChanged = false;
3651 3649
     let muteStatusChanged, videoTypeChanged;
3652
-    const localTracks = this.getLocalTracks();
3653
-    const localAudioTracks = jingleSession.peerconnection.getLocalTracks(MediaType.AUDIO);
3654
-    const localVideoTracks = jingleSession.peerconnection.getLocalTracks(MediaType.VIDEO);
3650
+    const localTracks = jingleSession.peerconnection.getLocalTracks();
3651
+    const localAudioTracks = localTracks.filter(track => track.getType() === MediaType.AUDIO);
3652
+    const localVideoTracks = localTracks.filter(track => track.getType() === MediaType.VIDEO);
3655 3653
 
3656 3654
     // Set presence for all the available local tracks.
3657 3655
     for (const track of localTracks) {

Loading…
Cancel
Save