From 2f5dbdbdee8ff590ac907c49f2cef2f658bcb90f Mon Sep 17 00:00:00 2001 From: Neil Dwyer Date: Mon, 15 Jul 2024 14:03:26 -0700 Subject: [PATCH] nits --- livekit-ffi/protocol/ffi.proto | 3 --- livekit-ffi/protocol/room.proto | 16 ------------- livekit-ffi/src/livekit.proto.rs | 36 +++--------------------------- livekit-ffi/src/server/requests.rs | 25 +-------------------- 4 files changed, 4 insertions(+), 76 deletions(-) diff --git a/livekit-ffi/protocol/ffi.proto b/livekit-ffi/protocol/ffi.proto index cf820d41..9fc45d81 100644 --- a/livekit-ffi/protocol/ffi.proto +++ b/livekit-ffi/protocol/ffi.proto @@ -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; @@ -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; @@ -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; diff --git a/livekit-ffi/protocol/room.proto b/livekit-ffi/protocol/room.proto index a7adcc57..cd347353 100644 --- a/livekit-ffi/protocol/room.proto +++ b/livekit-ffi/protocol/room.proto @@ -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; } diff --git a/livekit-ffi/src/livekit.proto.rs b/livekit-ffi/src/livekit.proto.rs index e5ef6086..5971ceff 100644 --- a/livekit-ffi/src/livekit.proto.rs +++ b/livekit-ffi/src/livekit.proto.rs @@ -1940,30 +1940,6 @@ pub mod connect_callback { pub publications: ::prost::alloc::vec::Vec, } } -// 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)] @@ -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, } /// Nested message and enum types in `FfiRequest`. @@ -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), @@ -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, } /// Nested message and enum types in `FfiResponse`. @@ -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), @@ -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, } /// Nested message and enum types in `FfiEvent`. @@ -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")] diff --git a/livekit-ffi/src/server/requests.rs b/livekit-ffi/src/server/requests.rs index 378ff2a0..4bb93397 100644 --- a/livekit-ffi/src/server/requests.rs +++ b/livekit-ffi/src/server/requests.rs @@ -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; @@ -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 { - let async_id = server.next_id(); - let handle = server.async_runtime.spawn(async move { - let ffi_room = server - .retrieve_handle::(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( @@ -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)?) }