|
@@ -2359,16 +2359,20 @@ TraceablePeerConnection.prototype._initializeDtlsTransport = function() {
|
2359
|
2359
|
* Sets the max bitrates on the video m-lines when VP9 is the selected codec.
|
2360
|
2360
|
*
|
2361
|
2361
|
* @param {RTCSessionDescription} description - The local description that needs to be munged.
|
|
2362
|
+ * @param {boolean} isLocalSdp - Whether the max bitrate (via b=AS line in SDP) is set on local SDP.
|
2362
|
2363
|
* @returns RTCSessionDescription
|
2363
|
2364
|
*/
|
2364
|
|
-TraceablePeerConnection.prototype._setVp9MaxBitrates = function(description) {
|
|
2365
|
+TraceablePeerConnection.prototype._setVp9MaxBitrates = function(description, isLocalSdp = false) {
|
2365
|
2366
|
if (!this.codecPreference) {
|
2366
|
2367
|
return description;
|
2367
|
2368
|
}
|
2368
|
2369
|
|
2369
|
2370
|
const parsedSdp = transform.parse(description.sdp);
|
|
2371
|
+
|
|
2372
|
+ // Find all the m-lines associated with the local sources.
|
|
2373
|
+ const direction = isLocalSdp ? MediaDirection.RECVONLY : MediaDirection.SENDONLY;
|
2370
|
2374
|
const mLines = FeatureFlags.isMultiStreamSupportEnabled()
|
2371
|
|
- ? parsedSdp.media.filter(m => m.type === MediaType.VIDEO && m.direction !== MediaDirection.RECVONLY)
|
|
2375
|
+ ? parsedSdp.media.filter(m => m.type === MediaType.VIDEO && m.direction !== direction)
|
2372
|
2376
|
: [ parsedSdp.media.find(m => m.type === MediaType.VIDEO) ];
|
2373
|
2377
|
|
2374
|
2378
|
// Find the mid associated with the desktop track so that bitrates can be configured accordingly on the
|
|
@@ -2393,8 +2397,7 @@ TraceablePeerConnection.prototype._setVp9MaxBitrates = function(description) {
|
2393
|
2397
|
};
|
2394
|
2398
|
|
2395
|
2399
|
for (const mLine of mLines) {
|
2396
|
|
- if (this.codecPreference.mimeType === CodecMimeType.VP9
|
2397
|
|
- && this.getConfiguredVideoCodec() === CodecMimeType.VP9) {
|
|
2400
|
+ if (this.codecPreference.mimeType === CodecMimeType.VP9) {
|
2398
|
2401
|
const bitrates = this.tpcUtils.videoBitrates.VP9 || this.tpcUtils.videoBitrates;
|
2399
|
2402
|
const hdBitrate = bitrates.high ? bitrates.high : HD_BITRATE;
|
2400
|
2403
|
const mid = mLine.mid;
|
|
@@ -2470,7 +2473,7 @@ TraceablePeerConnection.prototype.setLocalDescription = function(description) {
|
2470
|
2473
|
|
2471
|
2474
|
// Munge the order of the codecs based on the preferences set through config.js.
|
2472
|
2475
|
localDescription = this._mungeCodecOrder(localDescription);
|
2473
|
|
- localDescription = this._setVp9MaxBitrates(localDescription);
|
|
2476
|
+ localDescription = this._setVp9MaxBitrates(localDescription, true);
|
2474
|
2477
|
|
2475
|
2478
|
this.trace('setLocalDescription::postTransform', dumpSDP(localDescription));
|
2476
|
2479
|
|
|
@@ -2564,6 +2567,7 @@ TraceablePeerConnection.prototype.setRemoteDescription = function(description) {
|
2564
|
2567
|
|
2565
|
2568
|
// Munge the order of the codecs based on the preferences set through config.js.
|
2566
|
2569
|
remoteDescription = this._mungeCodecOrder(remoteDescription);
|
|
2570
|
+ remoteDescription = this._setVp9MaxBitrates(remoteDescription);
|
2567
|
2571
|
this.trace('setRemoteDescription::postTransform (munge codec order)', dumpSDP(remoteDescription));
|
2568
|
2572
|
|
2569
|
2573
|
return new Promise((resolve, reject) => {
|