Skip to content

Commit

Permalink
flatten DataChannelOptions in protobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
typester committed Jan 16, 2025
1 parent 1a42a4f commit 6c73254
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 24 deletions.
8 changes: 2 additions & 6 deletions livekit-ffi/protocol/room.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 2 additions & 8 deletions livekit-ffi/src/conversion/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<livekit::DataChannelOptions> for proto::DataChannelOptions {
fn from(value: livekit::DataChannelOptions) -> Self {
Self { buffered_amount_low_threshold: value.buffered_amount_low_threshold }
}
}

impl From<proto::ChatMessage> for livekit::ChatMessage {
fn from(proto_msg: proto::ChatMessage) -> Self {
livekit::ChatMessage {
Expand Down
14 changes: 4 additions & 10 deletions livekit-ffi/src/livekit.proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 6c73254

Please sign in to comment.