Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(livekit): add fast_publish #506

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nanpa/fast-publish.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patch package="livekit" type="added" "implement fast publish"
7 changes: 6 additions & 1 deletion livekit/src/rtc_engine/rtc_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ struct SessionInner {
negotiation_debouncer: Mutex<Option<Debouncer>>,

pending_requests: Mutex<HashMap<u32, oneshot::Sender<proto::RequestResponse>>>,

fast_publish: AtomicBool,
}

/// This struct holds a WebRTC session
Expand Down Expand Up @@ -258,6 +260,7 @@ impl RtcSession {
options,
negotiation_debouncer: Default::default(),
pending_requests: Default::default(),
fast_publish: join_response.fast_publish.into(),
});

// Start session tasks
Expand Down Expand Up @@ -938,7 +941,9 @@ impl SessionInner {
data: &proto::DataPacket,
kind: DataPacketKind,
) -> Result<(), EngineError> {
self.ensure_publisher_connected(kind).await?;
if !self.fast_publish.load(Ordering::Acquire) {
self.ensure_publisher_connected(kind).await?;
}
self.data_channel(SignalTarget::Publisher, kind)
.unwrap()
.send(&data.encode_to_vec(), true)
Expand Down
Loading