diff --git a/crates/call/src/call_impl/room.rs b/crates/call/src/call_impl/room.rs index d8ce452dd00a0e1c9963bbc920fee9d8a7e2544b..8bb10917fe761dfcc4159d8fe56e6b2c78e213b2 100644 --- a/crates/call/src/call_impl/room.rs +++ b/crates/call/src/call_impl/room.rs @@ -19,7 +19,7 @@ use livekit_client::{self as livekit, TrackSid}; use postage::{sink::Sink, stream::Stream, watch}; use project::Project; use settings::Settings as _; -use std::{any::Any, future::Future, mem, sync::Arc, time::Duration}; +use std::{any::Any, future::Future, mem, rc::Rc, sync::Arc, time::Duration}; use util::{ResultExt, TryFutureExt, post_inc}; pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30); @@ -1594,7 +1594,7 @@ fn spawn_room_connection( let muted_by_user = Room::mute_on_join(cx); this.live_kit = Some(LiveKitRoom { - room: Arc::new(room), + room: Rc::new(room), screen_track: LocalTrack::None, microphone_track: LocalTrack::None, next_publish_id: 0, @@ -1617,7 +1617,7 @@ fn spawn_room_connection( } struct LiveKitRoom { - room: Arc, + room: Rc, screen_track: LocalTrack, microphone_track: LocalTrack, /// Tracks whether we're currently in a muted state due to auto-mute from deafening or manual mute performed by user. diff --git a/crates/livekit_client/src/livekit_client.rs b/crates/livekit_client/src/livekit_client.rs index c258d11de3e0a9553d094ead3580c2cb91acd020..86000980e8116292efb0e00343eb6df14927115d 100644 --- a/crates/livekit_client/src/livekit_client.rs +++ b/crates/livekit_client/src/livekit_client.rs @@ -61,7 +61,7 @@ impl Room { let task = cx.background_executor().spawn(async move { while let Some(event) = events.recv().await { if let Some(event) = room_event_from_livekit(event) { - tx.send(event.into()).await.ok(); + tx.send(event).await.ok(); } } }); @@ -112,33 +112,6 @@ impl Room { Ok((publication, stream)) } - // pub async fn publish_local_wav_track( - // &self, - // cx: &mut AsyncApp, - // ) -> Result<(LocalTrackPublication, playback::AudioStream)> { - // let apm = self.apm.clone(); - // let executor = cx.background_executor().clone(); - // let (track, stream) = - // Tokio::spawn( - // cx, - // async move { capture_local_wav_track(apm, &executor).await }, - // )? - // .await??; - // let publication = self - // .local_participant() - // .publish_track( - // livekit::track::LocalTrack::Audio(track.0), - // livekit::options::TrackPublishOptions { - // source: livekit::track::TrackSource::Microphone, - // ..Default::default() - // }, - // cx, - // ) - // .await?; - - // Ok((publication, stream)) - // } - pub async fn unpublish_local_track( &self, sid: TrackSid, @@ -162,7 +135,7 @@ impl LocalParticipant { source: &dyn ScreenCaptureSource, cx: &mut AsyncApp, ) -> Result<(LocalTrackPublication, Box)> { - let (track, stream) = capture_local_video_track(&*source, cx).await?; + let (track, stream) = capture_local_video_track(source, cx).await?; let options = livekit::options::TrackPublishOptions { source: livekit::track::TrackSource::Screenshare, video_codec: livekit::options::VideoCodec::VP8, @@ -186,7 +159,7 @@ impl LocalParticipant { participant.publish_track(track, options).await })? .await? - .map(|p| LocalTrackPublication(p)) + .map(LocalTrackPublication) .map_err(|error| anyhow::anyhow!("failed to publish track: {error}")) } @@ -198,7 +171,7 @@ impl LocalParticipant { let participant = self.0.clone(); Tokio::spawn(cx, async move { participant.unpublish_track(&sid).await })? .await? - .map(|p| LocalTrackPublication(p)) + .map(LocalTrackPublication) .map_err(|error| anyhow::anyhow!("failed to unpublish track: {error}")) } } @@ -476,7 +449,7 @@ fn room_event_from_livekit(event: livekit::RoomEvent) -> Option { |(p, t)| { ( RemoteParticipant(p), - t.into_iter().map(|t| RemoteTrackPublication(t)).collect(), + t.into_iter().map(RemoteTrackPublication).collect(), ) } }) diff --git a/crates/livekit_client/src/livekit_client/playback.rs b/crates/livekit_client/src/livekit_client/playback.rs index 340efc95aa777f33588b9146aa116dea4fa3e76e..b91d5abfee6e566334ea7baaba1c419ad2661a64 100644 --- a/crates/livekit_client/src/livekit_client/playback.rs +++ b/crates/livekit_client/src/livekit_client/playback.rs @@ -271,9 +271,9 @@ impl AudioStack { let mut sampled = resampler .remix_and_resample( buf.as_slice(), - config.sample_rate().0 as u32 / 100, + config.sample_rate().0 / 100, config.channels() as u32, - config.sample_rate().0 as u32, + config.sample_rate().0, num_channels, sample_rate, )