windows: Make collab run on Windows (#23117)
I’ve also updated the documentation in `development\local-collaboration.md` and `docs\src\development\windows.md`. Testing collab on my Windows machine:  Release Notes: - N/A --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
parent
b1375ab946
commit
70db427fc8
14 changed files with 176 additions and 197 deletions
|
@ -1,18 +1,14 @@
|
|||
pub mod participant;
|
||||
pub mod publication;
|
||||
pub mod track;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
pub mod webrtc;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
use self::id::*;
|
||||
use self::{participant::*, publication::*, track::*};
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use async_trait::async_trait;
|
||||
use collections::{btree_map::Entry as BTreeEntry, hash_map::Entry, BTreeMap, HashMap, HashSet};
|
||||
use gpui::BackgroundExecutor;
|
||||
#[cfg(not(windows))]
|
||||
use livekit::options::TrackPublishOptions;
|
||||
use livekit_server::{proto, token};
|
||||
use parking_lot::Mutex;
|
||||
|
@ -22,7 +18,6 @@ use std::sync::{
|
|||
Arc, Weak,
|
||||
};
|
||||
|
||||
#[cfg(not(windows))]
|
||||
pub use livekit::{id, options, ConnectionState, DisconnectReason, RoomOptions};
|
||||
|
||||
static SERVERS: Mutex<BTreeMap<String, Arc<TestServer>>> = Mutex::new(BTreeMap::new());
|
||||
|
@ -31,12 +26,10 @@ pub struct TestServer {
|
|||
pub url: String,
|
||||
pub api_key: String,
|
||||
pub secret_key: String,
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
rooms: Mutex<HashMap<String, TestServerRoom>>,
|
||||
executor: BackgroundExecutor,
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
impl TestServer {
|
||||
pub fn create(
|
||||
url: String,
|
||||
|
@ -534,7 +527,6 @@ impl TestServer {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
#[derive(Default, Debug)]
|
||||
struct TestServerRoom {
|
||||
client_rooms: HashMap<ParticipantIdentity, Room>,
|
||||
|
@ -543,7 +535,6 @@ struct TestServerRoom {
|
|||
participant_permissions: HashMap<ParticipantIdentity, proto::ParticipantPermission>,
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
#[derive(Debug)]
|
||||
struct TestServerVideoTrack {
|
||||
sid: TrackSid,
|
||||
|
@ -551,7 +542,6 @@ struct TestServerVideoTrack {
|
|||
// frames_rx: async_broadcast::Receiver<Frame>,
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
#[derive(Debug)]
|
||||
struct TestServerAudioTrack {
|
||||
sid: TrackSid,
|
||||
|
@ -590,7 +580,6 @@ pub enum RoomEvent {
|
|||
TrackSubscriptionFailed {
|
||||
participant: RemoteParticipant,
|
||||
error: String,
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
track_sid: TrackSid,
|
||||
},
|
||||
TrackPublished {
|
||||
|
@ -626,12 +615,10 @@ pub enum RoomEvent {
|
|||
ActiveSpeakersChanged {
|
||||
speakers: Vec<Participant>,
|
||||
},
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
ConnectionStateChanged(ConnectionState),
|
||||
Connected {
|
||||
participants_with_tracks: Vec<(RemoteParticipant, Vec<RemoteTrackPublication>)>,
|
||||
},
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
Disconnected {
|
||||
reason: DisconnectReason,
|
||||
},
|
||||
|
@ -639,7 +626,6 @@ pub enum RoomEvent {
|
|||
Reconnected,
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
#[async_trait]
|
||||
impl livekit_server::api::Client for TestApiClient {
|
||||
fn url(&self) -> &str {
|
||||
|
@ -703,11 +689,8 @@ impl livekit_server::api::Client for TestApiClient {
|
|||
struct RoomState {
|
||||
url: String,
|
||||
token: String,
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
local_identity: ParticipantIdentity,
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
connection_state: ConnectionState,
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
paused_audio_tracks: HashSet<TrackSid>,
|
||||
updates_tx: mpsc::Sender<RoomEvent>,
|
||||
}
|
||||
|
@ -718,7 +701,6 @@ pub struct Room(Arc<Mutex<RoomState>>);
|
|||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct WeakRoom(Weak<Mutex<RoomState>>);
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
impl std::fmt::Debug for RoomState {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("Room")
|
||||
|
@ -731,17 +713,6 @@ impl std::fmt::Debug for RoomState {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
impl std::fmt::Debug for RoomState {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("Room")
|
||||
.field("url", &self.url)
|
||||
.field("token", &self.token)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
impl Room {
|
||||
fn downgrade(&self) -> WeakRoom {
|
||||
WeakRoom(Arc::downgrade(&self.0))
|
||||
|
@ -803,7 +774,6 @@ impl Room {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
impl Drop for RoomState {
|
||||
fn drop(&mut self) {
|
||||
if self.connection_state == ConnectionState::Connected {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue