Skip to content

Commit

Permalink
Deprecated DataReceived event.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennwc committed Apr 9, 2024
1 parent ffab38b commit 2c7f633
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 36 deletions.
8 changes: 0 additions & 8 deletions livekit-ffi/protocol/room.proto
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ message RoomEvent {
ParticipantMetadataChanged participant_metadata_changed = 15;
ParticipantNameChanged participant_name_changed = 16;
ConnectionQualityChanged connection_quality_changed = 17;
DataReceived data_received = 18;
ConnectionStateChanged connection_state_changed = 19;
// Connected connected = 20;
Disconnected disconnected = 21;
Expand Down Expand Up @@ -356,13 +355,6 @@ message ConnectionQualityChanged {
ConnectionQuality quality = 2;
}

message DataReceived {
OwnedBuffer data = 1;
optional string participant_sid = 2; // Can be empty if the data is sent a server SDK
DataPacketKind kind = 3;
optional string topic = 4;
}

message UserPacket {
OwnedBuffer data = 1;
optional string topic = 2;
Expand Down
17 changes: 1 addition & 16 deletions livekit-ffi/src/livekit.proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2215,7 +2215,7 @@ pub struct OwnedBuffer {
pub struct RoomEvent {
#[prost(uint64, tag="1")]
pub room_handle: u64,
#[prost(oneof="room_event::Message", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26")]
#[prost(oneof="room_event::Message", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, 22, 23, 24, 25, 26")]
pub message: ::core::option::Option<room_event::Message>,
}
/// Nested message and enum types in `RoomEvent`.
Expand Down Expand Up @@ -2255,8 +2255,6 @@ pub mod room_event {
ParticipantNameChanged(super::ParticipantNameChanged),
#[prost(message, tag="17")]
ConnectionQualityChanged(super::ConnectionQualityChanged),
#[prost(message, tag="18")]
DataReceived(super::DataReceived),
#[prost(message, tag="19")]
ConnectionStateChanged(super::ConnectionStateChanged),
/// Connected connected = 20;
Expand Down Expand Up @@ -2427,19 +2425,6 @@ pub struct ConnectionQualityChanged {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DataReceived {
#[prost(message, optional, tag="1")]
pub data: ::core::option::Option<OwnedBuffer>,
/// Can be empty if the data is sent a server SDK
#[prost(string, optional, tag="2")]
pub participant_sid: ::core::option::Option<::prost::alloc::string::String>,
#[prost(enumeration="DataPacketKind", tag="3")]
pub kind: i32,
#[prost(string, optional, tag="4")]
pub topic: ::core::option::Option<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserPacket {
#[prost(message, optional, tag="1")]
pub data: ::core::option::Option<OwnedBuffer>,
Expand Down
15 changes: 3 additions & 12 deletions livekit-ffi/src/server/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,27 +652,18 @@ async fn forward_event(
};

server.store_handle(handle_id, FfiDataBuffer { handle: handle_id, data: payload });
let _ = send_event(proto::room_event::Message::DataReceived(proto::DataReceived {
data: Some(proto::OwnedBuffer {
handle: Some(proto::FfiOwnedHandle { id: handle_id }),
data: Some(buffer_info.clone()),
}),
participant_sid: sid.clone(),
kind: proto::DataPacketKind::from(kind).into(),
topic: topic.clone(),
}));
let _ = send_event(proto::room_event::Message::DataPacketReceived(proto::DataPacketReceived {
value: Some(proto::data_packet_received::Value::User(
proto::UserPacket{
data: Some(proto::OwnedBuffer {
handle: Some(proto::FfiOwnedHandle { id: handle_id }),
data: Some(buffer_info.clone()),
data: Some(buffer_info),
}),
topic: topic.clone(),
topic,
}
)),
participant_identity: identity,
participant_sid: sid.clone(),
participant_sid: sid,
kind: proto::DataPacketKind::from(kind).into(),
}));
}
Expand Down

0 comments on commit 2c7f633

Please sign in to comment.