|
@@ -2560,21 +2560,33 @@ TraceablePeerConnection.prototype.setSenderVideoConstraints = function(frameHeig
|
2560
|
2560
|
if (frameHeight < 0) {
|
2561
|
2561
|
throw new Error(`Invalid frameHeight: ${frameHeight}`);
|
2562
|
2562
|
}
|
|
2563
|
+ if (!localVideoTrack) {
|
|
2564
|
+ throw new Error('Local video track is missing');
|
|
2565
|
+ }
|
2563
|
2566
|
const sourceName = localVideoTrack.getSourceName();
|
2564
|
2567
|
|
2565
|
|
- this._senderMaxHeights.set(sourceName, frameHeight);
|
|
2568
|
+ // Ignore sender constraints if the media on the peerconnection is suspended (jvb conn when p2p is currently active)
|
|
2569
|
+ // or if the video track is muted.
|
|
2570
|
+ if (!this.videoTransferActive || localVideoTrack.isMuted()) {
|
|
2571
|
+ this._senderMaxHeights.set(sourceName, frameHeight);
|
2566
|
2572
|
|
2567
|
|
- // Ignore sender constraints for the following cases -
|
2568
|
|
- // 1. If the media on the peerconnection is suspended (jvb conn when p2p is currently active).
|
2569
|
|
- // 2. If the client is already sending video of the requested resolution.
|
2570
|
|
- if (!this.videoTransferActive || this.tpcUtils.getConfiguredEncodeResolution(localVideoTrack) === frameHeight) {
|
2571
|
2573
|
return Promise.resolve();
|
2572
|
2574
|
}
|
2573
|
2575
|
|
2574
|
|
- if (!localVideoTrack || localVideoTrack.isMuted()) {
|
|
2576
|
+ const configuredResolution = this.tpcUtils.getConfiguredEncodeResolution(localVideoTrack);
|
|
2577
|
+
|
|
2578
|
+ // Ignore sender constraints if the client is already sending video of the requested resolution. Note that for
|
|
2579
|
+ // screensharing sources, the max resolution will be the height of the window being captured irrespective of the
|
|
2580
|
+ // height being requested by the peer.
|
|
2581
|
+ if ((localVideoTrack.getVideoType() === VideoType.CAMERA && configuredResolution === frameHeight)
|
|
2582
|
+ || (localVideoTrack.getVideoType() === VideoType.DESKTOP
|
|
2583
|
+ && frameHeight > 0
|
|
2584
|
+ && configuredResolution === localVideoTrack.getTrack()?.getSettings()?.height)) {
|
2575
|
2585
|
return Promise.resolve();
|
2576
|
2586
|
}
|
2577
|
2587
|
|
|
2588
|
+ this._senderMaxHeights.set(sourceName, frameHeight);
|
|
2589
|
+
|
2578
|
2590
|
return this._updateVideoSenderParameters(this._updateVideoSenderEncodings(frameHeight, localVideoTrack));
|
2579
|
2591
|
};
|
2580
|
2592
|
|