finish proto of livekit-ffi (#36)
* ffi req * handle req_id * remaining room events * fix * Update ffi.proto * use sid instead of info * state -> stream_state * "s" * participant is optional on data received * add ReleaseHandleRequest * Update ffi.proto * add DataPacketKind * VideoSinkInfo * append info It looks nicer on the FFI languages * wip * keep it simple * Update ffi.proto * update server to latest proto * to_i420 * i420_to_abgr * to_argb * add publications to ParticipantInfo It'll be used when we join a Room * cleanup + DisposeRequest * fix compilation * send the whole buffer info with to_i420
This commit is contained in:
@@ -19,10 +19,13 @@ pub use crate::id::*;
|
||||
pub use crate::webrtc::{
|
||||
data_channel::DataChannel,
|
||||
media_stream::{
|
||||
AudioTrack, MediaStream, MediaStreamTrackHandle, MediaStreamTrackTrait, VideoTrack,
|
||||
AudioTrack, MediaStream, MediaStreamTrackHandle, MediaStreamTrackTrait,
|
||||
OnConstraintsChangedHandler, OnDiscardedFrameHandler, OnFrameHandler, VideoTrack,
|
||||
},
|
||||
rtp_receiver::RtpReceiver,
|
||||
rtp_transceiver::RtpTransceiver,
|
||||
video_frame::{VideoFrame, VideoRotation},
|
||||
video_frame_buffer::{VideoFrameBuffer, VideoFrameBufferTrait, VideoFrameBufferType},
|
||||
video_frame_buffer::{
|
||||
VideoFormatType, VideoFrameBuffer, VideoFrameBufferTrait, VideoFrameBufferType,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -55,12 +55,12 @@ pub enum RoomEvent {
|
||||
participant: Arc<RemoteParticipant>,
|
||||
},
|
||||
TrackMuted {
|
||||
publication: TrackPublication,
|
||||
participant: Participant,
|
||||
publication: TrackPublication,
|
||||
},
|
||||
TrackUnmuted {
|
||||
publication: TrackPublication,
|
||||
participant: Participant,
|
||||
publication: TrackPublication,
|
||||
},
|
||||
ActiveSpeakersChanged {
|
||||
speakers: Vec<Participant>,
|
||||
|
||||
@@ -19,8 +19,10 @@ pub trait TrackPublicationTrait {
|
||||
fn sid(&self) -> TrackSid;
|
||||
fn kind(&self) -> TrackKind;
|
||||
fn source(&self) -> TrackSource;
|
||||
fn muted(&self) -> bool;
|
||||
fn simulcasted(&self) -> bool;
|
||||
fn dimension(&self) -> TrackDimension;
|
||||
fn mime_type(&self) -> String;
|
||||
fn muted(&self) -> bool;
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -164,8 +166,10 @@ impl TrackPublicationTrait for TrackPublication {
|
||||
fnc!(name, &Self, [], String);
|
||||
fnc!(kind, &Self, [], TrackKind);
|
||||
fnc!(source, &Self, [], TrackSource);
|
||||
fnc!(muted, &Self, [], bool);
|
||||
fnc!(simulcasted, &Self, [], bool);
|
||||
fnc!(dimension, &Self, [], TrackDimension);
|
||||
fnc!(mime_type, &Self, [], String);
|
||||
fnc!(muted, &Self, [], bool);
|
||||
);
|
||||
}
|
||||
|
||||
@@ -192,6 +196,14 @@ macro_rules! impl_publication_trait {
|
||||
self.shared.simulcasted.load(Ordering::SeqCst)
|
||||
}
|
||||
|
||||
fn dimension(&self) -> TrackDimension {
|
||||
self.shared.dimension.lock().clone()
|
||||
}
|
||||
|
||||
fn mime_type(&self) -> String {
|
||||
self.shared.mime_type.lock().clone()
|
||||
}
|
||||
|
||||
fn muted(&self) -> bool {
|
||||
self.shared.muted.load(Ordering::SeqCst)
|
||||
}
|
||||
|
||||
@@ -37,8 +37,9 @@ impl From<u8> for ConnectionState {
|
||||
#[derive(Debug)]
|
||||
struct SessionInner {
|
||||
state: AtomicU8, // ConnectionState
|
||||
sid: Mutex<String>,
|
||||
sid: Mutex<RoomSid>,
|
||||
name: Mutex<String>,
|
||||
metadata: Mutex<String>,
|
||||
participants: RwLock<HashMap<ParticipantSid, Arc<RemoteParticipant>>>,
|
||||
participants_tasks: RwLock<HashMap<ParticipantSid, (JoinHandle<()>, oneshot::Sender<()>)>>,
|
||||
active_speakers: RwLock<Vec<Participant>>,
|
||||
@@ -82,8 +83,9 @@ impl SessionHandle {
|
||||
let room_info = join_response.room.unwrap();
|
||||
let inner = Arc::new(SessionInner {
|
||||
state: AtomicU8::new(ConnectionState::Disconnected as u8),
|
||||
sid: Mutex::new(room_info.sid),
|
||||
sid: Mutex::new(room_info.sid.into()),
|
||||
name: Mutex::new(room_info.name),
|
||||
metadata: Mutex::new(room_info.metadata),
|
||||
participants: Default::default(),
|
||||
participants_tasks: Default::default(),
|
||||
active_speakers: Default::default(),
|
||||
@@ -133,7 +135,7 @@ impl RoomSession {
|
||||
Self { inner }
|
||||
}
|
||||
|
||||
pub fn sid(&self) -> String {
|
||||
pub fn sid(&self) -> RoomSid {
|
||||
self.inner.sid.lock().clone()
|
||||
}
|
||||
|
||||
@@ -141,6 +143,10 @@ impl RoomSession {
|
||||
self.inner.name.lock().clone()
|
||||
}
|
||||
|
||||
pub fn metadata(&self) -> String {
|
||||
self.inner.metadata.lock().clone()
|
||||
}
|
||||
|
||||
pub fn local_participant(&self) -> Arc<LocalParticipant> {
|
||||
self.inner.local_participant.clone()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user