Skip to content

Re-compute encoding params after device change#1902

Merged
lukasIO merged 6 commits intomainfrom
lukas/refresh-encoding-params
Apr 21, 2026
Merged

Re-compute encoding params after device change#1902
lukasIO merged 6 commits intomainfrom
lukas/refresh-encoding-params

Conversation

@lukasIO
Copy link
Copy Markdown
Contributor

@lukasIO lukasIO commented Apr 20, 2026

closes #1884

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 20, 2026

🦋 Changeset detected

Latest commit: 1bde530

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 20, 2026

size-limit report 📦

Path Size
dist/livekit-client.esm.mjs 96.87 KB (+0.39% 🔺)
dist/livekit-client.umd.js 105.8 KB (+0.33% 🔺)

@lukasIO lukasIO requested a review from 1egoman April 20, 2026 12:47
Copy link
Copy Markdown
Contributor

@xianshijing-lk xianshijing-lk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two questions, lgtm if you address them

Comment thread src/room/track/LocalVideoTrack.ts Outdated
});

await this.applyEncodingsToSender(this.sender, newEncodings);
this.encodings = newEncodings;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question

what will happen if setParameters fails at the above this.applyEncodingsToSender( ?

It looks like we still continue and set the encodings ?

Is it intentional ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good point, I moved things around and it fits quite nicely with pushing the senderLock one level higher

Comment thread src/room/track/LocalVideoTrack.ts Outdated
...this.publishOptions,
});

await this.applyEncodingsToSender(this.sender, newEncodings);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question

what is the thread model for this LocalVideoTrack.ts? will it be called by multi threads?

I wonder if this.sender would have been changed when it gets here, given things are async like
dims = await this.waitForDimensions();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the sender property should only ever be set once for a given LocalTrack. We can think about moving the senderLock one level higher into refreshSenderEncodings. I'll do that now to be safe

@lukasIO lukasIO merged commit 942167c into main Apr 21, 2026
6 checks passed
@lukasIO lukasIO deleted the lukas/refresh-encoding-params branch April 21, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Video encoding parameters not recalculated after switchActiveDevice / replaceTrack

3 participants