History

Make Linux audio public (#23191)

Release Notes: - Added a way to use audio in rooms with Linux builds

Kirill Bulatov committed 1 year ago

Commit 2e959cb1 parent e215ca16 files · +12 −15Browse files

Unified · Split

6 files
  1. Cargo.lock +0 −1
  2. crates/call/Cargo.toml +0 −1
  3. crates/call/src/cross_platform/room.rs +3 −4
  4. crates/call/src/macos/room.rs +2 −2
  5. crates/collab/src/tests/channel_guest_tests.rs +6 −6
  6. crates/title_bar/src/collab.rs +1 −1
Cargo.lock+0−1
@@ -2039,7 +2039,6 @@ dependencies = [ · 2038 unmodified lines
2039 "audio",2039 "audio",
2040 "client",2040 "client",
2041 "collections",2041 "collections",
2042 "feature_flags",
2043 "fs",2042 "fs",
2044 "futures 0.3.31",2043 "futures 0.3.31",
2045 "gpui",2044 "gpui",
crates/call/Cargo.toml+0−1
@@ -28,7 +28,6 @@ anyhow.workspace = true · 27 unmodified lines
28audio.workspace = true28audio.workspace = true
29client.workspace = true29client.workspace = true
30collections.workspace = true30collections.workspace = true
31feature_flags.workspace = true
32fs.workspace = true31fs.workspace = true
33futures.workspace = true32futures.workspace = true
34gpui.workspace = true33gpui.workspace = true
crates/call/src/cross_platform/room.rs+3−4
@@ -1304,13 +1304,12 @@ impl Room { · 1303 unmodified lines
1304 self.live_kit.as_ref().map(|live_kit| live_kit.deafened)1304 self.live_kit.as_ref().map(|live_kit| live_kit.deafened)
1305 }1305 }
1306 1306
1307 pub fn can_use_microphone(&self, _cx: &AppContext) -> bool {1307 pub fn can_use_microphone(&self) -> bool {
1308 use proto::ChannelRole::*;1308 use proto::ChannelRole::*;
1309 1309
1310 #[cfg(not(any(test, feature = "test-support")))]1310 #[cfg(not(any(test, feature = "test-support")))]
1311 {1311 {
1312 use feature_flags::FeatureFlagAppExt as _;1312 if cfg!(target_os = "windows") {
1313 if cfg!(target_os = "windows") || (cfg!(target_os = "linux") && !_cx.is_staff()) {
1314 return false;1313 return false;
1315 }1314 }
1316 }1315 }
@@ -1684,7 +1683,7 @@ fn spawn_room_connection( · 367 unmodified lines
1684 _handle_updates,1683 _handle_updates,
1685 });1684 });
1686 1685
1687 if !muted_by_user && this.can_use_microphone(cx) {1686 if !muted_by_user && this.can_use_microphone() {
1688 this.share_microphone(cx)1687 this.share_microphone(cx)
1689 } else {1688 } else {
1690 Task::ready(Ok(()))1689 Task::ready(Ok(()))
crates/call/src/macos/room.rs+2−2
@@ -156,7 +156,7 @@ impl Room { · 155 unmodified lines
156 cx.spawn(|this, mut cx| async move {156 cx.spawn(|this, mut cx| async move {
157 connect.await?;157 connect.await?;
158 this.update(&mut cx, |this, cx| {158 this.update(&mut cx, |this, cx| {
159 if this.can_use_microphone(cx) {159 if this.can_use_microphone() {
160 if let Some(live_kit) = &this.live_kit {160 if let Some(live_kit) = &this.live_kit {
161 if !live_kit.muted_by_user && !live_kit.deafened {161 if !live_kit.muted_by_user && !live_kit.deafened {
162 return this.share_microphone(cx);162 return this.share_microphone(cx);
@@ -1323,7 +1323,7 @@ impl Room { · 1160 unmodified lines
1323 self.live_kit.as_ref().map(|live_kit| live_kit.deafened)1323 self.live_kit.as_ref().map(|live_kit| live_kit.deafened)
1324 }1324 }
1325 1325
1326 pub fn can_use_microphone(&self, _cx: &AppContext) -> bool {1326 pub fn can_use_microphone(&self) -> bool {
1327 use proto::ChannelRole::*;1327 use proto::ChannelRole::*;
1328 match self.local_participant.role {1328 match self.local_participant.role {
1329 Admin | Member | Talker => true,1329 Admin | Member | Talker => true,
crates/collab/src/tests/channel_guest_tests.rs+6−6
@@ -108,7 +108,7 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test · 107 unmodified lines
108 assert!(project_b.read_with(cx_b, |project, cx| project.is_read_only(cx)));108 assert!(project_b.read_with(cx_b, |project, cx| project.is_read_only(cx)));
109 assert!(editor_b.update(cx_b, |e, cx| e.read_only(cx)));109 assert!(editor_b.update(cx_b, |e, cx| e.read_only(cx)));
110 cx_b.update(|cx_b| {110 cx_b.update(|cx_b| {
111 assert!(room_b.read_with(cx_b, |room, cx| !room.can_use_microphone(cx)));111 assert!(room_b.read_with(cx_b, |room, _| !room.can_use_microphone()));
112 });112 });
113 assert!(room_b113 assert!(room_b
114 .update(cx_b, |room, cx| room.share_microphone(cx))114 .update(cx_b, |room, cx| room.share_microphone(cx))
@@ -136,7 +136,7 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test · 21 unmodified lines
136 136
137 // B sees themselves as muted, and can unmute.137 // B sees themselves as muted, and can unmute.
138 cx_b.update(|cx_b| {138 cx_b.update(|cx_b| {
139 assert!(room_b.read_with(cx_b, |room, cx| room.can_use_microphone(cx)));139 assert!(room_b.read_with(cx_b, |room, _| room.can_use_microphone()));
140 });140 });
141 room_b.read_with(cx_b, |room, _| assert!(room.is_muted()));141 room_b.read_with(cx_b, |room, _| assert!(room.is_muted()));
142 room_b.update(cx_b, |room, cx| room.toggle_mute(cx));142 room_b.update(cx_b, |room, cx| room.toggle_mute(cx));
@@ -231,7 +231,7 @@ async fn test_channel_requires_zed_cla(cx_a: &mut TestAppContext, cx_b: &mut Tes · 88 unmodified lines
231 .read(ActiveCall::global)231 .read(ActiveCall::global)
232 .update(cx_b, |call, _| call.room().unwrap().clone());232 .update(cx_b, |call, _| call.room().unwrap().clone());
233 cx_b.update(|cx_b| {233 cx_b.update(|cx_b| {
234 assert!(room_b.read_with(cx_b, |room, cx| !room.can_use_microphone(cx)));234 assert!(room_b.read_with(cx_b, |room, _| !room.can_use_microphone()));
235 });235 });
236 236
237 // A tries to grant write access to B, but cannot because B has not237 // A tries to grant write access to B, but cannot because B has not
@@ -251,7 +251,7 @@ async fn test_channel_requires_zed_cla(cx_a: &mut TestAppContext, cx_b: &mut Tes · 13 unmodified lines
251 cx_a.run_until_parked();251 cx_a.run_until_parked();
252 assert!(room_b.read_with(cx_b, |room, _| !room.can_share_projects()));252 assert!(room_b.read_with(cx_b, |room, _| !room.can_share_projects()));
253 cx_b.update(|cx_b| {253 cx_b.update(|cx_b| {
254 assert!(room_b.read_with(cx_b, |room, cx| !room.can_use_microphone(cx)));254 assert!(room_b.read_with(cx_b, |room, _| !room.can_use_microphone()));
255 });255 });
256 256
257 // A tries to grant write access to B, but cannot because B has not257 // A tries to grant write access to B, but cannot because B has not
@@ -271,7 +271,7 @@ async fn test_channel_requires_zed_cla(cx_a: &mut TestAppContext, cx_b: &mut Tes · 13 unmodified lines
271 cx_a.run_until_parked();271 cx_a.run_until_parked();
272 assert!(room_b.read_with(cx_b, |room, _| !room.can_share_projects()));272 assert!(room_b.read_with(cx_b, |room, _| !room.can_share_projects()));
273 cx_b.update(|cx_b| {273 cx_b.update(|cx_b| {
274 assert!(room_b.read_with(cx_b, |room, cx| room.can_use_microphone(cx)));274 assert!(room_b.read_with(cx_b, |room, _| room.can_use_microphone()));
275 });275 });
276 276
277 // User B signs the zed CLA.277 // User B signs the zed CLA.
@@ -298,6 +298,6 @@ async fn test_channel_requires_zed_cla(cx_a: &mut TestAppContext, cx_b: &mut Tes · 20 unmodified lines
298 cx_a.run_until_parked();298 cx_a.run_until_parked();
299 assert!(room_b.read_with(cx_b, |room, _| room.can_share_projects()));299 assert!(room_b.read_with(cx_b, |room, _| room.can_share_projects()));
300 cx_b.update(|cx_b| {300 cx_b.update(|cx_b| {
301 assert!(room_b.read_with(cx_b, |room, cx| room.can_use_microphone(cx)));301 assert!(room_b.read_with(cx_b, |room, _| room.can_use_microphone()));
302 });302 });
303}303}
crates/title_bar/src/collab.rs+1−1
@@ -295,7 +295,7 @@ impl TitleBar { · 294 unmodified lines
295 let muted_by_user = room.muted_by_user();295 let muted_by_user = room.muted_by_user();
296 let is_deafened = room.is_deafened().unwrap_or(false);296 let is_deafened = room.is_deafened().unwrap_or(false);
297 let is_screen_sharing = room.is_screen_sharing();297 let is_screen_sharing = room.is_screen_sharing();
298 let can_use_microphone = room.can_use_microphone(cx);298 let can_use_microphone = room.can_use_microphone();
299 let can_share_projects = room.can_share_projects();299 let can_share_projects = room.can_share_projects();
300 let screen_sharing_supported = match self.platform_style {300 let screen_sharing_supported = match self.platform_style {
301 PlatformStyle::Mac => true,301 PlatformStyle::Mac => true,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t