Audio Fix
This commit is contained in:
parent
1d54293311
commit
37f3202857
@ -131,7 +131,9 @@ pub async fn ear(alsa_dev: &str, id: u32) -> anyhow::Result<AudioStream> {
|
|||||||
// ─── server/src/audio.rs: build_pipeline_desc() (replace entire fn) ─────────
|
// ─── server/src/audio.rs: build_pipeline_desc() (replace entire fn) ─────────
|
||||||
fn build_pipeline_desc(dev: &str) -> anyhow::Result<String> {
|
fn build_pipeline_desc(dev: &str) -> anyhow::Result<String> {
|
||||||
let reg = gst::Registry::get();
|
let reg = gst::Registry::get();
|
||||||
let enc = ["fdkaacenc", "voaacenc", "avenc_aac"]
|
|
||||||
|
// Pick the first available encoder
|
||||||
|
let enc = ["avenc_aac", "fdkaacenc", "voaacenc"]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.find(|&e| {
|
.find(|&e| {
|
||||||
reg.find_plugin(e).is_some()
|
reg.find_plugin(e).is_some()
|
||||||
@ -139,10 +141,13 @@ fn build_pipeline_desc(dev: &str) -> anyhow::Result<String> {
|
|||||||
})
|
})
|
||||||
.ok_or_else(|| anyhow!("no AAC encoder plugin available"))?;
|
.ok_or_else(|| anyhow!("no AAC encoder plugin available"))?;
|
||||||
|
|
||||||
|
// All encoders are asked for raw elementary AAC; aacparse +
|
||||||
|
// capsfilter converts it to **ADTS** unconditionally.
|
||||||
Ok(format!(
|
Ok(format!(
|
||||||
"alsasrc device=\"{dev}\" do-timestamp=true ! \
|
"alsasrc device=\"{dev}\" do-timestamp=true ! \
|
||||||
audio/x-raw,channels=2,rate=48000 ! {enc} bitrate=192000 ! \
|
audio/x-raw,channels=2,rate=48000 ! {enc} bitrate=192000 ! \
|
||||||
aacparse add-adts=true ! \
|
aacparse ! \
|
||||||
|
capsfilter caps=audio/mpeg,stream-format=adts,channels=2,rate=48000 ! \
|
||||||
queue ! appsink name=asink emit-signals=true"
|
queue ! appsink name=asink emit-signals=true"
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user