feat: add publishing & audio to ffi (#46)
- Divide FFI protocol into multiple files
- Audio support
- AV Streams/Sources
- Create tracks
- Use Dashmap to store handles
- Add a capture test
- Ignored by GHA atm
This commit is contained in:
@@ -42,7 +42,7 @@ impl LocalParticipant {
|
||||
cid: track.rtc_track().id(),
|
||||
name: options.name.clone(),
|
||||
r#type: proto::TrackType::from(track.kind()) as i32,
|
||||
muted: track.muted(),
|
||||
muted: track.is_muted(),
|
||||
source: proto::TrackSource::from(options.source) as i32,
|
||||
disable_dtx: !options.dtx,
|
||||
disable_red: !options.red,
|
||||
|
||||
@@ -105,7 +105,7 @@ impl RemoteParticipant {
|
||||
debug!("starting track: {:?}", sid);
|
||||
|
||||
remote_publication.update_track(Some(track.clone().into()));
|
||||
track.set_muted(remote_publication.muted());
|
||||
track.set_muted(remote_publication.is_muted());
|
||||
track.update_info(proto::TrackInfo {
|
||||
sid: remote_publication.sid().to_string(),
|
||||
name: remote_publication.name().to_string(),
|
||||
|
||||
@@ -75,8 +75,13 @@ impl LocalTrackPublication {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn muted(&self) -> bool {
|
||||
self.inner.publication_inner.muted()
|
||||
pub fn is_muted(&self) -> bool {
|
||||
self.inner.publication_inner.is_muted()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_remote(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
@@ -132,7 +132,7 @@ impl TrackPublicationInner {
|
||||
self.track.lock().clone()
|
||||
}
|
||||
|
||||
pub fn muted(&self) -> bool {
|
||||
pub fn is_muted(&self) -> bool {
|
||||
self.muted.load(Ordering::Relaxed)
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,8 @@ impl TrackPublication {
|
||||
pub fn simulcasted(self: &Self) -> bool;
|
||||
pub fn dimension(self: &Self) -> TrackDimension;
|
||||
pub fn mime_type(self: &Self) -> String;
|
||||
pub fn muted(self: &Self) -> bool;
|
||||
pub fn is_muted(self: &Self) -> bool;
|
||||
pub fn is_remote(self: &Self) -> bool;
|
||||
);
|
||||
|
||||
pub fn track(&self) -> Option<Track> {
|
||||
|
||||
@@ -57,8 +57,13 @@ impl RemoteTrackPublication {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn muted(&self) -> bool {
|
||||
self.inner.muted()
|
||||
pub fn is_muted(&self) -> bool {
|
||||
self.inner.is_muted()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_remote(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
@@ -81,8 +81,8 @@ impl LocalAudioTrack {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn muted(&self) -> bool {
|
||||
self.inner.track_inner.muted()
|
||||
pub fn is_muted(&self) -> bool {
|
||||
self.inner.track_inner.is_muted()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -106,6 +106,11 @@ impl LocalAudioTrack {
|
||||
self.inner.track_inner.register_observer()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_remote(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn transceiver(&self) -> Option<rtc::rtp_transceiver::RtpTransceiver> {
|
||||
self.inner.track_inner.transceiver()
|
||||
|
||||
@@ -80,8 +80,8 @@ impl LocalVideoTrack {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn muted(&self) -> bool {
|
||||
self.inner.track_inner.muted()
|
||||
pub fn is_muted(&self) -> bool {
|
||||
self.inner.track_inner.is_muted()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -106,7 +106,12 @@ impl LocalVideoTrack {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn transceiver(&self) -> Option<rtc::rtp_transceiver::RtpTransceiver> {
|
||||
pub fn is_remote(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn transceiver(&self) -> Option<rtc::rtp_transceiver::RtpTransceiver> {
|
||||
self.inner.track_inner.transceiver()
|
||||
}
|
||||
|
||||
|
||||
@@ -98,9 +98,10 @@ macro_rules! track_dispatch {
|
||||
pub fn stream_state(self: &Self) -> StreamState;
|
||||
pub fn start(self: &Self) -> ();
|
||||
pub fn stop(self: &Self) -> ();
|
||||
pub fn muted(self: &Self) -> bool;
|
||||
pub fn is_muted(self: &Self) -> bool;
|
||||
pub fn set_muted(self: &Self, muted: bool) -> ();
|
||||
pub fn register_observer(self: &Self) -> mpsc::UnboundedReceiver<TrackEvent>;
|
||||
pub fn is_remote(self: &Self) -> bool;
|
||||
|
||||
pub(crate) fn transceiver(self: &Self) -> Option<rtc::rtp_transceiver::RtpTransceiver>;
|
||||
pub(crate) fn update_transceiver(self: &Self, transceiver: Option<rtc::rtp_transceiver::RtpTransceiver>) -> ();
|
||||
@@ -224,7 +225,7 @@ impl TrackInner {
|
||||
self.stream_state.load(Ordering::SeqCst).try_into().unwrap()
|
||||
}
|
||||
|
||||
pub fn muted(&self) -> bool {
|
||||
pub fn is_muted(&self) -> bool {
|
||||
self.muted.load(Ordering::SeqCst)
|
||||
}
|
||||
|
||||
|
||||
@@ -62,8 +62,8 @@ impl RemoteAudioTrack {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn muted(&self) -> bool {
|
||||
self.inner.muted()
|
||||
pub fn is_muted(&self) -> bool {
|
||||
self.inner.is_muted()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -85,6 +85,11 @@ impl RemoteAudioTrack {
|
||||
self.inner.register_observer()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_remote(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn transceiver(&self) -> Option<rtc::rtp_transceiver::RtpTransceiver> {
|
||||
self.inner.transceiver()
|
||||
|
||||
@@ -62,8 +62,8 @@ impl RemoteVideoTrack {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn muted(&self) -> bool {
|
||||
self.inner.muted()
|
||||
pub fn is_muted(&self) -> bool {
|
||||
self.inner.is_muted()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -85,6 +85,11 @@ impl RemoteVideoTrack {
|
||||
self.inner.register_observer()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_remote(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn transceiver(&self) -> Option<rtc::rtp_transceiver::RtpTransceiver> {
|
||||
self.inner.transceiver()
|
||||
|
||||
Reference in New Issue
Block a user