浏览代码

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 个月前
父节点
当前提交
250ff7ed9b
共有 1 个文件被更改,包括 2 次插入6 次删除
  1. 2
    6
      modules/RTC/TraceablePeerConnection.js

+ 2
- 6
modules/RTC/TraceablePeerConnection.js 查看文件

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

正在加载...
取消
保存