diff --git a/livekit-ffi/protocol/ffi.proto b/livekit-ffi/protocol/ffi.proto index ec20d0d9..cc41177e 100644 --- a/livekit-ffi/protocol/ffi.proto +++ b/livekit-ffi/protocol/ffi.proto @@ -63,9 +63,9 @@ message FfiRequest { UnpublishTrackRequest unpublish_track = 6; PublishDataRequest publish_data = 7; SetSubscribedRequest set_subscribed = 8; - SetLocalMetadataRequest update_local_metadata = 9; - SetLocalNameRequest update_local_name = 10; - SetLocalAttributesRequest update_local_attributes = 11; + SetLocalMetadataRequest set_local_metadata = 9; + SetLocalNameRequest set_local_name = 10; + SetLocalAttributesRequest set_local_attributes = 11; GetSessionStatsRequest get_session_stats = 12; PublishTranscriptionRequest publish_transcription = 13; @@ -146,9 +146,9 @@ message FfiEvent { PublishDataCallback publish_data = 11; PublishTranscriptionCallback publish_transcription = 12; CaptureAudioFrameCallback capture_audio_frame = 13; - SetLocalMetadataCallback update_local_metadata = 14; - SetLocalNameCallback update_local_name = 15; - SetLocalAttributesCallback update_local_attributes = 16; + SetLocalMetadataCallback set_local_metadata = 14; + SetLocalNameCallback set_local_name = 15; + SetLocalAttributesCallback set_local_attributes = 16; GetStatsCallback get_stats = 17; LogBatch logs = 18; GetSessionStatsCallback get_session_stats = 19; diff --git a/livekit-ffi/src/livekit.proto.rs b/livekit-ffi/src/livekit.proto.rs index 221f715a..c754b682 100644 --- a/livekit-ffi/src/livekit.proto.rs +++ b/livekit-ffi/src/livekit.proto.rs @@ -3043,11 +3043,11 @@ pub mod ffi_request { #[prost(message, tag="8")] SetSubscribed(super::SetSubscribedRequest), #[prost(message, tag="9")] - UpdateLocalMetadata(super::SetLocalMetadataRequest), + SetLocalMetadata(super::SetLocalMetadataRequest), #[prost(message, tag="10")] - UpdateLocalName(super::SetLocalNameRequest), + SetLocalName(super::SetLocalNameRequest), #[prost(message, tag="11")] - UpdateLocalAttributes(super::SetLocalAttributesRequest), + SetLocalAttributes(super::SetLocalAttributesRequest), #[prost(message, tag="12")] GetSessionStats(super::GetSessionStatsRequest), #[prost(message, tag="13")] @@ -3190,11 +3190,11 @@ pub mod ffi_event { #[prost(message, tag="13")] CaptureAudioFrame(super::CaptureAudioFrameCallback), #[prost(message, tag="14")] - UpdateLocalMetadata(super::SetLocalMetadataCallback), + SetLocalMetadata(super::SetLocalMetadataCallback), #[prost(message, tag="15")] - UpdateLocalName(super::SetLocalNameCallback), + SetLocalName(super::SetLocalNameCallback), #[prost(message, tag="16")] - UpdateLocalAttributes(super::SetLocalAttributesCallback), + SetLocalAttributes(super::SetLocalAttributesCallback), #[prost(message, tag="17")] GetStats(super::GetStatsCallback), #[prost(message, tag="18")] diff --git a/livekit-ffi/src/server/requests.rs b/livekit-ffi/src/server/requests.rs index 4990ee87..3de73d0f 100644 --- a/livekit-ffi/src/server/requests.rs +++ b/livekit-ffi/src/server/requests.rs @@ -140,35 +140,34 @@ fn on_set_subscribed( fn on_set_local_metadata( server: &'static FfiServer, - update_local_metadata: proto::SetLocalMetadataRequest, + set_local_metadata: proto::SetLocalMetadataRequest, ) -> FfiResult { let ffi_participant = server - .retrieve_handle::(update_local_metadata.local_participant_handle)? + .retrieve_handle::(set_local_metadata.local_participant_handle)? .clone(); - Ok(ffi_participant.room.update_local_metadata(server, update_local_metadata)) + Ok(ffi_participant.room.set_local_metadata(server, set_local_metadata)) } fn on_set_local_name( server: &'static FfiServer, - update_local_name: proto::SetLocalNameRequest, + set_local_name: proto::SetLocalNameRequest, ) -> FfiResult { - let ffi_participant = server - .retrieve_handle::(update_local_name.local_participant_handle)? - .clone(); + let ffi_participant = + server.retrieve_handle::(set_local_name.local_participant_handle)?.clone(); - Ok(ffi_participant.room.update_local_name(server, update_local_name)) + Ok(ffi_participant.room.set_local_name(server, set_local_name)) } fn on_set_local_attributes( server: &'static FfiServer, - update_local_attributes: proto::SetLocalAttributesRequest, + set_local_attributes: proto::SetLocalAttributesRequest, ) -> FfiResult { let ffi_participant = server - .retrieve_handle::(update_local_attributes.local_participant_handle)? + .retrieve_handle::(set_local_attributes.local_participant_handle)? .clone(); - Ok(ffi_participant.room.update_local_attributes(server, update_local_attributes)) + Ok(ffi_participant.room.set_local_attributes(server, set_local_attributes)) } /// Create a new video track from a source @@ -596,13 +595,13 @@ pub fn handle_request( proto::ffi_request::Message::SetSubscribed(subscribed) => { proto::ffi_response::Message::SetSubscribed(on_set_subscribed(server, subscribed)?) } - proto::ffi_request::Message::UpdateLocalMetadata(u) => { + proto::ffi_request::Message::SetLocalMetadata(u) => { proto::ffi_response::Message::SetLocalMetadata(on_set_local_metadata(server, u)?) } - proto::ffi_request::Message::UpdateLocalName(update) => { + proto::ffi_request::Message::SetLocalName(update) => { proto::ffi_response::Message::SetLocalName(on_set_local_name(server, update)?) } - proto::ffi_request::Message::UpdateLocalAttributes(update) => { + proto::ffi_request::Message::SetLocalAttributes(update) => { proto::ffi_response::Message::SetLocalAttributes(on_set_local_attributes( server, update, )?) diff --git a/livekit-ffi/src/server/room.rs b/livekit-ffi/src/server/room.rs index 5b65038e..4f7aefd0 100644 --- a/livekit-ffi/src/server/room.rs +++ b/livekit-ffi/src/server/room.rs @@ -426,18 +426,18 @@ impl RoomInner { proto::UnpublishTrackResponse { async_id } } - pub fn update_local_metadata( + pub fn set_local_metadata( self: &Arc, server: &'static FfiServer, - update_local_metadata: proto::SetLocalMetadataRequest, + set_local_metadata: proto::SetLocalMetadataRequest, ) -> proto::SetLocalMetadataResponse { let async_id = server.next_id(); let inner = self.clone(); let handle = server.async_runtime.spawn(async move { let res = - inner.room.local_participant().set_metadata(update_local_metadata.metadata).await; + inner.room.local_participant().set_metadata(set_local_metadata.metadata).await; - let _ = server.send_event(proto::ffi_event::Message::UpdateLocalMetadata( + let _ = server.send_event(proto::ffi_event::Message::SetLocalMetadata( proto::SetLocalMetadataCallback { async_id, error: res.err().map(|e| e.to_string()), @@ -448,17 +448,17 @@ impl RoomInner { proto::SetLocalMetadataResponse { async_id } } - pub fn update_local_name( + pub fn set_local_name( self: &Arc, server: &'static FfiServer, - update_local_name: proto::SetLocalNameRequest, + set_local_name: proto::SetLocalNameRequest, ) -> proto::SetLocalNameResponse { let async_id = server.next_id(); let inner = self.clone(); let handle = server.async_runtime.spawn(async move { - let res = inner.room.local_participant().set_name(update_local_name.name).await; + let res = inner.room.local_participant().set_name(set_local_name.name).await; - let _ = server.send_event(proto::ffi_event::Message::UpdateLocalName( + let _ = server.send_event(proto::ffi_event::Message::SetLocalName( proto::SetLocalNameCallback { async_id, error: res.err().map(|e| e.to_string()) }, )); }); @@ -466,10 +466,10 @@ impl RoomInner { proto::SetLocalNameResponse { async_id } } - pub fn update_local_attributes( + pub fn set_local_attributes( self: &Arc, server: &'static FfiServer, - update_local_attributes: proto::SetLocalAttributesRequest, + set_local_attributes: proto::SetLocalAttributesRequest, ) -> proto::SetLocalAttributesResponse { let async_id = server.next_id(); let inner = self.clone(); @@ -477,10 +477,10 @@ impl RoomInner { let res = inner .room .local_participant() - .set_attributes(update_local_attributes.attributes) + .set_attributes(set_local_attributes.attributes) .await; - let _ = server.send_event(proto::ffi_event::Message::UpdateLocalAttributes( + let _ = server.send_event(proto::ffi_event::Message::SetLocalAttributes( proto::SetLocalAttributesCallback { async_id, error: res.err().map(|e| e.to_string()),