feat: remote mixer part 4

This commit is contained in:
Ahmet Kaan Gümüş 2025-05-20 05:44:00 +03:00
parent 50917c09d5
commit 35ebb58698
6 changed files with 64 additions and 145 deletions

View file

@ -1,6 +1,6 @@
use std::{net::SocketAddr, path::Path, sync::Arc};
use protocol::{BUFFER_LENGTH, Error};
use protocol::Error;
use s2n_quic::{
Client,
client::Connect,
@ -11,7 +11,7 @@ use tokio::{
sync::{broadcast, oneshot},
};
use crate::{ClientConfig, voice::play};
use crate::{ClientConfig, SPEAKER_BUFFER_LENGHT, voice::play};
pub async fn connect(
connection_stop_signal_receiver: oneshot::Receiver<bool>,
@ -51,7 +51,7 @@ pub async fn connect(
.await
.map_err(|err_val| Error::ConnectionSetup(err_val.to_string()))?;
let (receive_stream, send_stream) = stream.split();
let (speaker_sender, speaker_receiver) = broadcast::channel(BUFFER_LENGTH);
let (speaker_sender, speaker_receiver) = broadcast::channel(SPEAKER_BUFFER_LENGHT);
let (speaker_stop_signal_sender, speaker_stop_signal_receiver) = oneshot::channel();
tokio::spawn(play(speaker_receiver, speaker_stop_signal_receiver));
let receive_voice_data_task = tokio::spawn(receive_audio_data(receive_stream, speaker_sender));