collab: Make unsupported for MinGW toolchain (#23518)
Closes #23451 reverts #23117 for MinGW. collab can't be compiled for MinGW because webrtc itself doesn't support MinGW compilers Release Notes: - N/A
This commit is contained in:
parent
5d005a7621
commit
64a5153bb5
10 changed files with 199 additions and 26 deletions
|
@ -1,3 +1,5 @@
|
|||
#![cfg_attr(all(target_os = "windows", target_env = "gnu"), allow(unused))]
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use client::{proto, ParticipantIndex, User};
|
||||
use collections::HashMap;
|
||||
|
@ -6,6 +8,7 @@ use livekit_client::AudioStream;
|
|||
use project::Project;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
pub use livekit_client::id::TrackSid;
|
||||
pub use livekit_client::track::{RemoteAudioTrack, RemoteVideoTrack};
|
||||
|
||||
|
@ -58,13 +61,18 @@ pub struct RemoteParticipant {
|
|||
pub participant_index: ParticipantIndex,
|
||||
pub muted: bool,
|
||||
pub speaking: bool,
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
pub video_tracks: HashMap<TrackSid, RemoteVideoTrack>,
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
pub audio_tracks: HashMap<TrackSid, (RemoteAudioTrack, AudioStream)>,
|
||||
}
|
||||
|
||||
impl RemoteParticipant {
|
||||
pub fn has_video_tracks(&self) -> bool {
|
||||
!self.video_tracks.is_empty()
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
return !self.video_tracks.is_empty();
|
||||
#[cfg(all(target_os = "windows", target_env = "gnu"))]
|
||||
return false;
|
||||
}
|
||||
|
||||
pub fn can_write(&self) -> bool {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![cfg_attr(all(target_os = "windows", target_env = "gnu"), allow(unused))]
|
||||
|
||||
use crate::{
|
||||
call_settings::CallSettings,
|
||||
participant::{LocalParticipant, ParticipantLocation, RemoteParticipant},
|
||||
|
@ -13,6 +15,7 @@ use fs::Fs;
|
|||
use futures::{FutureExt, StreamExt};
|
||||
use gpui::{App, AppContext, AsyncAppContext, Context, Entity, EventEmitter, Task, WeakEntity};
|
||||
use language::LanguageRegistry;
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
use livekit::{
|
||||
capture_local_audio_track, capture_local_video_track,
|
||||
id::ParticipantIdentity,
|
||||
|
@ -22,6 +25,8 @@ use livekit::{
|
|||
track::{TrackKind, TrackSource},
|
||||
RoomEvent, RoomOptions,
|
||||
};
|
||||
#[cfg(all(target_os = "windows", target_env = "gnu"))]
|
||||
use livekit::{publication::LocalTrackPublication, RoomEvent};
|
||||
use livekit_client as livekit;
|
||||
use postage::{sink::Sink, stream::Stream, watch};
|
||||
use project::Project;
|
||||
|
@ -99,7 +104,10 @@ impl Room {
|
|||
!self.shared_projects.is_empty()
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
#[cfg(all(
|
||||
any(test, feature = "test-support"),
|
||||
not(all(target_os = "windows", target_env = "gnu"))
|
||||
))]
|
||||
pub fn is_connected(&self) -> bool {
|
||||
if let Some(live_kit) = self.live_kit.as_ref() {
|
||||
live_kit.room.connection_state() == livekit::ConnectionState::Connected
|
||||
|
@ -664,6 +672,12 @@ impl Room {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(all(target_os = "windows", target_env = "gnu"))]
|
||||
fn start_room_connection(&self, mut room: proto::Room, cx: &mut Context<Self>) -> Task<()> {
|
||||
Task::ready(())
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
fn start_room_connection(&self, mut room: proto::Room, cx: &mut Context<Self>) -> Task<()> {
|
||||
// Filter ourselves out from the room's participants.
|
||||
let local_participant_ix = room
|
||||
|
@ -816,6 +830,7 @@ impl Room {
|
|||
muted: true,
|
||||
speaking: false,
|
||||
video_tracks: Default::default(),
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
audio_tracks: Default::default(),
|
||||
},
|
||||
);
|
||||
|
@ -918,6 +933,7 @@ impl Room {
|
|||
);
|
||||
|
||||
match event {
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
RoomEvent::TrackSubscribed {
|
||||
track,
|
||||
participant,
|
||||
|
@ -952,6 +968,7 @@ impl Room {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
RoomEvent::TrackUnsubscribed {
|
||||
track, participant, ..
|
||||
} => {
|
||||
|
@ -979,6 +996,7 @@ impl Room {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
RoomEvent::ActiveSpeakersChanged { speakers } => {
|
||||
let mut speaker_ids = speakers
|
||||
.into_iter()
|
||||
|
@ -995,6 +1013,7 @@ impl Room {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
RoomEvent::TrackMuted {
|
||||
participant,
|
||||
publication,
|
||||
|
@ -1019,6 +1038,7 @@ impl Room {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
RoomEvent::LocalTrackUnpublished { publication, .. } => {
|
||||
log::info!("unpublished track {}", publication.sid());
|
||||
if let Some(room) = &mut self.live_kit {
|
||||
|
@ -1041,10 +1061,12 @@ impl Room {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
RoomEvent::LocalTrackPublished { publication, .. } => {
|
||||
log::info!("published track {:?}", publication.sid());
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
RoomEvent::Disconnected { reason } => {
|
||||
log::info!("disconnected from room: {reason:?}");
|
||||
self.leave(cx).detach_and_log_err(cx);
|
||||
|
@ -1274,6 +1296,13 @@ impl Room {
|
|||
pub fn can_use_microphone(&self) -> bool {
|
||||
use proto::ChannelRole::*;
|
||||
|
||||
#[cfg(not(any(test, feature = "test-support")))]
|
||||
{
|
||||
if cfg!(all(target_os = "windows", target_env = "gnu")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
match self.local_participant.role {
|
||||
Admin | Member | Talker => true,
|
||||
Guest | Banned => false,
|
||||
|
@ -1288,6 +1317,12 @@ impl Room {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(all(target_os = "windows", target_env = "gnu"))]
|
||||
pub fn share_microphone(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
|
||||
Task::ready(Err(anyhow!("MinGW is not supported yet")))
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
#[track_caller]
|
||||
pub fn share_microphone(&mut self, cx: &mut Context<Self>) -> Task<Result<()>> {
|
||||
if self.status.is_offline() {
|
||||
|
@ -1365,6 +1400,12 @@ impl Room {
|
|||
})
|
||||
}
|
||||
|
||||
#[cfg(all(target_os = "windows", target_env = "gnu"))]
|
||||
pub fn share_screen(&mut self, cx: &mut Context<Self>) -> Task<Result<()>> {
|
||||
Task::ready(Err(anyhow!("MinGW is not supported yet")))
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
pub fn share_screen(&mut self, cx: &mut Context<Self>) -> Task<Result<()>> {
|
||||
if self.status.is_offline() {
|
||||
return Task::ready(Err(anyhow!("room is offline")));
|
||||
|
@ -1512,12 +1553,15 @@ impl Room {
|
|||
LocalTrack::Published {
|
||||
track_publication, ..
|
||||
} => {
|
||||
let local_participant = live_kit.room.local_participant();
|
||||
let sid = track_publication.sid();
|
||||
cx.background_executor()
|
||||
.spawn(async move { local_participant.unpublish_track(&sid).await })
|
||||
.detach_and_log_err(cx);
|
||||
cx.notify();
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
{
|
||||
let local_participant = live_kit.room.local_participant();
|
||||
let sid = track_publication.sid();
|
||||
cx.background_executor()
|
||||
.spawn(async move { local_participant.unpublish_track(&sid).await })
|
||||
.detach_and_log_err(cx);
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
Audio::play_sound(Sound::StopScreenshare, cx);
|
||||
Ok(())
|
||||
|
@ -1526,12 +1570,15 @@ impl Room {
|
|||
}
|
||||
|
||||
fn set_deafened(&mut self, deafened: bool, cx: &mut Context<Self>) -> Option<()> {
|
||||
let live_kit = self.live_kit.as_mut()?;
|
||||
cx.notify();
|
||||
for (_, participant) in live_kit.room.remote_participants() {
|
||||
for (_, publication) in participant.track_publications() {
|
||||
if publication.kind() == TrackKind::Audio {
|
||||
publication.set_enabled(!deafened);
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
{
|
||||
let live_kit = self.live_kit.as_mut()?;
|
||||
cx.notify();
|
||||
for (_, participant) in live_kit.room.remote_participants() {
|
||||
for (_, publication) in participant.track_publications() {
|
||||
if publication.kind() == TrackKind::Audio {
|
||||
publication.set_enabled(!deafened);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1561,10 +1608,13 @@ impl Room {
|
|||
LocalTrack::Published {
|
||||
track_publication, ..
|
||||
} => {
|
||||
if should_mute {
|
||||
track_publication.mute()
|
||||
} else {
|
||||
track_publication.unmute()
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
{
|
||||
if should_mute {
|
||||
track_publication.mute()
|
||||
} else {
|
||||
track_publication.unmute()
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
|
@ -1573,6 +1623,14 @@ impl Room {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(all(target_os = "windows", target_env = "gnu"))]
|
||||
fn spawn_room_connection(
|
||||
livekit_connection_info: Option<proto::LiveKitConnectionInfo>,
|
||||
cx: &mut ModelContext<'_, Room>,
|
||||
) {
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
fn spawn_room_connection(
|
||||
livekit_connection_info: Option<proto::LiveKitConnectionInfo>,
|
||||
cx: &mut Context<'_, Room>,
|
||||
|
@ -1637,6 +1695,10 @@ struct LiveKitRoom {
|
|||
}
|
||||
|
||||
impl LiveKitRoom {
|
||||
#[cfg(all(target_os = "windows", target_env = "gnu"))]
|
||||
fn stop_publishing(&mut self, _cx: &mut Context<Room>) {}
|
||||
|
||||
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
|
||||
fn stop_publishing(&mut self, cx: &mut Context<Room>) {
|
||||
let mut tracks_to_unpublish = Vec::new();
|
||||
if let LocalTrack::Published {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue