Selaa lähdekoodia

fix(TPC) Update the local SSRC cache when a track is replace with another.

Fixes an issue where the local stats are not emitted in Unified plan after a track replace.
tags/v0.0.2
Jaya Allamsetty 3 vuotta sitten
vanhempi
commit
4a722ddbbc
1 muutettua tiedostoa jossa 11 lisäystä ja 0 poistoa
  1. 11
    0
      modules/RTC/TraceablePeerConnection.js

+ 11
- 0
modules/RTC/TraceablePeerConnection.js Näytä tiedosto

@@ -1961,6 +1961,17 @@ TraceablePeerConnection.prototype.replaceTrack = function(oldTrack, newTrack) {
1961 1961
             .then(transceiver => {
1962 1962
                 oldTrack && this.localTracks.delete(oldTrack.rtcId);
1963 1963
                 newTrack && this.localTracks.set(newTrack.rtcId, newTrack);
1964
+
1965
+                // Update the local SSRC cache for the case when one track gets replaced with another and no
1966
+                // renegotiation is triggered as a result of this.
1967
+                if (oldTrack && newTrack) {
1968
+                    const oldTrackSSRC = this.localSSRCs.get(oldTrack.rtcId);
1969
+
1970
+                    if (oldTrackSSRC) {
1971
+                        this.localSSRCs.delete(oldTrack.rtcId);
1972
+                        this.localSSRCs.set(newTrack.rtcId, oldTrackSSRC);
1973
+                    }
1974
+                }
1964 1975
                 const mediaActive = mediaType === MediaType.AUDIO
1965 1976
                     ? this.audioTransferActive
1966 1977
                     : this.videoTransferActive;

Loading…
Peruuta
Tallenna