Skip to content

added Single Peer Connection support to Rust#888

Open
xianshijing-lk wants to merge 9 commits intomainfrom
sxian/CLT-2547/add_single_pc_to_rust
Open

added Single Peer Connection support to Rust#888
xianshijing-lk wants to merge 9 commits intomainfrom
sxian/CLT-2547/add_single_pc_to_rust

Conversation

@xianshijing-lk
Copy link
Contributor

@xianshijing-lk xianshijing-lk commented Feb 11, 2026

after setting the LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET to staging endpoint, you will see things like

run tests:
cargo test -p livekit --features "__lk-e2e-test,native-tls" -- --nocapture

cargo test -p livekit --features "__lk-e2e-test,native-tls" --test peer_connection_signaling_test -- --nocapture

[INFO audio_test] Testing with 48000Hz, 1ch. -> 48000Hz, 1ch.
[INFO livekit_api::signal_client::signal_stream] connecting to wss://xianstaging-hixkk74p.staging.livekit.cloud/rtc/v1?sdk=rust&protocol=16&auto_subscribe=1&adaptive_stream=0&version=0.7.30&join_request=EhsKFQgIEgYwLjcuMzAYECIFbWFjb3NgARICCAE%3D
[INFO livekit_api::signal_client::signal_stream] connecting to wss://xianstaging-hixkk74p.staging.livekit.cloud/rtc/v1?sdk=rust&protocol=16&auto_subscribe=1&adaptive_stream=0&version=0.7.30&join_request=EhsKFQgIEgYwLjcuMzAYECIFbWFjb3NgARICCAE%3D
[INFO livekit_api::signal_client] [CONNECT] SUCCESS: v1 path connection successful, single_pc_mode=true
[ERROR livekit_api::signal_client] [CONNECT] ====== CONNECTION ESTABLISHED ======

@@ -1059,6 +1066,35 @@ impl RoomSession {
track_id = stream_id.into();
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: This could be moved into the else block below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

return;
}
// In dual PC mode: answer is local, offer is remote
(remote_desc.unwrap(), Some(local_desc.unwrap()))
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Is it possible for sync state to be requested at a time when the subscriber PC lacks a local or remote description? If yes or it is unclear, we should avoid unwrapping here, and instead log a warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I actually don't know if it is possible, but I think it is dangerous to do unwrap() here, let me address it.

};

// Create ClientInfo
let client_info = proto::ClientInfo {
Copy link
Contributor

@ladvoc ladvoc Feb 11, 2026

Choose a reason for hiding this comment

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

nitpick: Spreading ..Default::default() would be cleaner here:

let client_info = proto::ClientInfo {
    sdk: proto::client_info::Sdk::Rust as i32,
    version: options.sdk_options.sdk_version.clone().unwrap_or_default(),
    protocol: PROTOCOL_VERSION as i32,
    os: std::env::consts::OS.to_string(),
    client_protocol: 1, // Indicates support for RPC compression
    ..Default::default()
};

Same for the other protobuf types below where we set an empty string or Option::None.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@ladvoc ladvoc left a comment

Choose a reason for hiding this comment

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

It looking good so far! Before merging, I think it's important to test various reconnect scenarios, as this change could potentially break them.

@xianshijing-lk xianshijing-lk force-pushed the sxian/CLT-2547/add_single_pc_to_rust branch from 69d4597 to a13c540 Compare February 11, 2026 21:50
Copy link
Contributor Author

@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.

I addressed all the comments, please take another look

};

// Create ClientInfo
let client_info = proto::ClientInfo {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -1059,6 +1066,35 @@ impl RoomSession {
track_id = stream_id.into();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

return;
}
// In dual PC mode: answer is local, offer is remote
(remote_desc.unwrap(), Some(local_desc.unwrap()))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I actually don't know if it is possible, but I think it is dangerous to do unwrap() here, let me address it.

@xianshijing-lk xianshijing-lk force-pushed the sxian/CLT-2547/add_single_pc_to_rust branch from 20a520d to 3b29452 Compare February 12, 2026 17:38
@xianshijing-lk
Copy link
Contributor Author

Hi team, thanks for the comments, I think I addressed them, please take another look.

Thanks.

@xianshijing-lk
Copy link
Contributor Author

A gentle ping. do we have concerns on landing this PR ?

@xianshijing-lk xianshijing-lk force-pushed the sxian/CLT-2547/add_single_pc_to_rust branch from d3001b0 to cf74f4b Compare February 14, 2026 00:49
@xianshijing-lk
Copy link
Contributor Author

I made some small improvements to make sure the munging code only kicks in for v1 path, and added some more tests to e2e peer connection tests

@xianshijing-lk xianshijing-lk force-pushed the sxian/CLT-2547/add_single_pc_to_rust branch from 7454be0 to 630f41b Compare February 14, 2026 01:57
@xianshijing-lk xianshijing-lk force-pushed the sxian/CLT-2547/add_single_pc_to_rust branch from b25162e to 9cf6d3b Compare February 14, 2026 02:16
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.

4 participants