This commit is contained in:
Antonio Scandurra 2023-10-26 16:40:44 +02:00
parent 98d03f6e7a
commit 637cff3ebd
22 changed files with 206 additions and 267 deletions

View file

@ -61,7 +61,7 @@ fn main() {
let mut audio_track_updates = room_b.remote_audio_track_updates();
let audio_track = LocalAudioTrack::create();
let audio_track_publication = room_a.publish_audio_track(&audio_track).await.unwrap();
let audio_track_publication = room_a.publish_audio_track(audio_track).await.unwrap();
if let RemoteAudioTrackUpdate::Subscribed(track, _) =
audio_track_updates.next().await.unwrap()
@ -132,10 +132,8 @@ fn main() {
let display = displays.into_iter().next().unwrap();
let local_video_track = LocalVideoTrack::screen_share_for_display(&display);
let local_video_track_publication = room_a
.publish_video_track(&local_video_track)
.await
.unwrap();
let local_video_track_publication =
room_a.publish_video_track(local_video_track).await.unwrap();
if let RemoteVideoTrackUpdate::Subscribed(track) =
video_track_updates.next().await.unwrap()

View file

@ -229,7 +229,7 @@ impl Room {
pub fn publish_video_track(
self: &Arc<Self>,
track: &LocalVideoTrack,
track: LocalVideoTrack,
) -> impl Future<Output = Result<LocalTrackPublication>> {
let (tx, rx) = oneshot::channel::<Result<LocalTrackPublication>>();
extern "C" fn callback(tx: *mut c_void, publication: *mut c_void, error: CFStringRef) {
@ -255,7 +255,7 @@ impl Room {
pub fn publish_audio_track(
self: &Arc<Self>,
track: &LocalAudioTrack,
track: LocalAudioTrack,
) -> impl Future<Output = Result<LocalTrackPublication>> {
let (tx, rx) = oneshot::channel::<Result<LocalTrackPublication>>();
extern "C" fn callback(tx: *mut c_void, publication: *mut c_void, error: CFStringRef) {
@ -622,8 +622,6 @@ impl Drop for RoomDelegate {
pub struct LocalAudioTrack(*const c_void);
unsafe impl Send for LocalAudioTrack {}
// todo!(Sync is not ok here. We need to remove it)
unsafe impl Sync for LocalAudioTrack {}
impl LocalAudioTrack {
pub fn create() -> Self {
@ -639,8 +637,6 @@ impl Drop for LocalAudioTrack {
pub struct LocalVideoTrack(*const c_void);
unsafe impl Send for LocalVideoTrack {}
// todo!(Sync is not ok here. We need to remove it)
unsafe impl Sync for LocalVideoTrack {}
impl LocalVideoTrack {
pub fn screen_share_for_display(display: &MacOSDisplay) -> Self {
@ -656,8 +652,6 @@ impl Drop for LocalVideoTrack {
pub struct LocalTrackPublication(*const c_void);
unsafe impl Send for LocalTrackPublication {}
// todo!(Sync is not ok here. We need to remove it)
unsafe impl Sync for LocalTrackPublication {}
impl LocalTrackPublication {
pub fn new(native_track_publication: *const c_void) -> Self {
@ -702,8 +696,6 @@ impl Drop for LocalTrackPublication {
pub struct RemoteTrackPublication(*const c_void);
unsafe impl Send for RemoteTrackPublication {}
// todo!(Sync is not ok here. We need to remove it)
unsafe impl Sync for RemoteTrackPublication {}
impl RemoteTrackPublication {
pub fn new(native_track_publication: *const c_void) -> Self {
@ -761,8 +753,6 @@ pub struct RemoteAudioTrack {
}
unsafe impl Send for RemoteAudioTrack {}
// todo!(Sync is not ok here. We need to remove it)
unsafe impl Sync for RemoteAudioTrack {}
impl RemoteAudioTrack {
fn new(native_track: *const c_void, sid: Sid, publisher_id: String) -> Self {
@ -801,8 +791,6 @@ pub struct RemoteVideoTrack {
}
unsafe impl Send for RemoteVideoTrack {}
// todo!(Sync is not ok here. We need to remove it)
unsafe impl Sync for RemoteVideoTrack {}
impl RemoteVideoTrack {
fn new(native_track: *const c_void, sid: Sid, publisher_id: String) -> Self {
@ -886,8 +874,6 @@ pub enum RemoteAudioTrackUpdate {
pub struct MacOSDisplay(*const c_void);
unsafe impl Send for MacOSDisplay {}
// todo!(Sync is not ok here. We need to remove it)
unsafe impl Sync for MacOSDisplay {}
impl MacOSDisplay {
fn new(ptr: *const c_void) -> Self {

View file

@ -371,7 +371,7 @@ impl Room {
pub fn publish_video_track(
self: &Arc<Self>,
track: &LocalVideoTrack,
track: LocalVideoTrack,
) -> impl Future<Output = Result<LocalTrackPublication>> {
let this = self.clone();
let track = track.clone();
@ -384,7 +384,7 @@ impl Room {
}
pub fn publish_audio_track(
self: &Arc<Self>,
track: &LocalAudioTrack,
track: LocalAudioTrack,
) -> impl Future<Output = Result<LocalTrackPublication>> {
let this = self.clone();
let track = track.clone();