Mic Setup
This commit is contained in:
parent
02bdc5d76b
commit
ff44b6fbe7
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
use std::sync::Arc;
|
||||||
use tokio::sync::broadcast;
|
use tokio::sync::broadcast;
|
||||||
use tokio_stream::{wrappers::BroadcastStream, StreamExt};
|
use tokio_stream::{wrappers::BroadcastStream, StreamExt};
|
||||||
use tonic::{transport::Channel, Request};
|
use tonic::{transport::Channel, Request};
|
||||||
@ -262,18 +263,25 @@ impl LesavkaClientApp {
|
|||||||
if let Some(pkt) = mic_clone.pull() {
|
if let Some(pkt) = mic_clone.pull() {
|
||||||
yield pkt;
|
yield pkt;
|
||||||
} else {
|
} else {
|
||||||
break; // EOS – should not happen
|
break; // EOS (should never happen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
match cli.stream_microphone(Request::new(stream)).await {
|
match cli.stream_microphone(Request::new(stream)).await {
|
||||||
Ok(mut resp) => {
|
Ok(mut resp) => {
|
||||||
while resp.get_mut().message().await?.is_some() {}
|
// Drain the (mostly empty) response stream
|
||||||
|
while let Some(res) = resp.get_mut().message().await.transpose() {
|
||||||
|
if let Err(e) = res {
|
||||||
|
warn!("🎤 server err: {e}");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(e) => warn!("🎤 connect failed: {e}"),
|
Err(e) => warn!("🎤 connect failed: {e}"),
|
||||||
}
|
}
|
||||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
|
||||||
|
tokio::time::sleep(Duration::from_secs(1)).await; // retry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user