Fix post-merge compile errors

This commit is contained in:
Nathan Sobo 2023-11-01 21:16:41 -06:00
parent db9ccd7f34
commit 2079cd641e
4 changed files with 18 additions and 17 deletions

View file

@ -134,7 +134,7 @@ impl Room {
} }
}); });
let _maintain_video_tracks = cx.spawn_on_main({ let _maintain_video_tracks = cx.spawn({
let room = room.clone(); let room = room.clone();
move |this, mut cx| async move { move |this, mut cx| async move {
let mut track_video_changes = room.remote_video_track_updates(); let mut track_video_changes = room.remote_video_track_updates();
@ -153,7 +153,7 @@ impl Room {
} }
}); });
let _maintain_audio_tracks = cx.spawn_on_main({ let _maintain_audio_tracks = cx.spawn({
let room = room.clone(); let room = room.clone();
|this, mut cx| async move { |this, mut cx| async move {
let mut track_audio_changes = room.remote_audio_track_updates(); let mut track_audio_changes = room.remote_audio_track_updates();
@ -1301,7 +1301,9 @@ impl Room {
live_kit.room.unpublish_track(publication); live_kit.room.unpublish_track(publication);
} else { } else {
if muted { if muted {
cx.executor().spawn(publication.set_mute(muted)).detach(); cx.background_executor()
.spawn(publication.set_mute(muted))
.detach();
} }
live_kit.microphone_track = LocalTrack::Published { live_kit.microphone_track = LocalTrack::Published {
track_publication: publication, track_publication: publication,
@ -1344,7 +1346,7 @@ impl Room {
return Task::ready(Err(anyhow!("live-kit was not initialized"))); return Task::ready(Err(anyhow!("live-kit was not initialized")));
}; };
cx.spawn_on_main(move |this, mut cx| async move { cx.spawn(move |this, mut cx| async move {
let publish_track = async { let publish_track = async {
let displays = displays.await?; let displays = displays.await?;
let display = displays let display = displays
@ -1387,7 +1389,9 @@ impl Room {
live_kit.room.unpublish_track(publication); live_kit.room.unpublish_track(publication);
} else { } else {
if muted { if muted {
cx.executor().spawn(publication.set_mute(muted)).detach(); cx.background_executor()
.spawn(publication.set_mute(muted))
.detach();
} }
live_kit.screen_track = LocalTrack::Published { live_kit.screen_track = LocalTrack::Published {
track_publication: publication, track_publication: publication,
@ -1454,14 +1458,11 @@ impl Room {
.remote_audio_track_publications(&participant.user.id.to_string()) .remote_audio_track_publications(&participant.user.id.to_string())
{ {
let deafened = live_kit.deafened; let deafened = live_kit.deafened;
tasks.push( tasks.push(cx.foreground_executor().spawn(track.set_enabled(!deafened)));
cx.executor()
.spawn_on_main(move || track.set_enabled(!deafened)),
);
} }
} }
Ok(cx.executor().spawn_on_main(|| async { Ok(cx.foreground_executor().spawn(async move {
if let Some(mute_task) = mute_task { if let Some(mute_task) = mute_task {
mute_task.await?; mute_task.await?;
} }

View file

@ -42,7 +42,7 @@ fn main() {
let live_kit_key = std::env::var("LIVE_KIT_KEY").unwrap_or("devkey".into()); let live_kit_key = std::env::var("LIVE_KIT_KEY").unwrap_or("devkey".into());
let live_kit_secret = std::env::var("LIVE_KIT_SECRET").unwrap_or("secret".into()); let live_kit_secret = std::env::var("LIVE_KIT_SECRET").unwrap_or("secret".into());
cx.spawn_on_main(|cx| async move { cx.spawn(|cx| async move {
let user_a_token = token::create( let user_a_token = token::create(
&live_kit_key, &live_kit_key,
&live_kit_secret, &live_kit_secret,
@ -104,7 +104,7 @@ fn main() {
} }
println!("Pausing for 5 seconds to test audio, make some noise!"); println!("Pausing for 5 seconds to test audio, make some noise!");
let timer = cx.executor().timer(Duration::from_secs(5)); let timer = cx.background_executor().timer(Duration::from_secs(5));
timer.await; timer.await;
let remote_audio_track = room_b let remote_audio_track = room_b
.remote_audio_tracks("test-participant-1") .remote_audio_tracks("test-participant-1")

View file

@ -2,7 +2,7 @@ use anyhow::{anyhow, Context, Result};
use async_trait::async_trait; use async_trait::async_trait;
use collections::{BTreeMap, HashMap}; use collections::{BTreeMap, HashMap};
use futures::Stream; use futures::Stream;
use gpui2::Executor; use gpui2::BackgroundExecutor;
use live_kit_server::token; use live_kit_server::token;
use media::core_video::CVImageBuffer; use media::core_video::CVImageBuffer;
use parking_lot::Mutex; use parking_lot::Mutex;
@ -16,7 +16,7 @@ pub struct TestServer {
pub api_key: String, pub api_key: String,
pub secret_key: String, pub secret_key: String,
rooms: Mutex<HashMap<String, TestServerRoom>>, rooms: Mutex<HashMap<String, TestServerRoom>>,
executor: Arc<Executor>, executor: Arc<BackgroundExecutor>,
} }
impl TestServer { impl TestServer {
@ -24,7 +24,7 @@ impl TestServer {
url: String, url: String,
api_key: String, api_key: String,
secret_key: String, secret_key: String,
executor: Arc<Executor>, executor: Arc<BackgroundExecutor>,
) -> Result<Arc<TestServer>> { ) -> Result<Arc<TestServer>> {
let mut servers = SERVERS.lock(); let mut servers = SERVERS.lock();
if servers.contains_key(&url) { if servers.contains_key(&url) {

View file

@ -878,7 +878,7 @@ impl MultiBuffer {
cx.spawn(move |this, mut cx| async move { cx.spawn(move |this, mut cx| async move {
let mut excerpt_ranges = Vec::new(); let mut excerpt_ranges = Vec::new();
let mut range_counts = Vec::new(); let mut range_counts = Vec::new();
cx.executor() cx.background_executor()
.scoped(|scope| { .scoped(|scope| {
scope.spawn(async { scope.spawn(async {
let (ranges, counts) = let (ranges, counts) =
@ -4177,7 +4177,7 @@ mod tests {
let guest_buffer = cx.build_model(|cx| { let guest_buffer = cx.build_model(|cx| {
let state = host_buffer.read(cx).to_proto(); let state = host_buffer.read(cx).to_proto();
let ops = cx let ops = cx
.executor() .background_executor()
.block(host_buffer.read(cx).serialize_ops(None, cx)); .block(host_buffer.read(cx).serialize_ops(None, cx));
let mut buffer = Buffer::from_proto(1, state, None).unwrap(); let mut buffer = Buffer::from_proto(1, state, None).unwrap();
buffer buffer