Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update NScale uplink initial encoder params #1862

Merged
merged 4 commits into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
22 changes: 11 additions & 11 deletions docs/classes/nscalevideouplinkbandwidthpolicy.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ <h3>choose<wbr>Capture<wbr>And<wbr>Encode<wbr>Parameters</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/videouplinkbandwidthpolicy.html">VideoUplinkBandwidthPolicy</a>.<a href="../interfaces/videouplinkbandwidthpolicy.html#choosecaptureandencodeparameters">chooseCaptureAndEncodeParameters</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L114">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:114</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L113">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:113</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">DefaultVideoAndEncodeParameter</span></h4>
Expand All @@ -212,7 +212,7 @@ <h3>choose<wbr>Encoding<wbr>Parameters</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/videouplinkbandwidthpolicy.html">VideoUplinkBandwidthPolicy</a>.<a href="../interfaces/videouplinkbandwidthpolicy.html#chooseencodingparameters">chooseEncodingParameters</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L76">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:76</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L75">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:75</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Map</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">RTCRtpEncodingParameters</span><span class="tsd-signature-symbol">&gt;</span></h4>
Expand All @@ -230,7 +230,7 @@ <h3>choose<wbr>Media<wbr>Track<wbr>Constraints</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/videouplinkbandwidthpolicy.html">VideoUplinkBandwidthPolicy</a>.<a href="../interfaces/videouplinkbandwidthpolicy.html#choosemediatrackconstraints">chooseMediaTrackConstraints</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L72">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:72</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L71">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:71</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">MediaTrackConstraints</span></h4>
Expand All @@ -248,7 +248,7 @@ <h3>max<wbr>Bandwidth<wbr>Kbps</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/videouplinkbandwidthpolicy.html">VideoUplinkBandwidthPolicy</a>.<a href="../interfaces/videouplinkbandwidthpolicy.html#maxbandwidthkbps">maxBandwidthKbps</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L139">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:139</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L138">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:138</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4>
Expand All @@ -266,7 +266,7 @@ <h3>set<wbr>Has<wbr>Bandwidth<wbr>Priority</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/videouplinkbandwidthpolicy.html">VideoUplinkBandwidthPolicy</a>.<a href="../interfaces/videouplinkbandwidthpolicy.html#sethasbandwidthpriority">setHasBandwidthPriority</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L158">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:158</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L157">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:157</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -290,7 +290,7 @@ <h3>set<wbr>Ideal<wbr>Max<wbr>Bandwidth<wbr>Kbps</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/videouplinkbandwidthpolicy.html">VideoUplinkBandwidthPolicy</a>.<a href="../interfaces/videouplinkbandwidthpolicy.html#setidealmaxbandwidthkbps">setIdealMaxBandwidthKbps</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L154">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:154</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L153">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:153</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -314,7 +314,7 @@ <h3>set<wbr>Transceiver<wbr>Controller</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/videouplinkbandwidthpolicy.html">VideoUplinkBandwidthPolicy</a>.<a href="../interfaces/videouplinkbandwidthpolicy.html#settransceivercontroller">setTransceiverController</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L162">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:162</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L161">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:161</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -338,7 +338,7 @@ <h3>update<wbr>Connection<wbr>Metric</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/videouplinkbandwidthpolicy.html">VideoUplinkBandwidthPolicy</a>.<a href="../interfaces/videouplinkbandwidthpolicy.html#updateconnectionmetric">updateConnectionMetric</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L68">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:68</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L67">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:67</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -362,7 +362,7 @@ <h3>update<wbr>Index</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/videouplinkbandwidthpolicy.html">VideoUplinkBandwidthPolicy</a>.<a href="../interfaces/videouplinkbandwidthpolicy.html#updateindex">updateIndex</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L80">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:80</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L79">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:79</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -386,7 +386,7 @@ <h3>update<wbr>Transceiver<wbr>Controller</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/videouplinkbandwidthpolicy.html">VideoUplinkBandwidthPolicy</a>.<a href="../interfaces/videouplinkbandwidthpolicy.html#updatetransceivercontroller">updateTransceiverController</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L166">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:166</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L165">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:165</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>
Expand All @@ -404,7 +404,7 @@ <h3>wants<wbr>Resubscribe</h3>
<aside class="tsd-sources">
<p>Implementation of <a href="../interfaces/videouplinkbandwidthpolicy.html">VideoUplinkBandwidthPolicy</a>.<a href="../interfaces/videouplinkbandwidthpolicy.html#wantsresubscribe">wantsResubscribe</a></p>
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L110">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:110</a></li>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/master/src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts#L109">src/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.ts:109</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down