|
@@ -1957,6 +1957,8 @@ TraceablePeerConnection.prototype.setAudioTransferActive = function(active) {
|
1957
|
1957
|
*/
|
1958
|
1958
|
TraceablePeerConnection.prototype.setMaxBitRate = function(localTrack) {
|
1959
|
1959
|
const mediaType = localTrack.type;
|
|
1960
|
+ const trackId = localTrack.track.id;
|
|
1961
|
+ const videoType = localTrack.videoType;
|
1960
|
1962
|
|
1961
|
1963
|
// No need to set max bitrates on the streams in the following cases.
|
1962
|
1964
|
// 1. When an audio track has been replaced.
|
|
@@ -1964,7 +1966,7 @@ TraceablePeerConnection.prototype.setMaxBitRate = function(localTrack) {
|
1964
|
1966
|
// 3. When the config.js option for capping the SS bitrate is not enabled.
|
1965
|
1967
|
if ((mediaType === MediaType.AUDIO)
|
1966
|
1968
|
|| (browser.usesPlanB() && !this.options.capScreenshareBitrate)
|
1967
|
|
- || (browser.usesPlanB() && localTrack.videoType === 'camera')) {
|
|
1969
|
+ || (browser.usesPlanB() && videoType === VideoType.CAMERA)) {
|
1968
|
1970
|
return;
|
1969
|
1971
|
}
|
1970
|
1972
|
if (!this.peerconnection.getSenders) {
|
|
@@ -1972,8 +1974,8 @@ TraceablePeerConnection.prototype.setMaxBitRate = function(localTrack) {
|
1972
|
1974
|
|
1973
|
1975
|
return;
|
1974
|
1976
|
}
|
1975
|
|
- const videoType = localTrack.videoType;
|
1976
|
|
- const trackId = localTrack.track.id;
|
|
1977
|
+ const presenterEnabled = localTrack._originalStream
|
|
1978
|
+ && localTrack._originalStream.id !== localTrack.getStreamId();
|
1977
|
1979
|
|
1978
|
1980
|
this.peerconnection.getSenders()
|
1979
|
1981
|
.filter(s => s.track && s.track.id === trackId)
|
|
@@ -1987,9 +1989,12 @@ TraceablePeerConnection.prototype.setMaxBitRate = function(localTrack) {
|
1987
|
1989
|
logger.debug('Setting max bitrate on video stream');
|
1988
|
1990
|
for (const encoding in parameters.encodings) {
|
1989
|
1991
|
if (parameters.encodings.hasOwnProperty(encoding)) {
|
|
1992
|
+ // On chromium, set a max bitrate of 500 Kbps for screenshare when
|
|
1993
|
+ // capScreenshareBitrate is enabled through config.js and presenter
|
|
1994
|
+ // is not turned on.
|
1990
|
1995
|
parameters.encodings[encoding].maxBitrate
|
1991
|
|
- = videoType === 'desktop' && browser.usesPlanB()
|
1992
|
|
- ? DESKSTOP_SHARE_RATE
|
|
1996
|
+ = browser.usesPlanB()
|
|
1997
|
+ ? presenterEnabled ? MAX_BITRATE : DESKSTOP_SHARE_RATE
|
1993
|
1998
|
|
1994
|
1999
|
// In unified plan, simulcast for SS is on by default.
|
1995
|
2000
|
// When simulcast is disabled through a config.js option,
|