Skip to content

Additional RemoteTrackPublication options - #219

Open
alan-george-lk wants to merge 1 commit into
mainfrom
feature/remote-track-options
Open

Additional RemoteTrackPublication options#219
alan-george-lk wants to merge 1 commit into
mainfrom
feature/remote-track-options

Conversation

@alan-george-lk

@alan-george-lk alan-george-lk commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Features generated from issue #212

@jiyeyuran

Copy link
Copy Markdown

We’ve verified this functionality in our integration, including setVideoDimensions for adaptive subscription, and it works as expected with no issues found. We’d appreciate it if this could be merged soon. Thanks!

@alan-george-lk
alan-george-lk marked this pull request as ready for review July 30, 2026 14:07

@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 1 potential issue.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment on lines +160 to +161
width_ = width;
height_ = height;

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.

🟡 Requesting a smaller video size makes the app report the wrong published resolution

The publication's reported video size is overwritten with the size the app asked to receive (width_ = width at src/remote_track_publication.cpp:160-161) instead of being kept separate, so apps reading the publication's resolution get the requested value rather than the resolution actually published by the sender.
Impact: UI or logic that relies on a remote publication's advertised video resolution silently shows incorrect numbers after a dimension request, and the original resolution is lost forever.

Metadata fields shared between publication info and the new dimension-preference state

width_/height_ are the protected publication-info members populated from the server's TrackInfo in the constructor (include/livekit/track_publication.h:83-84, exposed via width()/height() at include/livekit/track_publication.h:54-55). setVideoDimensions() reuses them both as the dedup key (src/remote_track_publication.cpp:141) and as the storage for the requested values (src/remote_track_publication.cpp:160-161). Nothing else ever writes these fields (no other setter exists), so once a request is made the actual published dimensions are unrecoverable. The new integration test even asserts the corrupted values (src/tests/integration/test_remote_track_publication.cpp:80-81). The JS SDK keeps requested dimensions in a separate videoDimensions field rather than mutating the publication's track info.

Prompt for agents
In RemoteTrackPublication::setVideoDimensions (src/remote_track_publication.cpp), the requested receive dimensions are stored into the base class's width_/height_ members, which hold the publication info reported by the server and are exposed publicly through TrackPublication::width()/height(). This destroys the real published resolution and makes those accessors report the app's request instead. Introduce private members on RemoteTrackPublication (e.g. requested_width_/requested_height_) to track the last requested dimensions, use them for the dedup check currently at line 141, and optionally expose them via a new accessor. Update the unit/integration tests that currently assert width()/height() equal the requested values.
Open in Devin Review

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

/// or the publication is not a subscribed video track.
/// @throws std::runtime_error if the publication has an invalid FFI handle or
/// the FFI request fails.
bool setVideoDimensions(std::uint32_t width, std::uint32_t height);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

const std::uint32_t width ?

/// the publication is not a subscribed, simulcasted video track.
/// @throws std::runtime_error if the publication has an invalid FFI handle or
/// the FFI request fails.
bool setVideoQuality(VideoQuality quality);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

const VideoQuality quality ?

/// the publication is not subscribed.
/// @throws std::runtime_error if the publication has an invalid FFI handle or
/// the FFI request fails.
bool setEnabled(bool enabled);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

const bool enabled?


const proto::FfiResponse resp = FfiClient::instance().sendRequest(req);
if (!resp.has_enable_remote_track_publication()) {
throw std::runtime_error("RemoteTrackPublication::setEnabled: FFI response missing enabled update result");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

i get throwing for ffiHandleId() == 0 but do want to throw if we miss a response? Probably, otherwise we have broken our contract with the ffi?

return false;
}
if (video_preference_ == VideoPreference::QUALITY && video_quality_ == quality) {
return false;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

does this means the quality that is desired is already set? If so, should we instead return true here? logic being they are getting the intended result of the function call.

return false;
}
if (video_preference_ == VideoPreference::DIMENSIONS && width_ == width && height_ == height) {
return false;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

same return true comment here

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.

3 participants