Browse Source

fix(TPC) Do not force immediate O/A cycles after track replace operations.

In Unified-plan mode, we rely on the browser to fire 'negotiationneeded' event to start a O/A cycle. Also add muted tracks to PC. Fixes issues where the streams are not being signaled when call switches over from p2p to jvb in multi-stream mode.
dev1
Jaya Allamsetty 2 years ago
parent
commit
9b2eef3d62
1 changed files with 2 additions and 23 deletions
  1. 2
    23
      modules/RTC/TraceablePeerConnection.js

+ 2
- 23
modules/RTC/TraceablePeerConnection.js View File

@@ -2016,31 +2016,11 @@ TraceablePeerConnection.prototype.replaceTrack = function(oldTrack, newTrack) {
2016 2016
         return Promise.resolve();
2017 2017
     }
2018 2018
 
2019
-    // If a track is being added to the peerconnection for the first time, we want the source signaling to be sent to
2020
-    // Jicofo before the mute state is sent over presence. Therefore, trigger a renegotiation in this case. If we
2021
-    // rely on "negotiationneeded" fired by the browser to signal new ssrcs, the mute state in presence will be sent
2022
-    // before the source signaling which is undesirable.
2023
-    // Send the presence before signaling for a new screenshare source. This is needed for multi-stream support since
2024
-    // videoType needs to be availble at remote track creation time so that a fake tile for screenshare can be added.
2025
-    // FIXME - This check needs to be removed when the client switches to the bridge based signaling for tracks.
2026
-    const isNewTrackScreenshare = !oldTrack
2027
-        && newTrack?.getVideoType() === VideoType.DESKTOP
2028
-        && FeatureFlags.isMultiStreamSupportEnabled()
2029
-        && !this.isP2P; // negotiationneeded is not fired on p2p peerconnection
2030
-    const negotiationNeeded = !isNewTrackScreenshare && Boolean(!oldTrack || !this.localTracks.has(oldTrack?.rtcId));
2031
-
2032 2019
     if (this._usesUnifiedPlan) {
2033 2020
         logger.debug(`${this} TPC.replaceTrack using unified plan`);
2034 2021
         const mediaType = newTrack?.getType() ?? oldTrack?.getType();
2035
-        const stream = newTrack?.getOriginalStream();
2036
-        const promise = newTrack && !stream
2037
-
2038
-            // Ignore cases when the track is replaced while the device is in a muted state.
2039
-            // The track will be replaced again on the peerconnection when the user unmutes.
2040
-            ? Promise.resolve()
2041
-            : this.tpcUtils.replaceTrack(oldTrack, newTrack);
2042 2022
 
2043
-        return promise
2023
+        return this.tpcUtils.replaceTrack(oldTrack, newTrack)
2044 2024
             .then(transceiver => {
2045 2025
                 if (oldTrack) {
2046 2026
                     this.localTracks.delete(oldTrack.rtcId);
@@ -2100,8 +2080,7 @@ TraceablePeerConnection.prototype.replaceTrack = function(oldTrack, newTrack) {
2100 2080
                     ? Promise.resolve()
2101 2081
                     : this.tpcUtils.setEncodings(newTrack);
2102 2082
 
2103
-                // Force renegotiation only when the source is added for the first time.
2104
-                return configureEncodingsPromise.then(() => negotiationNeeded);
2083
+                return configureEncodingsPromise.then(() => false);
2105 2084
             });
2106 2085
     }
2107 2086
 

Loading…
Cancel
Save