Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: room eos #198

Merged
merged 2 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion livekit-ffi/protocol/room.proto
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ message RoomEvent {
Reconnecting reconnecting = 19;
Reconnected reconnected = 20;
E2eeStateChanged e2ee_state_changed = 21;
RoomEOS eos = 22; // The stream of room events has ended
}
}

Expand Down Expand Up @@ -302,4 +303,6 @@ message ConnectionStateChanged { ConnectionState state = 1; }
message Connected {}
message Disconnected {}
message Reconnecting {}
message Reconnected {}
message Reconnected {}

message RoomEOS {}
8 changes: 7 additions & 1 deletion livekit-ffi/src/livekit.proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,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, 18, 19, 20, 21")]
#[prost(oneof="room_event::Message", tags="2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 21, 22")]
pub message: ::core::option::Option<room_event::Message>,
}
/// Nested message and enum types in `RoomEvent`.
Expand Down Expand Up @@ -1316,6 +1316,8 @@ pub mod room_event {
Reconnected(super::Reconnected),
#[prost(message, tag="21")]
E2eeStateChanged(super::E2eeStateChanged),
#[prost(message, tag="22")]
Eos(super::RoomEos),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down Expand Up @@ -1479,6 +1481,10 @@ pub struct Reconnecting {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Reconnected {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RoomEos {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum IceTransportPolicy {
Expand Down
2 changes: 1 addition & 1 deletion livekit-ffi/src/server/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use super::{
audio_source, audio_stream, room, video_source, video_stream, FfiConfig, FfiError, FfiResult,
FfiServer,
};
use crate::proto::{self};
use crate::proto;
use livekit::prelude::*;
use livekit::webrtc::native::{audio_resampler, yuv_helper};
use livekit::webrtc::prelude::*;
Expand Down
7 changes: 7 additions & 0 deletions livekit-ffi/src/server/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,13 @@ async fn room_task(
}
};
}

let _ = server
.send_event(proto::ffi_event::Message::RoomEvent(proto::RoomEvent {
room_handle: inner.handle_id,
message: Some(proto::room_event::Message::Eos(proto::RoomEos {})),
}))
.await;
}

async fn forward_event(server: &'static FfiServer, inner: &Arc<RoomInner>, event: RoomEvent) {
Expand Down
Loading