Skip to content

Commit 0d49d44

Browse files
authored
Merge branch 'main' into worker-timers
2 parents 790c605 + 53a5ac3 commit 0d49d44

File tree

29 files changed

+279
-26
lines changed

29 files changed

+279
-26
lines changed

packages/client/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
44

5+
## [1.10.5](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.10.4...@stream-io/video-client-1.10.5) (2024-11-07)
6+
7+
8+
### Bug Fixes
9+
10+
* ignore maxSimulcastLayers override for SVC codecs ([#1564](https://github.com/GetStream/stream-video-js/issues/1564)) ([48f8abe](https://github.com/GetStream/stream-video-js/commit/48f8abe5fd5b48c367a04696febd582573def828))
11+
12+
## [1.10.4](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.10.3...@stream-io/video-client-1.10.4) (2024-11-07)
13+
14+
15+
### Bug Fixes
16+
17+
* max simulcast layers preference ([#1560](https://github.com/GetStream/stream-video-js/issues/1560)) ([2b0bf28](https://github.com/GetStream/stream-video-js/commit/2b0bf2824dce41c2709e361e0521cf85e1b2fd16))
18+
519
## [1.10.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.10.2...@stream-io/video-client-1.10.3) (2024-11-05)
620

721

packages/client/docusaurus/docs/javascript/02-guides/03-call-and-participant-state.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ const subscription = call.state.participants$.subscribe((participants) => {
151151
subscription.unsubscribe();
152152
```
153153

154+
In a call with many participants, the value of the `participants$` call state observable is truncated to 250 participants. The participants who are publishing video, audio, or screen sharing have priority over the other participants in the list. This means, for example, that in a livestream with one host and many viewers, the host is guaranteed to be in the list.
155+
154156
## Client state
155157

156158
The client state can be accessed by `client.state`.

packages/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stream-io/video-client",
3-
"version": "1.10.3",
3+
"version": "1.10.5",
44
"packageManager": "[email protected]",
55
"main": "dist/index.cjs.js",
66
"module": "dist/index.es.js",

packages/client/src/rtc/Publisher.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ export class Publisher {
394394
? // for SVC, we only have one layer (q) and often rid is omitted
395395
enabledLayers[0]
396396
: // for non-SVC, we need to find the layer by rid (simulcast)
397-
enabledLayers.find((l) => l.name === encoder.rid);
397+
enabledLayers.find((l) => l.name === encoder.rid) ??
398+
(params.encodings.length === 1 ? enabledLayers[0] : undefined);
398399

399400
// flip 'active' flag only when necessary
400401
const shouldActivate = !!layer?.active;

packages/client/src/rtc/__tests__/Publisher.test.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,45 @@ describe('Publisher', () => {
360360
]);
361361
});
362362

363+
it('can dynamically activate/deactivate simulcast layers when rid is missing', async () => {
364+
const transceiver = new RTCRtpTransceiver();
365+
const setParametersSpy = vi
366+
.spyOn(transceiver.sender, 'setParameters')
367+
.mockResolvedValue();
368+
const getParametersSpy = vi
369+
.spyOn(transceiver.sender, 'getParameters')
370+
.mockReturnValue({
371+
// @ts-expect-error incomplete data
372+
codecs: [{ mimeType: 'video/VP8' }],
373+
encodings: [{ active: false }],
374+
});
375+
376+
// inject the transceiver
377+
publisher['transceiverCache'].set(TrackType.VIDEO, transceiver);
378+
379+
await publisher['changePublishQuality']([
380+
{
381+
name: 'q',
382+
active: true,
383+
maxBitrate: 100,
384+
scaleResolutionDownBy: 4,
385+
maxFramerate: 30,
386+
scalabilityMode: '',
387+
},
388+
]);
389+
390+
expect(getParametersSpy).toHaveBeenCalled();
391+
expect(setParametersSpy).toHaveBeenCalled();
392+
expect(setParametersSpy.mock.calls[0][0].encodings).toEqual([
393+
{
394+
active: true,
395+
maxBitrate: 100,
396+
scaleResolutionDownBy: 4,
397+
maxFramerate: 30,
398+
},
399+
]);
400+
});
401+
363402
it('can dynamically update scalability mode in SVC', async () => {
364403
const transceiver = new RTCRtpTransceiver();
365404
const setParametersSpy = vi

packages/client/src/rtc/bitrateLookup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const bitrateLookupTable: Record<
66
> = {
77
h264: {
88
2160: 5_000_000,
9-
1440: 3_500_000,
10-
1080: 2_750_000,
9+
1440: 3_000_000,
10+
1080: 2_000_000,
1111
720: 1_250_000,
1212
540: 750_000,
1313
360: 400_000,

packages/client/src/rtc/videoLayers.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ export const findOptimalVideoLayers = (
6565
const optimalVideoLayers: OptimalVideoLayer[] = [];
6666
const settings = videoTrack.getSettings();
6767
const { width = 0, height = 0 } = settings;
68-
const { scalabilityMode, bitrateDownscaleFactor = 2 } = publishOptions || {};
68+
const {
69+
scalabilityMode,
70+
bitrateDownscaleFactor = 2,
71+
maxSimulcastLayers = 3,
72+
} = publishOptions || {};
6973
const maxBitrate = getComputedMaxBitrate(
7074
targetResolution,
7175
width,
@@ -76,7 +80,8 @@ export const findOptimalVideoLayers = (
7680
let downscaleFactor = 1;
7781
let bitrateFactor = 1;
7882
const svcCodec = isSvcCodec(codecInUse);
79-
for (const rid of ['f', 'h', 'q']) {
83+
const totalLayers = svcCodec ? 3 : Math.min(3, maxSimulcastLayers);
84+
for (const rid of ['f', 'h', 'q'].slice(0, totalLayers)) {
8085
const layer: OptimalVideoLayer = {
8186
active: true,
8287
rid,

packages/client/src/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ export type PublishOptions = {
181181
* in simulcast mode (non-SVC).
182182
*/
183183
bitrateDownscaleFactor?: number;
184+
/**
185+
* The maximum number of simulcast layers to use when publishing the video stream.
186+
*/
187+
maxSimulcastLayers?: number;
184188
/**
185189
* Screen share settings.
186190
*/

packages/react-bindings/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
44

5+
## [1.1.16](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.1.15...@stream-io/video-react-bindings-1.1.16) (2024-11-07)
6+
7+
### Dependency Updates
8+
9+
* `@stream-io/video-client` updated to version `1.10.5`
10+
## [1.1.15](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.1.14...@stream-io/video-react-bindings-1.1.15) (2024-11-07)
11+
12+
### Dependency Updates
13+
14+
* `@stream-io/video-client` updated to version `1.10.4`
515
## [1.1.14](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.1.13...@stream-io/video-react-bindings-1.1.14) (2024-11-05)
616

717
### Dependency Updates

packages/react-bindings/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stream-io/video-react-bindings",
3-
"version": "1.1.14",
3+
"version": "1.1.16",
44
"packageManager": "[email protected]",
55
"main": "./dist/index.cjs.js",
66
"module": "./dist/index.es.js",

0 commit comments

Comments
 (0)