Skip to content

add option to add simuclcast layers in trackpublishoptions - #1322

Open
nitch193 wants to merge 1 commit into
livekit:mainfrom
nitch193:feat-add-simulcastlayers
Open

add option to add simuclcast layers in trackpublishoptions#1322
nitch193 wants to merge 1 commit into
livekit:mainfrom
nitch193:feat-add-simulcastlayers

Conversation

@nitch193

@nitch193 nitch193 commented Aug 9, 2026

Copy link
Copy Markdown

Before you submit your PR

Make sure the following is true before submitting your PR:

  • I have read the contributing guidelines and validated that this PR will be accepted.
  • I have read and followed the principles regarding breaking changes, testing, and code quality.

PR description

Helps to add simulcast layers in livkit-ffi in trackpublishoptions during publishing of track, Fixes livekit/client-sdk-unity#176

Breaking changes

no breaking change

MSRV

no

@nitch193
nitch193 requested a review from ladvoc as a code owner August 9, 2026 18:24
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@devin-ai-integration devin-ai-integration Bot left a comment

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.

Devin Review found 3 potential issues.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment on lines +308 to +313
// A video preset describing a simulcast layer.
message VideoPreset {
required uint32 width = 1;
required uint32 height = 2;
required VideoEncoding encoding = 3;
}

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.

🔴 Simulcast layers can never be sent because the option field was never added to the message definition

The new simulcast layer presets are read from the publish options message (opts.simulcast_layers at livekit-ffi/src/conversion/room.rs:357) even though no such field was added to that message definition, so clients have no way to actually supply simulcast layers.
Impact: The advertised ability to choose simulcast layers when publishing a track does not work at all.

Missing repeated VideoPreset field in TrackPublishOptions

The proto change only adds the VideoPreset message (livekit-ffi/protocol/room.proto:308-313); TrackPublishOptions (livekit-ffi/protocol/room.proto:315-336) still ends at field 13 with no repeated VideoPreset simulcast_layers = 14;. Since the Rust structs are generated from this proto at build time (livekit-ffi/src/proto.rs:18), opts.simulcast_layers does not exist and the FFI cannot receive layer presets.

Prompt for agents
The PR adds a VideoPreset proto message and consumes opts.simulcast_layers in livekit-ffi/src/conversion/room.rs, but TrackPublishOptions in livekit-ffi/protocol/room.proto was never given a corresponding field. Add a new repeated VideoPreset simulcast_layers field with the next unused field number (14) to TrackPublishOptions so the conversion has something to read, and verify prost-generated types line up with the conversion code (note prost models proto2 required message fields as Option, so proto::VideoPreset::encoding will likely need handling for the None case).
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +357 to +361
simulcast_layers: if opts.simulcast_layers.is_empty() {
opts.default_publish_options.simulcast_layers
} else {
Some(opts.simulcast_layers.into_iter().map(Into::into).collect())
},

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.

🔴 Fallback to default simulcast layers reads from the wrong value

When no simulcast layers are provided, the fallback reads the default layers off the incoming request instead of the defaults object (opts.default_publish_options.simulcast_layers at livekit-ffi/src/conversion/room.rs:358), so the default simulcast configuration cannot be resolved.
Impact: Publishing without explicit simulcast layers cannot fall back to the SDK defaults.

Wrong receiver on the default lookup

default_publish_options is a local binding created at livekit-ffi/src/conversion/room.rs:338 (TrackPublishOptions::default()); it is not a field of the proto request opts. Every other branch in this From impl uses the local (e.g. livekit-ffi/src/conversion/room.rs:353-356).

Suggested change
simulcast_layers: if opts.simulcast_layers.is_empty() {
opts.default_publish_options.simulcast_layers
} else {
Some(opts.simulcast_layers.into_iter().map(Into::into).collect())
},
simulcast_layers: if opts.simulcast_layers.is_empty() {
default_publish_options.simulcast_layers
} else {
Some(opts.simulcast_layers.into_iter().map(Into::into).collect())
},
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +357 to +361
simulcast_layers: if opts.simulcast_layers.is_empty() {
opts.default_publish_options.simulcast_layers
} else {
Some(opts.simulcast_layers.into_iter().map(Into::into).collect())
},

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.

🟡 Pull request is missing the required change documentation entry

The change adds a new option without adding the required documentation entry for the release tooling, which the repository mandates for every pull request.
Impact: The release notes and crate version bumps will not reflect this change.

AGENTS.md changeset requirement

AGENTS.md states "Every PR needs a changeset" and that it must list crates to bump. This PR only touches livekit-ffi/protocol/room.proto and livekit-ffi/src/conversion/room.rs; no file was added under /.changeset.

Prompt for agents
Per AGENTS.md, every PR requires a changeset under /.changeset documenting the change and listing crates that need version bumps (here livekit-ffi, and livekit if public API changes). Create one with `knope document-change` or manually.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

Adding simulcastlayers in unity sdk.

2 participants