From fb935659f37453a5a8a9cd32c34e057e72eb0feb Mon Sep 17 00:00:00 2001 From: Daisuke Murase Date: Mon, 13 Jan 2025 15:22:29 -0800 Subject: [PATCH] add callback --- livekit-ffi/protocol/ffi.proto | 1 + livekit-ffi/protocol/room.proto | 4 ++++ livekit-ffi/src/livekit.proto.rs | 10 +++++++++- livekit-ffi/src/server/room.rs | 3 +++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/livekit-ffi/protocol/ffi.proto b/livekit-ffi/protocol/ffi.proto index 29a7712b..c022eba5 100644 --- a/livekit-ffi/protocol/ffi.proto +++ b/livekit-ffi/protocol/ffi.proto @@ -215,6 +215,7 @@ message FfiEvent { RpcMethodInvocationEvent rpc_method_invocation = 24; SendStreamHeaderCallback send_stream_header = 25; SendStreamChunkCallback send_stream_chunk = 26; + SetDataChannelBufferedAmountLowThresholdCallback set_data_channel_buffered_amount_low_threshold = 27; } } diff --git a/livekit-ffi/protocol/room.proto b/livekit-ffi/protocol/room.proto index c9722daa..47f60e59 100644 --- a/livekit-ffi/protocol/room.proto +++ b/livekit-ffi/protocol/room.proto @@ -629,3 +629,7 @@ message SetDataChannelBufferedAmountLowThresholdRequest { message SetDataChannelBufferedAmountLowThresholdResponse { required uint64 async_id = 1; } + +message SetDataChannelBufferedAmountLowThresholdCallback { + required uint64 async_id = 1; +} diff --git a/livekit-ffi/src/livekit.proto.rs b/livekit-ffi/src/livekit.proto.rs index b509ded0..9f23fd97 100644 --- a/livekit-ffi/src/livekit.proto.rs +++ b/livekit-ffi/src/livekit.proto.rs @@ -3185,6 +3185,12 @@ pub struct SetDataChannelBufferedAmountLowThresholdResponse { #[prost(uint64, required, tag="1")] pub async_id: u64, } +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetDataChannelBufferedAmountLowThresholdCallback { + #[prost(uint64, required, tag="1")] + pub async_id: u64, +} #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum IceTransportType { @@ -4181,7 +4187,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, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26")] + #[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, 21, 22, 23, 24, 25, 26, 27")] pub message: ::core::option::Option, } /// Nested message and enum types in `FfiEvent`. @@ -4239,6 +4245,8 @@ pub mod ffi_event { SendStreamHeader(super::SendStreamHeaderCallback), #[prost(message, tag="26")] SendStreamChunk(super::SendStreamChunkCallback), + #[prost(message, tag="27")] + SetDataChannelBufferedAmountLowThreshold(super::SetDataChannelBufferedAmountLowThresholdCallback), } } /// Stop all rooms synchronously (Do we need async here?). diff --git a/livekit-ffi/src/server/room.rs b/livekit-ffi/src/server/room.rs index 4ae02b82..acf9c64b 100644 --- a/livekit-ffi/src/server/room.rs +++ b/livekit-ffi/src/server/room.rs @@ -762,6 +762,9 @@ impl RoomInner { set_data_channel_buffered_amount_low_threshold.threshold, ) .await; + let _ = server.send_event(proto::ffi_event::Message::SetDataChannelBufferedAmountLowThreshold( + proto::SetDataChannelBufferedAmountLowThresholdCallback { async_id } + )); }); server.watch_panic(handle); proto::SetDataChannelBufferedAmountLowThresholdResponse { async_id }