feat(client): protocol v2 wire layer, screen sharing, channel webhooks and secure voice
Verified against the real gateway via tests/gateway_interop.rs.
This commit is contained in:
parent
8460fb28fd
commit
3d7dd5413b
65 changed files with 6048 additions and 1156 deletions
|
|
@ -1,4 +1,6 @@
|
|||
mod capture;
|
||||
mod media;
|
||||
pub use media::MediaMixer;
|
||||
mod playback;
|
||||
|
||||
use cpal::traits::DeviceTrait;
|
||||
|
|
@ -19,6 +21,8 @@ pub use playback::JitterConfig;
|
|||
pub struct AudioPipeline {
|
||||
stopped: Arc<AtomicBool>,
|
||||
encoded_rx: Receiver<EncodedFrame>,
|
||||
microphone_tap: media::MicrophoneTap,
|
||||
media_mixer: MediaMixer,
|
||||
voice_tx: Sender<IncomingVoice>,
|
||||
_encoded_tx: Sender<EncodedFrame>,
|
||||
gate: Arc<Mutex<TransmitGate>>,
|
||||
|
|
@ -35,10 +39,22 @@ impl Drop for AudioPipeline {
|
|||
fn drop(&mut self) {
|
||||
// Releasing a voice session must release its microphone even while muted.
|
||||
self.stopped.store(true, Ordering::Release);
|
||||
self.microphone_tap.enable(false);
|
||||
self.media_mixer.clear();
|
||||
}
|
||||
}
|
||||
|
||||
impl AudioPipeline {
|
||||
pub fn enable_media_microphone(&self, enabled: bool) {
|
||||
self.microphone_tap.enable(enabled);
|
||||
}
|
||||
pub fn poll_media_microphone(&self) -> Option<crate::media::AudioFrame> {
|
||||
self.microphone_tap.pop()
|
||||
}
|
||||
pub fn media_mixer(&self) -> MediaMixer {
|
||||
self.media_mixer.clone()
|
||||
}
|
||||
|
||||
pub fn poll_encoded(&self) -> Option<EncodedFrame> {
|
||||
self.encoded_rx.try_recv().ok()
|
||||
}
|
||||
|
|
@ -111,6 +127,10 @@ pub fn start(cfg: PipelineConfig) -> anyhow::Result<AudioPipeline> {
|
|||
let in_cfg = config::AudioConfig::find(&input, true)?;
|
||||
let out_cfg = config::AudioConfig::find(&output, false)?;
|
||||
let frame_ms = config::frame_ms_from_interval(cfg.packet_interval);
|
||||
let microphone_tap = media::MicrophoneTap::default();
|
||||
let tap_capture = microphone_tap.clone();
|
||||
let media_mixer = MediaMixer::new(out_cfg.sample_rate);
|
||||
let mixer_playback = media_mixer.clone();
|
||||
|
||||
let (encoded_tx, encoded_rx) = mpsc::channel::<EncodedFrame>();
|
||||
let (voice_tx, voice_rx) = mpsc::channel::<IncomingVoice>();
|
||||
|
|
@ -148,6 +168,7 @@ pub fn start(cfg: PipelineConfig) -> anyhow::Result<AudioPipeline> {
|
|||
bitrate_cap,
|
||||
local_speaking_cap,
|
||||
capture_stopped,
|
||||
tap_capture,
|
||||
) {
|
||||
tracing::error!("capture: {e}");
|
||||
}
|
||||
|
|
@ -160,6 +181,7 @@ pub fn start(cfg: PipelineConfig) -> anyhow::Result<AudioPipeline> {
|
|||
vol_play,
|
||||
jitter_play,
|
||||
last_remote_voice_play,
|
||||
mixer_playback,
|
||||
) {
|
||||
tracing::error!("playback: {e}");
|
||||
}
|
||||
|
|
@ -168,6 +190,8 @@ pub fn start(cfg: PipelineConfig) -> anyhow::Result<AudioPipeline> {
|
|||
Ok(AudioPipeline {
|
||||
stopped,
|
||||
encoded_rx,
|
||||
microphone_tap,
|
||||
media_mixer,
|
||||
voice_tx,
|
||||
_encoded_tx: encoded_tx,
|
||||
gate,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue