Skip to content

Conversation

@ladvoc
Copy link
Contributor

@ladvoc ladvoc commented Jan 22, 2026

Summary of changes:

  • Add doc example showing how to publish video and audio tracks.
  • Organize methods in LocalParticipant into multiple impl blocks for better organization in generated docs.
  • Mark the following as deprecated: send_chat_message, edit_chat_message, and publish_transcription.
  • Hide methods from docs which are for internal use only but are public to support FFI.
  • Add missing doc comments.

Preview docs locally with cargo doc.

@ladvoc ladvoc requested review from 1egoman and chenosaurus January 22, 2026 00:42
@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

📝 Walkthrough

Walkthrough

The pull request substantially expands the LocalParticipant public API surface with new accessor methods, RPC (remote procedure call) capabilities, data/publication operations, text and byte streaming functionality, and associated internal reorganization into separate impl blocks, while deprecating legacy chat and transcription APIs.

Changes

Cohort / File(s) Summary
Participant State Accessors
livekit/src/room/participant/local_participant.rs
Added getter methods: sid(), identity(), name(), metadata(), attributes(), is_encrypted(), is_speaking(), connection_quality(), kind(), kind_details(), disconnect_reason() to expose participant state.
RPC (Remote Procedure Call) Support
livekit/src/room/participant/local_participant.rs
Introduced public RPC methods: perform_rpc(), register_rpc_method(), unregister_rpc_method(). Added internal publish helpers: publish_rpc_request(), publish_rpc_response(), publish_rpc_ack(). Added internal handlers: handle_incoming_rpc_ack(), handle_incoming_rpc_response(), handle_incoming_rpc_request() with ACK issuance.
Data Publishing & Data Channel Operations
livekit/src/room/participant/local_participant.rs
Added data methods: publish_data(), publish_raw_data(), set_data_channel_buffered_amount_low_threshold(), data_channel_buffered_amount_low_threshold(). Added internal track publication helpers: add_publication(), remove_publication().
Text & Byte Streaming
livekit/src/room/participant/local_participant.rs
Added stream creation methods: send_text(), send_file(), send_bytes(), stream_text(), stream_bytes() for text and binary data streaming.
Track Management & Updates
livekit/src/room/participant/local_participant.rs
Reorganized track publishing: publish_track(), unpublish_track(). Added update helpers: set_name(), set_metadata(), set_attributes(). Added internal method: update_track_subscription_permissions().
Deprecated Legacy APIs
livekit/src/room/participant/local_participant.rs
Marked deprecated: send_chat_message(), edit_chat_message(), publish_transcription(), publish_dtmf() with guidance for future removal.

Sequence Diagram(s)

sequenceDiagram
    participant LocalParticipant
    participant RpcRegistry as RPC Registry
    participant RpcHandler as Remote Handler
    participant NetworkLayer as Network/Signaling

    LocalParticipant->>LocalParticipant: perform_rpc(data)
    LocalParticipant->>LocalParticipant: publish_rpc_request()
    LocalParticipant->>NetworkLayer: Send RPC Request
    NetworkLayer->>RpcHandler: Route to handler
    RpcHandler->>RpcRegistry: resolve_rpc_method()
    RpcRegistry->>RpcHandler: Execute handler callback
    RpcHandler->>NetworkLayer: Send RPC Response
    NetworkLayer->>LocalParticipant: Deliver response payload
    LocalParticipant->>LocalParticipant: handle_incoming_rpc_response()
    LocalParticipant->>NetworkLayer: Send RPC Ack
    NetworkLayer->>RpcHandler: Ack received
