|
@@ -1493,6 +1493,18 @@ TraceablePeerConnection.prototype._getSSRC = function(rtcId) {
|
1493
|
1493
|
return this.localSSRCs.get(rtcId);
|
1494
|
1494
|
};
|
1495
|
1495
|
|
|
1496
|
+/**
|
|
1497
|
+ * Checks if screensharing is in progress.
|
|
1498
|
+ *
|
|
1499
|
+ * @returns {boolean} Returns true if a desktop track has been added to the
|
|
1500
|
+ * peerconnection, false otherwise.
|
|
1501
|
+ */
|
|
1502
|
+TraceablePeerConnection.prototype._isSharingScreen = function() {
|
|
1503
|
+ const track = this.getLocalVideoTrack();
|
|
1504
|
+
|
|
1505
|
+ return track && track.videoType === VideoType.DESKTOP;
|
|
1506
|
+};
|
|
1507
|
+
|
1496
|
1508
|
/**
|
1497
|
1509
|
* Munges the order of the codecs in the SDP passed based on the preference
|
1498
|
1510
|
* set through config.js settings. All instances of the specified codec are
|
|
@@ -1526,14 +1538,12 @@ TraceablePeerConnection.prototype._mungeCodecOrder = function(description) {
|
1526
|
1538
|
// as soon as the browser switches to VP9.
|
1527
|
1539
|
if (this.codecPreference.mimeType === CodecMimeType.VP9) {
|
1528
|
1540
|
const bitrates = Object.values(this.videoBitrates.VP9 || this.videoBitrates);
|
1529
|
|
- const localVideoTrack = this.getLocalVideoTrack();
|
1530
|
|
- const isSharingScreen = localVideoTrack && localVideoTrack.videoType === VideoType.DESKTOP;
|
1531
|
1541
|
|
1532
|
1542
|
// Use only the HD bitrate for now as there is no API available yet for configuring
|
1533
|
1543
|
// the bitrates on the individual SVC layers.
|
1534
|
1544
|
mLine.bandwidth = [ {
|
1535
|
1545
|
type: 'AS',
|
1536
|
|
- limit: isSharingScreen ? HD_BITRATE : Math.floor(bitrates[2] / 1000)
|
|
1546
|
+ limit: this._isSharingScreen() ? HD_BITRATE : Math.floor(bitrates[2] / 1000)
|
1537
|
1547
|
} ];
|
1538
|
1548
|
}
|
1539
|
1549
|
} else {
|
|
@@ -2182,7 +2192,7 @@ TraceablePeerConnection.prototype.setMaxBitRate = function() {
|
2182
|
2192
|
// FIXME the top 'isSimulcastOn' condition is confusing for screensharing, because
|
2183
|
2193
|
// if capScreenshareBitrate option is enabled then the simulcast is turned off
|
2184
|
2194
|
bitrate = this.options.capScreenshareBitrate
|
2185
|
|
- ? presenterEnabled ? this.videoBitrates.high : DESKTOP_SHARE_RATE
|
|
2195
|
+ ? presenterEnabled ? HD_BITRATE : DESKTOP_SHARE_RATE
|
2186
|
2196
|
|
2187
|
2197
|
// Remove the bitrate config if not capScreenshareBitrate:
|
2188
|
2198
|
// When switching from camera to desktop and videoQuality.maxBitratesVideo were set,
|
|
@@ -2549,17 +2559,6 @@ TraceablePeerConnection.prototype.createOffer = function(constraints) {
|
2549
|
2559
|
return this._createOfferOrAnswer(true /* offer */, constraints);
|
2550
|
2560
|
};
|
2551
|
2561
|
|
2552
|
|
-/**
|
2553
|
|
- * Checks if a camera track has been added to the peerconnection
|
2554
|
|
- * @param {TraceablePeerConnection} peerConnection
|
2555
|
|
- * @return {boolean} <tt>true</tt> if the peerconnection has
|
2556
|
|
- * a camera track for its video source <tt>false</tt> otherwise.
|
2557
|
|
- */
|
2558
|
|
-function hasCameraTrack(peerConnection) {
|
2559
|
|
- return peerConnection.getLocalTracks()
|
2560
|
|
- .some(t => t.videoType === 'camera');
|
2561
|
|
-}
|
2562
|
|
-
|
2563
|
2562
|
TraceablePeerConnection.prototype._createOfferOrAnswer = function(
|
2564
|
2563
|
isOffer,
|
2565
|
2564
|
constraints) {
|
|
@@ -2593,12 +2592,11 @@ TraceablePeerConnection.prototype._createOfferOrAnswer = function(
|
2593
|
2592
|
dumpSDP(resultSdp));
|
2594
|
2593
|
}
|
2595
|
2594
|
|
2596
|
|
- // configure simulcast for camera tracks always and for
|
2597
|
|
- // desktop tracks only when the testing flag for maxbitrates
|
2598
|
|
- // in config.js is disabled.
|
|
2595
|
+ // Configure simulcast for camera tracks always and for desktop tracks only when
|
|
2596
|
+ // the "capScreenshareBitrate" flag in config.js is disabled.
|
2599
|
2597
|
if (this.isSimulcastOn() && browser.usesSdpMungingForSimulcast()
|
2600
|
2598
|
&& (!this.options.capScreenshareBitrate
|
2601
|
|
- || (this.options.capScreenshareBitrate && hasCameraTrack(this)))) {
|
|
2599
|
+ || (this.options.capScreenshareBitrate && !this._isSharingScreen()))) {
|
2602
|
2600
|
// eslint-disable-next-line no-param-reassign
|
2603
|
2601
|
resultSdp = this.simulcast.mungeLocalDescription(resultSdp);
|
2604
|
2602
|
this.trace(
|
|
@@ -2783,12 +2781,11 @@ TraceablePeerConnection.prototype.generateNewStreamSSRCInfo = function(track) {
|
2783
|
2781
|
logger.error(`Will overwrite local SSRCs for track ID: ${rtcId}`);
|
2784
|
2782
|
}
|
2785
|
2783
|
|
2786
|
|
- // configure simulcast for camera tracks always and for
|
2787
|
|
- // desktop tracks only when the testing flag for maxbitrates
|
2788
|
|
- // in config.js is disabled.
|
|
2784
|
+ // Configure simulcast for camera tracks always and for desktop tracks only when
|
|
2785
|
+ // the "capScreenshareBitrate" flag in config.js is disabled.
|
2789
|
2786
|
if (this.isSimulcastOn()
|
2790
|
2787
|
&& (!this.options.capScreenshareBitrate
|
2791
|
|
- || (this.options.capScreenshareBitrate && hasCameraTrack(this)))) {
|
|
2788
|
+ || (this.options.capScreenshareBitrate && !this._isSharingScreen()))) {
|
2792
|
2789
|
ssrcInfo = {
|
2793
|
2790
|
ssrcs: [],
|
2794
|
2791
|
groups: []
|