Bladeren bron

fix(conference): Do not signal muted tracks on join.

Do not add the muted audio/video tracks to the peerconnection on join. The tracks will be added when the user unmutes for the first time. This reduces the number of remote sources that will be added when a participant joins a large call where everyone joins muted (startAudioMuted/startVideoMuted setting).
dev1
Jaya Allamsetty 4 jaren geleden
bovenliggende
commit
d31b5a2d5e
1 gewijzigde bestanden met toevoegingen van 16 en 7 verwijderingen
  1. 16
    7
      JitsiConference.js

+ 16
- 7
JitsiConference.js Bestand weergeven

@@ -1045,6 +1045,19 @@ JitsiConference.prototype._fireMuteChangeEvent = function(track) {
1045 1045
     this.eventEmitter.emit(JitsiConferenceEvents.TRACK_MUTE_CHANGED, track, actorParticipant);
1046 1046
 };
1047 1047
 
1048
+/**
1049
+ * Returns the list of local tracks that need to be added to the peerconnection on join.
1050
+ * This takes the startAudioMuted/startVideoMuted flags into consideration since we do not
1051
+ * want to add the tracks if the user joins the call audio/video muted. The tracks will be
1052
+ * added when the user unmutes for the first time.
1053
+ * @returns {Array<JitsiLocalTrack>} - list of local tracks that are unmuted.
1054
+ */
1055
+JitsiConference.prototype._getInitialLocalTracks = function() {
1056
+    return this.getLocalTracks()
1057
+        .filter(track => (track.getType() === MediaType.AUDIO && !this.isStartAudioMuted())
1058
+        || (track.getType() === MediaType.VIDEO && !this.isStartVideoMuted()));
1059
+};
1060
+
1048 1061
 /**
1049 1062
  * Clear JitsiLocalTrack properties and listeners.
1050 1063
  * @param track the JitsiLocalTrack object.
@@ -1983,8 +1996,7 @@ JitsiConference.prototype._acceptJvbIncomingCall = function(
1983 1996
     // Open a channel with the videobridge.
1984 1997
     this._setBridgeChannel(jingleOffer, jingleSession.peerconnection);
1985 1998
 
1986
-    // Add local tracks to the session
1987
-    const localTracks = this.getLocalTracks();
1999
+    const localTracks = this._getInitialLocalTracks();
1988 2000
 
1989 2001
     try {
1990 2002
         jingleSession.acceptOffer(
@@ -2742,7 +2754,7 @@ JitsiConference.prototype._acceptP2PIncomingCall = function(
2742 2754
         this.p2pJingleSession.peerconnection,
2743 2755
         remoteID);
2744 2756
 
2745
-    const localTracks = this.getLocalTracks();
2757
+    const localTracks = this._getInitialLocalTracks();
2746 2758
 
2747 2759
     this.p2pJingleSession.acceptOffer(
2748 2760
         jingleOffer,
@@ -3102,10 +3114,7 @@ JitsiConference.prototype._startP2PSession = function(remoteJid) {
3102 3114
         this.p2pJingleSession.peerconnection,
3103 3115
         remoteID);
3104 3116
 
3105
-    // NOTE one may consider to start P2P with the local tracks detached,
3106
-    // but no data will be sent until ICE succeeds anyway. And we switch
3107
-    // immediately once the P2P ICE connects.
3108
-    const localTracks = this.getLocalTracks();
3117
+    const localTracks = this._getInitialLocalTracks();
3109 3118
 
3110 3119
     this.p2pJingleSession.invite(localTracks);
3111 3120
 };

Laden…
Annuleren
Opslaan