Parcourir la source

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 il y a 4 ans
Parent
révision
d31b5a2d5e
1 fichiers modifiés avec 16 ajouts et 7 suppressions
  1. 16
    7
      JitsiConference.js

+ 16
- 7
JitsiConference.js Voir le fichier

1045
     this.eventEmitter.emit(JitsiConferenceEvents.TRACK_MUTE_CHANGED, track, actorParticipant);
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
  * Clear JitsiLocalTrack properties and listeners.
1062
  * Clear JitsiLocalTrack properties and listeners.
1050
  * @param track the JitsiLocalTrack object.
1063
  * @param track the JitsiLocalTrack object.
1983
     // Open a channel with the videobridge.
1996
     // Open a channel with the videobridge.
1984
     this._setBridgeChannel(jingleOffer, jingleSession.peerconnection);
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
     try {
2001
     try {
1990
         jingleSession.acceptOffer(
2002
         jingleSession.acceptOffer(
2742
         this.p2pJingleSession.peerconnection,
2754
         this.p2pJingleSession.peerconnection,
2743
         remoteID);
2755
         remoteID);
2744
 
2756
 
2745
-    const localTracks = this.getLocalTracks();
2757
+    const localTracks = this._getInitialLocalTracks();
2746
 
2758
 
2747
     this.p2pJingleSession.acceptOffer(
2759
     this.p2pJingleSession.acceptOffer(
2748
         jingleOffer,
2760
         jingleOffer,
3102
         this.p2pJingleSession.peerconnection,
3114
         this.p2pJingleSession.peerconnection,
3103
         remoteID);
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
     this.p2pJingleSession.invite(localTracks);
3119
     this.p2pJingleSession.invite(localTracks);
3111
 };
3120
 };

Chargement…
Annuler
Enregistrer