Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
keepingitneil committed Jul 15, 2024
1 parent 5323320 commit 2f5dbdb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 76 deletions.
3 changes: 0 additions & 3 deletions livekit-ffi/protocol/ffi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ message FfiRequest {
SetLocalAttributesRequest update_local_attributes = 11;
GetSessionStatsRequest get_session_stats = 12;
PublishTranscriptionRequest publish_transcription = 13;
GetRoomSidRequest get_room_sid = 14;

// Track
CreateVideoTrackRequest create_video_track = 15;
Expand Down Expand Up @@ -108,7 +107,6 @@ message FfiResponse {
SetLocalAttributesResponse update_local_attributes = 11;
GetSessionStatsResponse get_session_stats = 12;
PublishTranscriptionResponse publish_transcription = 13;
GetRoomSidResponse get_room_sid = 14;

// Track
CreateVideoTrackResponse create_video_track = 15;
Expand Down Expand Up @@ -141,7 +139,6 @@ message FfiEvent {
VideoStreamEvent video_stream_event = 3;
AudioStreamEvent audio_stream_event = 4;
ConnectCallback connect = 5;
GetRoomSidCallback get_room_sid = 6;
DisconnectCallback disconnect = 7;
DisposeCallback dispose = 8;
PublishTrackCallback publish_track = 9;
Expand Down
16 changes: 0 additions & 16 deletions livekit-ffi/protocol/room.proto
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,6 @@ message ConnectCallback {
repeated ParticipantWithTracks participants = 5;
}

// Get Room Sid

message GetRoomSidRequest {
uint64 room_handle = 1;
}

message GetRoomSidResponse {
uint64 async_id = 1;
}

message GetRoomSidCallback {
uint64 async_id = 1;
string sid = 2;
optional string error = 3;
}

// Disconnect from the a room
message DisconnectRequest { uint64 room_handle = 1; }
message DisconnectResponse { uint64 async_id = 1; }
Expand Down
36 changes: 3 additions & 33 deletions livekit-ffi/src/livekit.proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1940,30 +1940,6 @@ pub mod connect_callback {
pub publications: ::prost::alloc::vec::Vec<super::OwnedTrackPublication>,
}
}
// Get Room Sid

#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetRoomSidRequest {
#[prost(uint64, tag="1")]
pub room_handle: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetRoomSidResponse {
#[prost(uint64, tag="1")]
pub async_id: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetRoomSidCallback {
#[prost(uint64, tag="1")]
pub async_id: u64,
#[prost(string, tag="2")]
pub sid: ::prost::alloc::string::String,
#[prost(string, optional, tag="3")]
pub error: ::core::option::Option<::prost::alloc::string::String>,
}
/// Disconnect from the a room
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down Expand Up @@ -3043,7 +3019,7 @@ impl AudioSourceType {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FfiRequest {
#[prost(oneof="ffi_request::Message", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28")]
#[prost(oneof="ffi_request::Message", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28")]
pub message: ::core::option::Option<ffi_request::Message>,
}
/// Nested message and enum types in `FfiRequest`.
Expand Down Expand Up @@ -3076,8 +3052,6 @@ pub mod ffi_request {
GetSessionStats(super::GetSessionStatsRequest),
#[prost(message, tag="13")]
PublishTranscription(super::PublishTranscriptionRequest),
#[prost(message, tag="14")]
GetRoomSid(super::GetRoomSidRequest),
/// Track
#[prost(message, tag="15")]
CreateVideoTrack(super::CreateVideoTrackRequest),
Expand Down Expand Up @@ -3113,7 +3087,7 @@ pub mod ffi_request {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FfiResponse {
#[prost(oneof="ffi_response::Message", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27")]
#[prost(oneof="ffi_response::Message", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27")]
pub message: ::core::option::Option<ffi_response::Message>,
}
/// Nested message and enum types in `FfiResponse`.
Expand Down Expand Up @@ -3146,8 +3120,6 @@ pub mod ffi_response {
GetSessionStats(super::GetSessionStatsResponse),
#[prost(message, tag="13")]
PublishTranscription(super::PublishTranscriptionResponse),
#[prost(message, tag="14")]
GetRoomSid(super::GetRoomSidResponse),
/// Track
#[prost(message, tag="15")]
CreateVideoTrack(super::CreateVideoTrackResponse),
Expand Down Expand Up @@ -3185,7 +3157,7 @@ pub mod ffi_response {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FfiEvent {
#[prost(oneof="ffi_event::Message", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20")]
#[prost(oneof="ffi_event::Message", tags="1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20")]
pub message: ::core::option::Option<ffi_event::Message>,
}
/// Nested message and enum types in `FfiEvent`.
Expand All @@ -3203,8 +3175,6 @@ pub mod ffi_event {
AudioStreamEvent(super::AudioStreamEvent),
#[prost(message, tag="5")]
Connect(super::ConnectCallback),
#[prost(message, tag="6")]
GetRoomSid(super::GetRoomSidCallback),
#[prost(message, tag="7")]
Disconnect(super::DisconnectCallback),
#[prost(message, tag="8")]
Expand Down
25 changes: 1 addition & 24 deletions livekit-ffi/src/server/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use livekit::{
use parking_lot::Mutex;

use super::{
audio_source, audio_stream, colorcvt, room::{self, FfiParticipant, FfiPublication, FfiRoom, FfiTrack},
audio_source, audio_stream, colorcvt, room::{self, FfiParticipant, FfiPublication, FfiTrack},
video_source, video_stream, FfiError, FfiResult, FfiServer,
};
use crate::proto;
Expand Down Expand Up @@ -53,26 +53,6 @@ fn on_connect(
Ok(room::FfiRoom::connect(server, connect))
}

/// Retrieve the room sid
fn on_room_sid(
server: &'static FfiServer,
req: proto::GetRoomSidRequest,
) -> FfiResult<proto::GetRoomSidResponse> {
let async_id = server.next_id();
let handle = server.async_runtime.spawn(async move {
let ffi_room = server
.retrieve_handle::<FfiRoom>(req.room_handle)
.unwrap()
.clone();
let sid = ffi_room.inner.room.sid().await;
let _ = server.send_event(proto::ffi_event::Message::GetRoomSid(
proto::GetRoomSidCallback { async_id, sid: sid.to_string(), error: None },
));
});

Ok(proto::GetRoomSidResponse { async_id })
}

/// Disconnect to a room
/// This is an async function, the FfiClient must wait for the DisconnectCallback
fn on_disconnect(
Expand Down Expand Up @@ -595,9 +575,6 @@ pub fn handle_request(
proto::ffi_request::Message::Connect(connect) => {
proto::ffi_response::Message::Connect(on_connect(server, connect)?)
}
proto::ffi_request::Message::GetRoomSid(req) => {
proto::ffi_response::Message::GetRoomSid(on_room_sid(server, req)?)
}
proto::ffi_request::Message::Disconnect(disconnect) => {
proto::ffi_response::Message::Disconnect(on_disconnect(server, disconnect)?)
}
Expand Down

0 comments on commit 2f5dbdb

Please sign in to comment.