diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f9c1b4704..fcb1797fd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed updates to mutable state during subscribe leading to non-existant/frozen video streams. +- Fixed inconsistent default maxBitrate values in the NScaleVideoUplinkBandwithPolicy constructor leading to the default ideal max bitrate not being honored. ### Changed - Clarified comment in `DefaultSimulcastUplinkPolicy`. diff --git a/docs/classes/nscalevideouplinkbandwidthpolicy.html b/docs/classes/nscalevideouplinkbandwidthpolicy.html index 506020c27e..b2e3359d5f 100644 --- a/docs/classes/nscalevideouplinkbandwidthpolicy.html +++ b/docs/classes/nscalevideouplinkbandwidthpolicy.html @@ -194,7 +194,7 @@

chooseCaptureAndEncodeParameters

Returns DefaultVideoAndEncodeParameter

@@ -212,7 +212,7 @@

chooseEncodingParameters

Returns Map<string, RTCRtpEncodingParameters>

@@ -230,7 +230,7 @@

chooseMediaTrackConstraints

Returns MediaTrackConstraints

@@ -248,7 +248,7 @@

maxBandwidthKbps

Returns number

@@ -266,7 +266,7 @@

setHasBandwidthPriority

Parameters

@@ -290,7 +290,7 @@

setIdealMaxBandwidthKbps

Parameters

@@ -314,7 +314,7 @@

setTransceiverController

Parameters

@@ -338,7 +338,7 @@

updateConnectionMetric

Parameters

@@ -362,7 +362,7 @@

updateIndex

Parameters

@@ -386,7 +386,7 @@

updateTransceiverController

Returns Promise<void>

@@ -404,7 +404,7 @@

wantsResubscribe

Returns boolean

diff --git a/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts b/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts index 6d3853deeb..5c758f94d5 100644 --- a/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts +++ b/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts @@ -60,8 +60,7 @@ export default class NScaleVideoUplinkBandwidthPolicy implements VideoUplinkBand this.optimalParameters = new DefaultVideoAndEncodeParameter(0, 0, 0, 0, false); this.parametersInEffect = new DefaultVideoAndEncodeParameter(0, 0, 0, 0, false); this.encodingParamMap.set(NScaleVideoUplinkBandwidthPolicy.encodingMapKey, { - scaleResolutionDownBy: 1, - maxBitrate: this.idealMaxBandwidthKbps * 1000, + maxBitrate: 0, }); } diff --git a/test/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.test.ts b/test/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.test.ts index 5952a461be..d3f648ae57 100644 --- a/test/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.test.ts +++ b/test/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.test.ts @@ -701,7 +701,30 @@ describe('NScaleVideoUplinkBandwidthPolicy', () => { expect(spy.calledOnce).to.be.true; spy.restore(); }); - + it('Ensure setEncodingParameters is called to initially set the max bitrate', () => { + // use a new policy to ensure it's using the default values + policy = new NScaleVideoUplinkBandwidthPolicy(selfAttendeeId, true, new NoOpLogger()); + policy.setTransceiverController(transceiverController); + const index = new DefaultVideoStreamIndex(logger); + const spy = sinon.spy(TestTransceiverController.prototype, 'setEncodingParameters'); + index.integrateIndexFrame( + new SdkIndexFrame({ + sources: [ + new SdkStreamDescriptor({ + streamId: 2, + groupId: 1, + maxBitrateKbps: 1400, + attendeeId: 'xy1', + mediaType: SdkStreamMediaType.VIDEO, + }), + ], + }) + ); + policy.updateIndex(index); + policy.updateTransceiverController(); + expect(spy.calledOnce).to.be.true; + spy.restore(); + }); it('Return early if there is no transceiver controller', () => { const index = new DefaultVideoStreamIndex(logger); const spy = sinon.spy(TestTransceiverController.prototype, 'setEncodingParameters');