From d52a6f8a1dfe3fbb0cf363dff5a59e75e7723c98 Mon Sep 17 00:00:00 2001 From: Griffin Obeid Date: Tue, 19 Dec 2023 17:08:09 -0500 Subject: [PATCH] Add comment --- video-daemon/src/microphone.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/video-daemon/src/microphone.rs b/video-daemon/src/microphone.rs index c48326bf..6f0dfc67 100644 --- a/video-daemon/src/microphone.rs +++ b/video-daemon/src/microphone.rs @@ -89,7 +89,9 @@ fn start_microphone(device: String, quic_tx: Sender>, email: String, sto cpal::SampleFormat::I16 => device.build_input_stream( &config.into(), move |data, _: &_| { - // Chunk data into 1024 samples. + // XXX TODO: We are dropping data here because OPUS requires the chunks to be + // 960, but we are receiving 4096 from cpal stream + // So we need to fix this to not drop any of the data for chunk in data.chunks_exact(960) { match encode_and_send_i16(chunk, &mut encoder, &quic_tx, email.clone()) { Ok(_) => {} @@ -105,6 +107,9 @@ fn start_microphone(device: String, quic_tx: Sender>, email: String, sto cpal::SampleFormat::F32 => device.build_input_stream( &config.into(), move |data, _: &_| { + // XXX TODO: We are dropping data here because OPUS requires the chunks to be + // 960, but we are receiving 4096 from cpal stream + // So we need to fix this to not drop any of the data for chunk in data.chunks_exact(960) { match encode_and_send_f32(chunk, &mut encoder, &quic_tx, email.clone()) { Ok(_) => {}