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

Force enable dynacast if backupCodec is used #839

Merged
merged 2 commits into from
Aug 17, 2023
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
5 changes: 5 additions & 0 deletions .changeset/four-seals-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-client': patch
---

Force enable dynacast when backupCodec is enabled
3 changes: 3 additions & 0 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export interface InternalRoomOptions {
* enable Dynacast, off by default. With Dynacast dynamically pauses
* video layers that are not being consumed by any subscribers, significantly
* reducing publishing CPU and bandwidth usage.
*
* Dynacast will be enabled if SVC codecs (VP9/AV1) are used. Multi-codec simulcast
* requires dynacast
*/
dynacast: boolean;

Expand Down
3 changes: 3 additions & 0 deletions src/room/participant/LocalParticipant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,9 @@ export default class LocalParticipant extends Participant {

// set up backup
if (opts.videoCodec && opts.backupCodec && opts.videoCodec !== opts.backupCodec.codec) {
if (!this.roomOptions.dynacast) {
this.roomOptions.dynacast = true;
}
const simOpts = { ...opts };
simOpts.simulcast = true;
simEncodings = computeTrackBackupEncodings(track, opts.backupCodec.codec, simOpts);
Expand Down