From 6c73254289f9131cc8b931f2f0cdb87f4e2f9bec Mon Sep 17 00:00:00 2001 From: Daisuke Murase Date: Thu, 16 Jan 2025 13:57:54 -0800 Subject: [PATCH] flatten DataChannelOptions in protobuf --- livekit-ffi/protocol/room.proto | 8 ++------ livekit-ffi/src/conversion/room.rs | 10 ++-------- livekit-ffi/src/livekit.proto.rs | 14 ++++---------- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/livekit-ffi/protocol/room.proto b/livekit-ffi/protocol/room.proto index 94335a4c..7b9f5ca4 100644 --- a/livekit-ffi/protocol/room.proto +++ b/livekit-ffi/protocol/room.proto @@ -377,12 +377,8 @@ message RoomInfo { optional string sid = 1; required string name = 2; required string metadata = 3; - required DataChannelOptions lossy_dc_options = 4; - required DataChannelOptions reliable_dc_options = 5; -} - -message DataChannelOptions { - required uint64 buffered_amount_low_threshold = 1; + required uint64 lossy_dc_buffered_amount_low_threshold = 4; + required uint64 reliable_dc_buffered_amount_low_threshold = 5; } message OwnedRoom { diff --git a/livekit-ffi/src/conversion/room.rs b/livekit-ffi/src/conversion/room.rs index 38626f3a..08a85825 100644 --- a/livekit-ffi/src/conversion/room.rs +++ b/livekit-ffi/src/conversion/room.rs @@ -252,18 +252,12 @@ impl From<&FfiRoom> for proto::RoomInfo { sid: room.maybe_sid().map(|x| x.to_string()), name: room.name(), metadata: room.metadata(), - lossy_dc_options: room.data_channel_options(DataPacketKind::Lossy).into(), - reliable_dc_options: room.data_channel_options(DataPacketKind::Reliable).into(), + lossy_dc_buffered_amount_low_threshold: room.data_channel_options(DataPacketKind::Lossy).buffered_amount_low_threshold, + reliable_dc_buffered_amount_low_threshold: room.data_channel_options(DataPacketKind::Reliable).buffered_amount_low_threshold, } } } -impl From for proto::DataChannelOptions { - fn from(value: livekit::DataChannelOptions) -> Self { - Self { buffered_amount_low_threshold: value.buffered_amount_low_threshold } - } -} - impl From for livekit::ChatMessage { fn from(proto_msg: proto::ChatMessage) -> Self { livekit::ChatMessage { diff --git a/livekit-ffi/src/livekit.proto.rs b/livekit-ffi/src/livekit.proto.rs index ace43567..ec9e8dae 100644 --- a/livekit-ffi/src/livekit.proto.rs +++ b/livekit-ffi/src/livekit.proto.rs @@ -2717,16 +2717,10 @@ pub struct RoomInfo { pub name: ::prost::alloc::string::String, #[prost(string, required, tag="3")] pub metadata: ::prost::alloc::string::String, - #[prost(message, required, tag="4")] - pub lossy_dc_options: DataChannelOptions, - #[prost(message, required, tag="5")] - pub reliable_dc_options: DataChannelOptions, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct DataChannelOptions { - #[prost(uint64, required, tag="1")] - pub buffered_amount_low_threshold: u64, + #[prost(uint64, required, tag="4")] + pub lossy_dc_buffered_amount_low_threshold: u64, + #[prost(uint64, required, tag="5")] + pub reliable_dc_buffered_amount_low_threshold: u64, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)]