turn mic off by default in dev builds, add enviroment variable for turning it back on

This commit is contained in:
Mikayla Maki 2023-06-16 10:44:00 -07:00
parent dedc117cca
commit 53062e8422
No known key found for this signature in database

View file

@ -13,12 +13,13 @@ use futures::{FutureExt, StreamExt};
use gpui::{AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle, Task, WeakModelHandle}; use gpui::{AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle, Task, WeakModelHandle};
use language::LanguageRegistry; use language::LanguageRegistry;
use live_kit_client::{ use live_kit_client::{
LocalAudioTrack, LocalTrackPublication, LocalVideoTrack, RemoteVideoTrackUpdate, RemoteAudioTrackUpdate, LocalAudioTrack, LocalTrackPublication, LocalVideoTrack, RemoteAudioTrackUpdate,
RemoteVideoTrackUpdate,
}; };
use postage::stream::Stream; use postage::stream::Stream;
use project::Project; use project::Project;
use std::{future::Future, mem, pin::Pin, sync::Arc, time::Duration}; use std::{future::Future, mem, pin::Pin, sync::Arc, time::Duration};
use util::{post_inc, ResultExt, TryFutureExt}; use util::{channel::ReleaseChannel, post_inc, ResultExt, TryFutureExt};
pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30); pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30);
@ -218,11 +219,12 @@ impl Room {
None None
}; };
let share_mic = room.update(&mut cx, |room, cx| { if option_env!("START_MIC").is_some()
room.share_mic(cx) || &*util::channel::RELEASE_CHANNEL != &ReleaseChannel::Dev
}); {
let share_mic = room.update(&mut cx, |room, cx| room.share_mic(cx));
cx.background().spawn(share_mic).detach(); cx.background().spawn(share_mic).detach();
}
match room match room
.update(&mut cx, |room, cx| { .update(&mut cx, |room, cx| {
@ -653,7 +655,8 @@ impl Room {
if let Some(live_kit) = this.live_kit.as_ref() { if let Some(live_kit) = this.live_kit.as_ref() {
let video_tracks = let video_tracks =
live_kit.room.remote_video_tracks(&user.id.to_string()); live_kit.room.remote_video_tracks(&user.id.to_string());
let audio_tracks = live_kit.room.remote_audio_tracks(&user.id.to_string()); let audio_tracks =
live_kit.room.remote_audio_tracks(&user.id.to_string());
for track in video_tracks { for track in video_tracks {
this.remote_video_track_updated( this.remote_video_track_updated(
RemoteVideoTrackUpdate::Subscribed(track), RemoteVideoTrackUpdate::Subscribed(track),
@ -662,7 +665,10 @@ impl Room {
.log_err(); .log_err();
} }
for track in audio_tracks { for track in audio_tracks {
this.remote_audio_track_updated(RemoteAudioTrackUpdate::Subscribed(track), cx) this.remote_audio_track_updated(
RemoteAudioTrackUpdate::Subscribed(track),
cx,
)
.log_err(); .log_err();
} }
} }
@ -782,10 +788,7 @@ impl Room {
.remote_participants .remote_participants
.get_mut(&user_id) .get_mut(&user_id)
.ok_or_else(|| anyhow!("subscribed to track by unknown participant"))?; .ok_or_else(|| anyhow!("subscribed to track by unknown participant"))?;
participant.audio_tracks.insert( participant.audio_tracks.insert(track_id.clone(), track);
track_id.clone(),
track,
);
cx.emit(Event::RemoteAudioTracksChanged { cx.emit(Event::RemoteAudioTracksChanged {
participant_id: participant.peer_id, participant_id: participant.peer_id,
}); });