fix(server): decode mic uplink before UAC sink
This commit is contained in:
parent
4084c5c781
commit
5e6935121a
@ -510,6 +510,14 @@ impl Voice {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// dedicated AppSrc helpers exist and avoid the needless `?`
|
// dedicated AppSrc helpers exist and avoid the needless `?`
|
||||||
|
appsrc.set_caps(Some(
|
||||||
|
&gst::Caps::builder("audio/mpeg")
|
||||||
|
.field("mpegversion", 4i32)
|
||||||
|
.field("stream-format", "adts")
|
||||||
|
.field("rate", 48_000i32)
|
||||||
|
.field("channels", 2i32)
|
||||||
|
.build(),
|
||||||
|
));
|
||||||
appsrc.set_format(gst::Format::Time);
|
appsrc.set_format(gst::Format::Time);
|
||||||
appsrc.set_is_live(true);
|
appsrc.set_is_live(true);
|
||||||
|
|
||||||
@ -570,6 +578,33 @@ impl Voice {
|
|||||||
let _ = pad.link(&convert_sink);
|
let _ = pad.link(&convert_sink);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let bus = pipeline.bus().context("voice pipeline bus")?;
|
||||||
|
std::thread::spawn(move || {
|
||||||
|
for msg in bus.iter_timed(gst::ClockTime::NONE) {
|
||||||
|
match msg.view() {
|
||||||
|
Error(e) => error!(
|
||||||
|
"🎤💥 voice pipeline from {:?}: {} ({})",
|
||||||
|
msg.src().map(gst::prelude::GstObjectExt::path_string),
|
||||||
|
e.error(),
|
||||||
|
e.debug().unwrap_or_default()
|
||||||
|
),
|
||||||
|
Warning(w) => warn!(
|
||||||
|
"🎤⚠️ voice pipeline from {:?}: {} ({})",
|
||||||
|
msg.src().map(gst::prelude::GstObjectExt::path_string),
|
||||||
|
w.error(),
|
||||||
|
w.debug().unwrap_or_default()
|
||||||
|
),
|
||||||
|
StateChanged(s)
|
||||||
|
if s.current() == gst::State::Playing
|
||||||
|
&& msg.src().map(|s| s.is::<gst::Pipeline>()).unwrap_or(false) =>
|
||||||
|
{
|
||||||
|
debug!("🎤 voice pipeline ▶️")
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// underrun ≠ error – just show a warning
|
// underrun ≠ error – just show a warning
|
||||||
// let _id = alsa_sink.connect("underrun", false, |_| {
|
// let _id = alsa_sink.connect("underrun", false, |_| {
|
||||||
// tracing::warn!("⚠️ USB playback underrun – host muted/not reading");
|
// tracing::warn!("⚠️ USB playback underrun – host muted/not reading");
|
||||||
|
|||||||
@ -686,8 +686,8 @@ impl Relay for Handler {
|
|||||||
|
|
||||||
while let Some(pkt) = inbound.next().await.transpose()? {
|
while let Some(pkt) = inbound.next().await.transpose()? {
|
||||||
let n = CNT.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
let n = CNT.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
||||||
if n < 10 || n % 300 == 0 {
|
if n < 5 || n % 3_000 == 0 {
|
||||||
tracing::trace!(rpc_id, "🎤⬇ srv pkt#{n} {} bytes", pkt.data.len());
|
tracing::info!(rpc_id, "🎤⬇ srv pkt#{n} {} bytes", pkt.data.len());
|
||||||
}
|
}
|
||||||
sink.push(&pkt);
|
sink.push(&pkt);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user