1
+ #![ cfg_attr( all( target_os = "windows" , target_env = "gnu" ) , allow( unused) ) ]
2
+
1
3
use crate :: {
2
4
call_settings:: CallSettings ,
3
5
participant:: { LocalParticipant , ParticipantLocation , RemoteParticipant } ,
@@ -13,6 +15,7 @@ use fs::Fs;
13
15
use futures:: { FutureExt , StreamExt } ;
14
16
use gpui:: { App , AppContext , AsyncAppContext , Context , Entity , EventEmitter , Task , WeakEntity } ;
15
17
use language:: LanguageRegistry ;
18
+ #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
16
19
use livekit:: {
17
20
capture_local_audio_track, capture_local_video_track,
18
21
id:: ParticipantIdentity ,
@@ -22,6 +25,8 @@ use livekit::{
22
25
track:: { TrackKind , TrackSource } ,
23
26
RoomEvent , RoomOptions ,
24
27
} ;
28
+ #[ cfg( all( target_os = "windows" , target_env = "gnu" ) ) ]
29
+ use livekit:: { publication:: LocalTrackPublication , RoomEvent } ;
25
30
use livekit_client as livekit;
26
31
use postage:: { sink:: Sink , stream:: Stream , watch} ;
27
32
use project:: Project ;
@@ -99,7 +104,10 @@ impl Room {
99
104
!self . shared_projects . is_empty ( )
100
105
}
101
106
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
+ ) ) ]
103
111
pub fn is_connected ( & self ) -> bool {
104
112
if let Some ( live_kit) = self . live_kit . as_ref ( ) {
105
113
live_kit. room . connection_state ( ) == livekit:: ConnectionState :: Connected
@@ -664,6 +672,12 @@ impl Room {
664
672
}
665
673
}
666
674
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" ) ) ) ]
667
681
fn start_room_connection ( & self , mut room : proto:: Room , cx : & mut Context < Self > ) -> Task < ( ) > {
668
682
// Filter ourselves out from the room's participants.
669
683
let local_participant_ix = room
@@ -816,6 +830,7 @@ impl Room {
816
830
muted : true ,
817
831
speaking : false ,
818
832
video_tracks : Default :: default ( ) ,
833
+ #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
819
834
audio_tracks : Default :: default ( ) ,
820
835
} ,
821
836
) ;
@@ -918,6 +933,7 @@ impl Room {
918
933
) ;
919
934
920
935
match event {
936
+ #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
921
937
RoomEvent :: TrackSubscribed {
922
938
track,
923
939
participant,
@@ -952,6 +968,7 @@ impl Room {
952
968
}
953
969
}
954
970
971
+ #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
955
972
RoomEvent :: TrackUnsubscribed {
956
973
track, participant, ..
957
974
} => {
@@ -979,6 +996,7 @@ impl Room {
979
996
}
980
997
}
981
998
999
+ #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
982
1000
RoomEvent :: ActiveSpeakersChanged { speakers } => {
983
1001
let mut speaker_ids = speakers
984
1002
. into_iter ( )
@@ -995,6 +1013,7 @@ impl Room {
995
1013
}
996
1014
}
997
1015
1016
+ #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
998
1017
RoomEvent :: TrackMuted {
999
1018
participant,
1000
1019
publication,
@@ -1019,6 +1038,7 @@ impl Room {
1019
1038
}
1020
1039
}
1021
1040
1041
+ #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
1022
1042
RoomEvent :: LocalTrackUnpublished { publication, .. } => {
1023
1043
log:: info!( "unpublished track {}" , publication. sid( ) ) ;
1024
1044
if let Some ( room) = & mut self . live_kit {
@@ -1041,10 +1061,12 @@ impl Room {
1041
1061
}
1042
1062
}
1043
1063
1064
+ #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
1044
1065
RoomEvent :: LocalTrackPublished { publication, .. } => {
1045
1066
log:: info!( "published track {:?}" , publication. sid( ) ) ;
1046
1067
}
1047
1068
1069
+ #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
1048
1070
RoomEvent :: Disconnected { reason } => {
1049
1071
log:: info!( "disconnected from room: {reason:?}" ) ;
1050
1072
self . leave ( cx) . detach_and_log_err ( cx) ;
@@ -1274,6 +1296,13 @@ impl Room {
1274
1296
pub fn can_use_microphone ( & self ) -> bool {
1275
1297
use proto:: ChannelRole :: * ;
1276
1298
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
+
1277
1306
match self . local_participant . role {
1278
1307
Admin | Member | Talker => true ,
1279
1308
Guest | Banned => false ,
@@ -1288,6 +1317,12 @@ impl Room {
1288
1317
}
1289
1318
}
1290
1319
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" ) ) ) ]
1291
1326
#[ track_caller]
1292
1327
pub fn share_microphone ( & mut self , cx : & mut Context < Self > ) -> Task < Result < ( ) > > {
1293
1328
if self . status . is_offline ( ) {
@@ -1365,6 +1400,12 @@ impl Room {
1365
1400
} )
1366
1401
}
1367
1402
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" ) ) ) ]
1368
1409
pub fn share_screen ( & mut self , cx : & mut Context < Self > ) -> Task < Result < ( ) > > {
1369
1410
if self . status . is_offline ( ) {
1370
1411
return Task :: ready ( Err ( anyhow ! ( "room is offline" ) ) ) ;
@@ -1512,12 +1553,15 @@ impl Room {
1512
1553
LocalTrack :: Published {
1513
1554
track_publication, ..
1514
1555
} => {
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
+ }
1521
1565
1522
1566
Audio :: play_sound ( Sound :: StopScreenshare , cx) ;
1523
1567
Ok ( ( ) )
@@ -1526,12 +1570,15 @@ impl Room {
1526
1570
}
1527
1571
1528
1572
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
+ }
1535
1582
}
1536
1583
}
1537
1584
}
@@ -1561,10 +1608,13 @@ impl Room {
1561
1608
LocalTrack :: Published {
1562
1609
track_publication, ..
1563
1610
} => {
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
+ }
1568
1618
}
1569
1619
1570
1620
None
@@ -1573,6 +1623,14 @@ impl Room {
1573
1623
}
1574
1624
}
1575
1625
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" ) ) ) ]
1576
1634
fn spawn_room_connection (
1577
1635
livekit_connection_info : Option < proto:: LiveKitConnectionInfo > ,
1578
1636
cx : & mut Context < ' _ , Room > ,
@@ -1637,6 +1695,10 @@ struct LiveKitRoom {
1637
1695
}
1638
1696
1639
1697
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" ) ) ) ]
1640
1702
fn stop_publishing ( & mut self , cx : & mut Context < Room > ) {
1641
1703
let mut tracks_to_unpublish = Vec :: new ( ) ;
1642
1704
if let LocalTrack :: Published {
0 commit comments