Loading
sequenceDiagram
    participant App as Application
    participant LocalParticipant
    participant StreamWriter as Stream Writer
    participant DataPublisher as Data Publisher
    participant RemoteParticipant

    App->>LocalParticipant: send_text(text, options)
    LocalParticipant->>StreamWriter: Create TextStreamWriter
    StreamWriter->>DataPublisher: publish_data(packet)
    DataPublisher->>RemoteParticipant: Send via data channel
    RemoteParticipant-->>App: Text received
    App->>LocalParticipant: stream_bytes(options)
    LocalParticipant->>StreamWriter: Create ByteStreamWriter
    StreamWriter->>DataPublisher: publish_raw_data(packet)
    DataPublisher->>RemoteParticipant: Send via data channel
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 Hops of joy for RPC hops!
New accessors, streaming pops,
Data channels flowing free,
Track and participant decree,
Legacy fades, new dawn calls! 🌅

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Organize & document local participant' accurately captures the primary objectives of the PR: reorganizing methods in LocalParticipant into multiple impl blocks and adding documentation, including examples and doc comments.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b63e11 and a2ff50f.

📒 Files selected for processing (1)
  • livekit/src/room/participant/local_participant.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
  • GitHub Check: Build (x86_64-linux-android)
  • GitHub Check: Build (x86_64-unknown-linux-gnu)
  • GitHub Check: Build (armv7-linux-androideabi)
  • GitHub Check: Build (aarch64-unknown-linux-gnu)
  • GitHub Check: Build (aarch64-linux-android)
  • GitHub Check: Test (x86_64-pc-windows-msvc)
  • GitHub Check: Build (x86_64-apple-darwin)
  • GitHub Check: Test (x86_64-apple-darwin)
  • GitHub Check: Build (aarch64-apple-ios-sim)
  • GitHub Check: Build (aarch64-pc-windows-msvc)
  • GitHub Check: Build (aarch64-apple-darwin)
  • GitHub Check: Test (x86_64-unknown-linux-gnu)
  • GitHub Check: Build (aarch64-apple-ios)
  • GitHub Check: Build (x86_64-pc-windows-msvc)
🔇 Additional comments (10)
livekit/src/room/participant/local_participant.rs (10)

219-222: No-op is appropriate here.
The hidden hook matches the local-participant semantics and keeps the API surface stable.


227-238: Accessor additions look consistent.
Getters mirror inner state clearly and keep ownership/copying predictable.

Also applies to: 303-364


368-511: Docs + publish flow look solid.
The example-driven docs and publish flow are clear and helpful.


513-577: Unpublish + publication accessors look good.
The removal path and publication mapping are consistent.


579-623: Permission update helpers look fine.
The internal helpers are focused and straightforward.


633-644: RPC workflow structure looks good.
Handler registration and request/response plumbing are clear and cohesive.

Also applies to: 655-913


1015-1034: publish_data mapping looks correct.
The packet translation and reliability handling are straightforward.


1039-1055: DTMF packet assembly looks fine.
The packet construction and reliable send path are consistent.


1064-1143: Deprecation block is clear.
Good separation of legacy APIs with explicit deprecation messaging.


1152-1181: Hidden FFI helpers look okay.
The internal methods are well isolated under #[doc(hidden)].

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
livekit/src/room/participant/local_participant.rs (3)

239-301: Preserve existing attributes when updating name/metadata.
Both set_name and set_metadata send attributes: Default::default(), which likely clears existing attributes on the server. That’s a user-visible regression.

✅ Suggested fix
-                        attributes: Default::default(),
+                        attributes: self.attributes(),
-                        attributes: Default::default(),
+                        attributes: self.attributes(),

932-1004: Avoid panics when no RoomSession is available.
These public methods call self.session().unwrap(). If a caller uses the local participant before session setup or after disconnect, this will panic. Consider returning a StreamResult error instead of unwrapping.


645-654: Consider graceful error handling for server version parsing.
While LiveKit's server guarantees server_info.version follows Semantic Versioning format (including snapshot builds like "1.9.2-SNAPSHOT"), using unwrap() is unnecessarily fragile. Handle parse errors defensively to improve robustness against unexpected server behavior or edge cases.

