Make Linux audio public (#23191)
Release Notes: - Added a way to use audio in rooms with Linux builds
This commit is contained in:
Generated
-1
@@ -2039,7 +2039,6 @@ dependencies = [
|
|||||||
"audio",
|
"audio",
|
||||||
"client",
|
"client",
|
||||||
"collections",
|
"collections",
|
||||||
"feature_flags",
|
|
||||||
"fs",
|
"fs",
|
||||||
"futures 0.3.31",
|
"futures 0.3.31",
|
||||||
"gpui",
|
"gpui",
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ anyhow.workspace = true
|
|||||||
audio.workspace = true
|
audio.workspace = true
|
||||||
client.workspace = true
|
client.workspace = true
|
||||||
collections.workspace = true
|
collections.workspace = true
|
||||||
feature_flags.workspace = true
|
|
||||||
fs.workspace = true
|
fs.workspace = true
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
|
|||||||
@@ -1304,13 +1304,12 @@ impl Room {
|
|||||||
self.live_kit.as_ref().map(|live_kit| live_kit.deafened)
|
self.live_kit.as_ref().map(|live_kit| live_kit.deafened)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn can_use_microphone(&self, _cx: &AppContext) -> bool {
|
pub fn can_use_microphone(&self) -> bool {
|
||||||
use proto::ChannelRole::*;
|
use proto::ChannelRole::*;
|
||||||
|
|
||||||
#[cfg(not(any(test, feature = "test-support")))]
|
#[cfg(not(any(test, feature = "test-support")))]
|
||||||
{
|
{
|
||||||
use feature_flags::FeatureFlagAppExt as _;
|
if cfg!(target_os = "windows") {
|
||||||
if cfg!(target_os = "windows") || (cfg!(target_os = "linux") && !_cx.is_staff()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1684,7 +1683,7 @@ fn spawn_room_connection(
|
|||||||
_handle_updates,
|
_handle_updates,
|
||||||
});
|
});
|
||||||
|
|
||||||
if !muted_by_user && this.can_use_microphone(cx) {
|
if !muted_by_user && this.can_use_microphone() {
|
||||||
this.share_microphone(cx)
|
this.share_microphone(cx)
|
||||||
} else {
|
} else {
|
||||||
Task::ready(Ok(()))
|
Task::ready(Ok(()))
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ impl Room {
|
|||||||
cx.spawn(|this, mut cx| async move {
|
cx.spawn(|this, mut cx| async move {
|
||||||
connect.await?;
|
connect.await?;
|
||||||
this.update(&mut cx, |this, cx| {
|
this.update(&mut cx, |this, cx| {
|
||||||
if this.can_use_microphone(cx) {
|
if this.can_use_microphone() {
|
||||||
if let Some(live_kit) = &this.live_kit {
|
if let Some(live_kit) = &this.live_kit {
|
||||||
if !live_kit.muted_by_user && !live_kit.deafened {
|
if !live_kit.muted_by_user && !live_kit.deafened {
|
||||||
return this.share_microphone(cx);
|
return this.share_microphone(cx);
|
||||||
@@ -1323,7 +1323,7 @@ impl Room {
|
|||||||
self.live_kit.as_ref().map(|live_kit| live_kit.deafened)
|
self.live_kit.as_ref().map(|live_kit| live_kit.deafened)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn can_use_microphone(&self, _cx: &AppContext) -> bool {
|
pub fn can_use_microphone(&self) -> bool {
|
||||||
use proto::ChannelRole::*;
|
use proto::ChannelRole::*;
|
||||||
match self.local_participant.role {
|
match self.local_participant.role {
|
||||||
Admin | Member | Talker => true,
|
Admin | Member | Talker => true,
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test
|
|||||||
assert!(project_b.read_with(cx_b, |project, cx| project.is_read_only(cx)));
|
assert!(project_b.read_with(cx_b, |project, cx| project.is_read_only(cx)));
|
||||||
assert!(editor_b.update(cx_b, |e, cx| e.read_only(cx)));
|
assert!(editor_b.update(cx_b, |e, cx| e.read_only(cx)));
|
||||||
cx_b.update(|cx_b| {
|
cx_b.update(|cx_b| {
|
||||||
assert!(room_b.read_with(cx_b, |room, cx| !room.can_use_microphone(cx)));
|
assert!(room_b.read_with(cx_b, |room, _| !room.can_use_microphone()));
|
||||||
});
|
});
|
||||||
assert!(room_b
|
assert!(room_b
|
||||||
.update(cx_b, |room, cx| room.share_microphone(cx))
|
.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
|
|||||||
|
|
||||||
// B sees themselves as muted, and can unmute.
|
// B sees themselves as muted, and can unmute.
|
||||||
cx_b.update(|cx_b| {
|
cx_b.update(|cx_b| {
|
||||||
assert!(room_b.read_with(cx_b, |room, cx| room.can_use_microphone(cx)));
|
assert!(room_b.read_with(cx_b, |room, _| room.can_use_microphone()));
|
||||||
});
|
});
|
||||||
room_b.read_with(cx_b, |room, _| assert!(room.is_muted()));
|
room_b.read_with(cx_b, |room, _| assert!(room.is_muted()));
|
||||||
room_b.update(cx_b, |room, cx| room.toggle_mute(cx));
|
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
|
|||||||
.read(ActiveCall::global)
|
.read(ActiveCall::global)
|
||||||
.update(cx_b, |call, _| call.room().unwrap().clone());
|
.update(cx_b, |call, _| call.room().unwrap().clone());
|
||||||
cx_b.update(|cx_b| {
|
cx_b.update(|cx_b| {
|
||||||
assert!(room_b.read_with(cx_b, |room, cx| !room.can_use_microphone(cx)));
|
assert!(room_b.read_with(cx_b, |room, _| !room.can_use_microphone()));
|
||||||
});
|
});
|
||||||
|
|
||||||
// A tries to grant write access to B, but cannot because B has not
|
// 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
|
|||||||
cx_a.run_until_parked();
|
cx_a.run_until_parked();
|
||||||
assert!(room_b.read_with(cx_b, |room, _| !room.can_share_projects()));
|
assert!(room_b.read_with(cx_b, |room, _| !room.can_share_projects()));
|
||||||
cx_b.update(|cx_b| {
|
cx_b.update(|cx_b| {
|
||||||
assert!(room_b.read_with(cx_b, |room, cx| !room.can_use_microphone(cx)));
|
assert!(room_b.read_with(cx_b, |room, _| !room.can_use_microphone()));
|
||||||
});
|
});
|
||||||
|
|
||||||
// A tries to grant write access to B, but cannot because B has not
|
// 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
|
|||||||
cx_a.run_until_parked();
|
cx_a.run_until_parked();
|
||||||
assert!(room_b.read_with(cx_b, |room, _| !room.can_share_projects()));
|
assert!(room_b.read_with(cx_b, |room, _| !room.can_share_projects()));
|
||||||
cx_b.update(|cx_b| {
|
cx_b.update(|cx_b| {
|
||||||
assert!(room_b.read_with(cx_b, |room, cx| room.can_use_microphone(cx)));
|
assert!(room_b.read_with(cx_b, |room, _| room.can_use_microphone()));
|
||||||
});
|
});
|
||||||
|
|
||||||
// User B signs the zed CLA.
|
// 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
|
|||||||
cx_a.run_until_parked();
|
cx_a.run_until_parked();
|
||||||
assert!(room_b.read_with(cx_b, |room, _| room.can_share_projects()));
|
assert!(room_b.read_with(cx_b, |room, _| room.can_share_projects()));
|
||||||
cx_b.update(|cx_b| {
|
cx_b.update(|cx_b| {
|
||||||
assert!(room_b.read_with(cx_b, |room, cx| room.can_use_microphone(cx)));
|
assert!(room_b.read_with(cx_b, |room, _| room.can_use_microphone()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ impl TitleBar {
|
|||||||
let muted_by_user = room.muted_by_user();
|
let muted_by_user = room.muted_by_user();
|
||||||
let is_deafened = room.is_deafened().unwrap_or(false);
|
let is_deafened = room.is_deafened().unwrap_or(false);
|
||||||
let is_screen_sharing = room.is_screen_sharing();
|
let is_screen_sharing = room.is_screen_sharing();
|
||||||
let can_use_microphone = room.can_use_microphone(cx);
|
let can_use_microphone = room.can_use_microphone();
|
||||||
let can_share_projects = room.can_share_projects();
|
let can_share_projects = room.can_share_projects();
|
||||||
let screen_sharing_supported = match self.platform_style {
|
let screen_sharing_supported = match self.platform_style {
|
||||||
PlatformStyle::Mac => true,
|
PlatformStyle::Mac => true,
|
||||||
|
|||||||
Reference in New Issue
Block a user