Skip to content

Commit 64a5153

Browse files
authored
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
1 parent 5d005a7 commit 64a5153

File tree

10 files changed

+199
-26
lines changed

10 files changed

+199
-26
lines changed

crates/call/src/cross_platform/participant.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(all(target_os = "windows", target_env = "gnu"), allow(unused))]
2+
13
use anyhow::{anyhow, Result};
24
use client::{proto, ParticipantIndex, User};
35
use collections::HashMap;
@@ -6,6 +8,7 @@ use livekit_client::AudioStream;
68
use project::Project;
79
use std::sync::Arc;
810

11+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
912
pub use livekit_client::id::TrackSid;
1013
pub use livekit_client::track::{RemoteAudioTrack, RemoteVideoTrack};
1114

@@ -58,13 +61,18 @@ pub struct RemoteParticipant {
5861
pub participant_index: ParticipantIndex,
5962
pub muted: bool,
6063
pub speaking: bool,
64+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
6165
pub video_tracks: HashMap<TrackSid, RemoteVideoTrack>,
66+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
6267
pub audio_tracks: HashMap<TrackSid, (RemoteAudioTrack, AudioStream)>,
6368
}
6469

6570
impl RemoteParticipant {
6671
pub fn has_video_tracks(&self) -> bool {
67-
!self.video_tracks.is_empty()
72+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
73+
return !self.video_tracks.is_empty();
74+
#[cfg(all(target_os = "windows", target_env = "gnu"))]
75+
return false;
6876
}
6977

7078
pub fn can_write(&self) -> bool {

crates/call/src/cross_platform/room.rs

Lines changed: 79 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(all(target_os = "windows", target_env = "gnu"), allow(unused))]
2+
13
use crate::{
24
call_settings::CallSettings,
35
participant::{LocalParticipant, ParticipantLocation, RemoteParticipant},
@@ -13,6 +15,7 @@ use fs::Fs;
1315
use futures::{FutureExt, StreamExt};
1416
use gpui::{App, AppContext, AsyncAppContext, Context, Entity, EventEmitter, Task, WeakEntity};
1517
use language::LanguageRegistry;
18+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
1619
use livekit::{
1720
capture_local_audio_track, capture_local_video_track,
1821
id::ParticipantIdentity,
@@ -22,6 +25,8 @@ use livekit::{
2225
track::{TrackKind, TrackSource},
2326
RoomEvent, RoomOptions,
2427
};
28+
#[cfg(all(target_os = "windows", target_env = "gnu"))]
29+
use livekit::{publication::LocalTrackPublication, RoomEvent};
2530
use livekit_client as livekit;
2631
use postage::{sink::Sink, stream::Stream, watch};
2732
use project::Project;
@@ -99,7 +104,10 @@ impl Room {
99104
!self.shared_projects.is_empty()
100105
}
101106

102-
#[cfg(any(test, feature = "test-support"))]
107+
#[cfg(all(
108+
any(test, feature = "test-support"),
109+
not(all(target_os = "windows", target_env = "gnu"))
110+
))]
103111
pub fn is_connected(&self) -> bool {
104112
if let Some(live_kit) = self.live_kit.as_ref() {
105113
live_kit.room.connection_state() == livekit::ConnectionState::Connected
@@ -664,6 +672,12 @@ impl Room {
664672
}
665673
}
666674

675+
#[cfg(all(target_os = "windows", target_env = "gnu"))]
676+
fn start_room_connection(&self, mut room: proto::Room, cx: &mut Context<Self>) -> Task<()> {
677+
Task::ready(())
678+
}
679+
680+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
667681
fn start_room_connection(&self, mut room: proto::Room, cx: &mut Context<Self>) -> Task<()> {
668682
// Filter ourselves out from the room's participants.
669683
let local_participant_ix = room
@@ -816,6 +830,7 @@ impl Room {
816830
muted: true,
817831
speaking: false,
818832
video_tracks: Default::default(),
833+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
819834
audio_tracks: Default::default(),
820835
},
821836
);
@@ -918,6 +933,7 @@ impl Room {
918933
);
919934

920935
match event {
936+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
921937
RoomEvent::TrackSubscribed {
922938
track,
923939
participant,
@@ -952,6 +968,7 @@ impl Room {
952968
}
953969
}
954970

971+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
955972
RoomEvent::TrackUnsubscribed {
956973
track, participant, ..
957974
} => {
@@ -979,6 +996,7 @@ impl Room {
979996
}
980997
}
981998

999+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
9821000
RoomEvent::ActiveSpeakersChanged { speakers } => {
9831001
let mut speaker_ids = speakers
9841002
.into_iter()
@@ -995,6 +1013,7 @@ impl Room {
9951013
}
9961014
}
9971015

1016+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
9981017
RoomEvent::TrackMuted {
9991018
participant,
10001019
publication,
@@ -1019,6 +1038,7 @@ impl Room {
10191038
}
10201039
}
10211040

1041+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
10221042
RoomEvent::LocalTrackUnpublished { publication, .. } => {
10231043
log::info!("unpublished track {}", publication.sid());
10241044
if let Some(room) = &mut self.live_kit {
@@ -1041,10 +1061,12 @@ impl Room {
10411061
}
10421062
}
10431063

1064+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
10441065
RoomEvent::LocalTrackPublished { publication, .. } => {
10451066
log::info!("published track {:?}", publication.sid());
10461067
}
10471068

1069+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
10481070
RoomEvent::Disconnected { reason } => {
10491071
log::info!("disconnected from room: {reason:?}");
10501072
self.leave(cx).detach_and_log_err(cx);
@@ -1274,6 +1296,13 @@ impl Room {
12741296
pub fn can_use_microphone(&self) -> bool {
12751297
use proto::ChannelRole::*;
12761298

1299+
#[cfg(not(any(test, feature = "test-support")))]
1300+
{
1301+
if cfg!(all(target_os = "windows", target_env = "gnu")) {
1302+
return false;
1303+
}
1304+
}
1305+
12771306
match self.local_participant.role {
12781307
Admin | Member | Talker => true,
12791308
Guest | Banned => false,
@@ -1288,6 +1317,12 @@ impl Room {
12881317
}
12891318
}
12901319

1320+
#[cfg(all(target_os = "windows", target_env = "gnu"))]
1321+
pub fn share_microphone(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
1322+
Task::ready(Err(anyhow!("MinGW is not supported yet")))
1323+
}
1324+
1325+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
12911326
#[track_caller]
12921327
pub fn share_microphone(&mut self, cx: &mut Context<Self>) -> Task<Result<()>> {
12931328
if self.status.is_offline() {
@@ -1365,6 +1400,12 @@ impl Room {
13651400
})
13661401
}
13671402

1403+
#[cfg(all(target_os = "windows", target_env = "gnu"))]
1404+
pub fn share_screen(&mut self, cx: &mut Context<Self>) -> Task<Result<()>> {
1405+
Task::ready(Err(anyhow!("MinGW is not supported yet")))
1406+
}
1407+
1408+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
13681409
pub fn share_screen(&mut self, cx: &mut Context<Self>) -> Task<Result<()>> {
13691410
if self.status.is_offline() {
13701411
return Task::ready(Err(anyhow!("room is offline")));
@@ -1512,12 +1553,15 @@ impl Room {
15121553
LocalTrack::Published {
15131554
track_publication, ..
15141555
} => {
1515-
let local_participant = live_kit.room.local_participant();
1516-
let sid = track_publication.sid();
1517-
cx.background_executor()
1518-
.spawn(async move { local_participant.unpublish_track(&sid).await })
1519-
.detach_and_log_err(cx);
1520-
cx.notify();
1556+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
1557+
{
1558+
let local_participant = live_kit.room.local_participant();
1559+
let sid = track_publication.sid();
1560+
cx.background_executor()
1561+
.spawn(async move { local_participant.unpublish_track(&sid).await })
1562+
.detach_and_log_err(cx);
1563+
cx.notify();
1564+
}
15211565

15221566
Audio::play_sound(Sound::StopScreenshare, cx);
15231567
Ok(())
@@ -1526,12 +1570,15 @@ impl Room {
15261570
}
15271571

15281572
fn set_deafened(&mut self, deafened: bool, cx: &mut Context<Self>) -> Option<()> {
1529-
let live_kit = self.live_kit.as_mut()?;
1530-
cx.notify();
1531-
for (_, participant) in live_kit.room.remote_participants() {
1532-
for (_, publication) in participant.track_publications() {
1533-
if publication.kind() == TrackKind::Audio {
1534-
publication.set_enabled(!deafened);
1573+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
1574+
{
1575+
let live_kit = self.live_kit.as_mut()?;
1576+
cx.notify();
1577+
for (_, participant) in live_kit.room.remote_participants() {
1578+
for (_, publication) in participant.track_publications() {
1579+
if publication.kind() == TrackKind::Audio {
1580+
publication.set_enabled(!deafened);
1581+
}
15351582
}
15361583
}
15371584
}
@@ -1561,10 +1608,13 @@ impl Room {
15611608
LocalTrack::Published {
15621609
track_publication, ..
15631610
} => {
1564-
if should_mute {
1565-
track_publication.mute()
1566-
} else {
1567-
track_publication.unmute()
1611+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
1612+
{
1613+
if should_mute {
1614+
track_publication.mute()
1615+
} else {
1616+
track_publication.unmute()
1617+
}
15681618
}
15691619

15701620
None
@@ -1573,6 +1623,14 @@ impl Room {
15731623
}
15741624
}
15751625

1626+
#[cfg(all(target_os = "windows", target_env = "gnu"))]
1627+
fn spawn_room_connection(
1628+
livekit_connection_info: Option<proto::LiveKitConnectionInfo>,
1629+
cx: &mut ModelContext<'_, Room>,
1630+
) {
1631+
}
1632+
1633+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
15761634
fn spawn_room_connection(
15771635
livekit_connection_info: Option<proto::LiveKitConnectionInfo>,
15781636
cx: &mut Context<'_, Room>,
@@ -1637,6 +1695,10 @@ struct LiveKitRoom {
16371695
}
16381696

16391697
impl LiveKitRoom {
1698+
#[cfg(all(target_os = "windows", target_env = "gnu"))]
1699+
fn stop_publishing(&mut self, _cx: &mut Context<Room>) {}
1700+
1701+
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
16401702
fn stop_publishing(&mut self, cx: &mut Context<Room>) {
16411703
let mut tracks_to_unpublish = Vec::new();
16421704
if let LocalTrack::Published {

crates/livekit_client/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ cpal = "0.15"
2828
futures.workspace = true
2929
gpui.workspace = true
3030
http_2 = { package = "http", version = "0.2.1" }
31-
livekit.workspace = true
3231
livekit_server.workspace = true
3332
log.workspace = true
3433
media.workspace = true
@@ -40,6 +39,9 @@ http_client.workspace = true
4039
smallvec.workspace = true
4140
image.workspace = true
4241

42+
[target.'cfg(not(all(target_os = "windows", target_env = "gnu")))'.dependencies]
43+
livekit.workspace = true
44+
4345
[target.'cfg(target_os = "macos")'.dependencies]
4446
core-foundation.workspace = true
4547
coreaudio-rs = "0.12.1"

0 commit comments

Comments
 (0)