Browse Source

fix(video-quality) Fixes an issue where outbound resolution can be stuck at wrong resolution.

The calls to RTCRtpSender.setParameters() are all chained and the current maxHeight is set after the call to setParameters is resolved. If there is another call made to setParameters before the previous one resolves, we can end up passing the wrong maxHeight resulting in the client getting stuck at an unexpected resolution. This issue can be reproduced sometimes  when the users are moving across the main and breakout rooms. TPC.setVideoCodecs() ends up pushing a wrong maxHeight for update when the previous call to setParameters hasn't resolved yet.
release-8443
Jaya Allamsetty 9 months ago
parent
commit
250ff7ed9b
1 changed files with 2 additions and 6 deletions
  1. 2
    6
      modules/RTC/TraceablePeerConnection.js

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

2057
     }
2057
     }
2058
     const sourceName = localVideoTrack.getSourceName();
2058
     const sourceName = localVideoTrack.getSourceName();
2059
 
2059
 
2060
+    this._senderMaxHeights.set(sourceName, frameHeight);
2061
+
2060
     // Ignore sender constraints if the video track is muted.
2062
     // Ignore sender constraints if the video track is muted.
2061
     if (localVideoTrack.isMuted()) {
2063
     if (localVideoTrack.isMuted()) {
2062
-        this._senderMaxHeights.set(sourceName, frameHeight);
2063
-
2064
         return Promise.resolve();
2064
         return Promise.resolve();
2065
     }
2065
     }
2066
 
2066
 
2125
     let bitrates = this.tpcUtils.calculateEncodingsBitrates(localVideoTrack, codec, frameHeight);
2125
     let bitrates = this.tpcUtils.calculateEncodingsBitrates(localVideoTrack, codec, frameHeight);
2126
     const scalabilityModes = this.tpcUtils.calculateEncodingsScalabilityMode(localVideoTrack, codec, frameHeight);
2126
     const scalabilityModes = this.tpcUtils.calculateEncodingsScalabilityMode(localVideoTrack, codec, frameHeight);
2127
     let scaleFactors = this.tpcUtils.calculateEncodingsScaleFactor(localVideoTrack, codec, frameHeight);
2127
     let scaleFactors = this.tpcUtils.calculateEncodingsScaleFactor(localVideoTrack, codec, frameHeight);
2128
-    const sourceName = localVideoTrack.getSourceName();
2129
     let needsUpdate = false;
2128
     let needsUpdate = false;
2130
 
2129
 
2131
     // Do not configure 'scaleResolutionDownBy' and 'maxBitrate' for encoders running in VP9 legacy K-SVC mode since
2130
     // Do not configure 'scaleResolutionDownBy' and 'maxBitrate' for encoders running in VP9 legacy K-SVC mode since
2197
     }
2196
     }
2198
 
2197
 
2199
     if (!needsUpdate) {
2198
     if (!needsUpdate) {
2200
-        this._senderMaxHeights.set(sourceName, frameHeight);
2201
-
2202
         return Promise.resolve();
2199
         return Promise.resolve();
2203
     }
2200
     }
2204
 
2201
 
2205
     logger.info(`${this} setting max height=${frameHeight},encodings=${JSON.stringify(parameters.encodings)}`);
2202
     logger.info(`${this} setting max height=${frameHeight},encodings=${JSON.stringify(parameters.encodings)}`);
2206
 
2203
 
2207
     return videoSender.setParameters(parameters).then(() => {
2204
     return videoSender.setParameters(parameters).then(() => {
2208
-        this._senderMaxHeights.set(sourceName, frameHeight);
2209
         localVideoTrack.maxEnabledResolution = frameHeight;
2205
         localVideoTrack.maxEnabledResolution = frameHeight;
2210
         this.eventEmitter.emit(RTCEvents.LOCAL_TRACK_MAX_ENABLED_RESOLUTION_CHANGED, localVideoTrack);
2206
         this.eventEmitter.emit(RTCEvents.LOCAL_TRACK_MAX_ENABLED_RESOLUTION_CHANGED, localVideoTrack);
2211
     });
2207
     });

Loading…
Cancel
Save