Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
griffobeid committed Dec 19, 2023
1 parent 9d6e356 commit d52a6f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion video-daemon/src/microphone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ fn start_microphone(device: String, quic_tx: Sender<Vec<u8>>, 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(_) => {}
Expand All @@ -105,6 +107,9 @@ fn start_microphone(device: String, quic_tx: Sender<Vec<u8>>, 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(_) => {}
Expand Down

0 comments on commit d52a6f8

Please sign in to comment.