-
Notifications
You must be signed in to change notification settings - Fork 131
Description
Describe the bug
When using the FFI client to mute a local track via LocalTrackMuteRequest (ID 17), the underlying media stream is successfully disabled (remote participants see a black screen or silence), but the signaling status is not updated.
As a result, the LiveKit Server does not receive the mute status update, and remote participants do not receive the TrackMuted event.
Steps to reproduce
Connect an FFI-based client (e.g., C++ SDK wrapping livekit-ffi) to a room.
Publish a video or audio track.
Send a LocalTrackMuteRequest with mute: true.
Observe from a remote Web client.
Expected behavior
The media stream stops.
The remote participant receives a TrackMuted event.
The track status in the room metadata reflects muted: true.
Actual behavior
The media stream stops (video freezes/goes black).
No TrackMuted event is received by remote participants.
The server still considers the track as "active" (signaling-wise).
Code Analysis / Root Cause
I investigated the FFI source code and believe the issue lies in src/server/requests.rs.
In the on_local_track_mute function:
// livekit-ffi/src/server/requests.rs
fn on_local_track_mute(
server: &'static FfiServer,
request: proto::LocalTrackMuteRequest,
) -> FfiResultproto::LocalTrackMuteResponse {
// ... retrieves handle ...
match ffi_track.track {
Track::LocalAudio(track) => {
if request.mute {
track.mute(); // <--- ISSUE HERE
} else {
track.unmute();
}
// ...
}
// Same for Video ...
}
// ...
}
Calling track.mute() on the LocalTrack struct (from the Rust SDK) only disables the underlying WebRTC MediaStreamTrack (enabled = false). It does not automatically propagate the status to the LocalTrackPublication.
In the standard Rust SDK usage, one would typically call publication.set_muted(true) to ensure the signaling request is sent to the server. However, FfiTrack seems to lack a reference to its TrackPublication, making it difficult to update the signaling status from this request handler.
Proposed Solution
The FFI server needs a way to resolve the LocalTrackPublication associated with the LocalTrack (or track_handle) and update the publication's mute status, which triggers the necessary RPC to the server.
Alternatively, provide a new FFI Request specifically for mutating TrackPublication settings.