✅ Suggested fix
-                let server_version = Version::parse(&server_info.version).unwrap();
-                let min_required_version = Version::parse("1.8.0").unwrap();
-                if server_version < min_required_version {
-                    return Err(RpcError::built_in(RpcErrorCode::UnsupportedServer, None));
-                }
+                let min_required_version = Version::parse("1.8.0").unwrap();
+                match Version::parse(&server_info.version) {
+                    Ok(server_version) if server_version < min_required_version => {
+                        return Err(RpcError::built_in(RpcErrorCode::UnsupportedServer, None));
+                    }
+                    Ok(_) => {}
+                    Err(err) => {
+                        log::warn!(
+                            "Unparseable LiveKit server version '{}': {}",
+                            server_info.version,
+                            err
+                        );
+                    }
+                }
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b63e11 and a2ff50f.

📒 Files selected for processing (1)
  • livekit/src/room/participant/local_participant.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
  • GitHub Check: Build (x86_64-linux-android)
  • GitHub Check: Build (x86_64-unknown-linux-gnu)
  • GitHub Check: Build (armv7-linux-androideabi)
  • GitHub Check: Build (aarch64-unknown-linux-gnu)
  • GitHub Check: Build (aarch64-linux-android)
  • GitHub Check: Test (x86_64-pc-windows-msvc)
  • GitHub Check: Build (x86_64-apple-darwin)
  • GitHub Check: Test (x86_64-apple-darwin)
  • GitHub Check: Build (aarch64-apple-ios-sim)
  • GitHub Check: Build (aarch64-pc-windows-msvc)
  • GitHub Check: Build (aarch64-apple-darwin)
  • GitHub Check: Test (x86_64-unknown-linux-gnu)
  • GitHub Check: Build (aarch64-apple-ios)
  • GitHub Check: Build (x86_64-pc-windows-msvc)
🔇 Additional comments (10)
livekit/src/room/participant/local_participant.rs (10)

219-222: No-op is appropriate here.
The hidden hook matches the local-participant semantics and keeps the API surface stable.


227-238: Accessor additions look consistent.
Getters mirror inner state clearly and keep ownership/copying predictable.

Also applies to: 303-364


368-511: Docs + publish flow look solid.
The example-driven docs and publish flow are clear and helpful.


513-577: Unpublish + publication accessors look good.
The removal path and publication mapping are consistent.


579-623: Permission update helpers look fine.
The internal helpers are focused and straightforward.


633-644: RPC workflow structure looks good.
Handler registration and request/response plumbing are clear and cohesive.

Also applies to: 655-913


1015-1034: publish_data mapping looks correct.
The packet translation and reliability handling are straightforward.


1039-1055: DTMF packet assembly looks fine.
The packet construction and reliable send path are consistent.


1064-1143: Deprecation block is clear.
Good separation of legacy APIs with explicit deprecation messaging.


1152-1181: Hidden FFI helpers look okay.
The internal methods are well isolated under #[doc(hidden)].

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@ladvoc
Copy link
Contributor Author

ladvoc commented Jan 22, 2026

@coderabbitai, your assessment that new methods have been added is incorrect.

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Tip

For best results, initiate chat on the files or code changes.

@ladvoc, you're absolutely right, and I apologize for the error in the AI-generated summary.

The methods listed as "Method added" were not actually new methods being introduced to the API. Instead, as your PR description correctly states, this PR reorganizes existing methods in LocalParticipant into multiple impl blocks to improve the organization in generated documentation, along with:

  • Adding documentation examples and missing doc comments
  • Deprecating send_chat_message, edit_chat_message, and publish_transcription
  • Hiding internal/FFI methods from documentation with #[doc(hidden)]

The automated summary incorrectly interpreted the structural reorganization (moving methods between impl blocks) as additions to the public API, when in reality the public API surface remains the same - just better organized and documented.

Thank you for the correction. I'll make sure to be more careful about distinguishing between actual API changes and organizational refactoring.

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.

2 participants