ALSA backend with pipwire-alsa buffer length mismatch causing xruns
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- audio-video-rtc
Direzione di ricerca
Start with the linked reproduction repository’s README and the CPAL ALSA backend’s buffer size handling; reproduce the reported xrun with the beep example and PipeWire quantum set to 2048. Compare default and explicit buffer sizes against the observations in the issue. Done when the backend avoids the reported underruns in the described setup or documents a clear supported workaround.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Repro repo with a detailed README: https://github.com/karolinepauls/cpal-alsa-buffer-repro
Problem: The existing "beep" example can produce a choppy sound when run over pipewire-alsa, and so can any other code that leaves the buffer size setting default. I've reproduced it with kira (which uses CPAL with ALSA) as well as my private sound engine using CPAL's ALSA backend. In all those cases, I've had constant underruns producing audio glitches.
I believe this is ultimately a pipewire-alsa problem. Still CPAL needs to help users avoid it. Could we
A) somehow read the actual buffer size used by the device and use that?
B) or at least suggest against using BufferSize::Default and set it to e.g.:
let buffer_size = if let &SupportedBufferSize::Range { min, max } = default_config.buffer_size()
{
2048.clamp(min, max)
} else {
2048
};
Abbreviated repro
-
Start
pw-topin background to monitor the quanta. -
Lock device quantum, as if another running application caused the quantum to be set (e.g. Firefox playing a video).
pw-metadata -n settings 0 clock.force-quantum 2048
- Run, requesting default buffer size:
cargo run
Result: running with a buffer size of 512, choppy sound.
- Run, requesting an explicit buffer size of 512:
cargo run -- --buffer-size 512
Same effect.
- Run, requesting a buffer size of at least 1024:
cargo run -- --buffer-size 1024
Result: clean sine.
- Run with a buffer size of 512 but also ensure that pipewire runs with it.
pw-metadata -n settings 0 clock.force-quantum 512
cargo run -- --buffer-size 512
Result: clean sine.
Observations
For some reason an app buffer size of 512 doesn't work with a device buffer size of 2048. At least with pipewire-alsa.
| app | device | result |
|---|---|---|
| 512 | 512 | ok |
| default | 2048 | xrun |
| 512 | 2048 | xrun |
| 1024 | 2048 | ok |
| 2048 | 2048 | ok |
Versions
pipewire:
Compiled with libpipewire 1.6.2
Linked with libpipewire 1.6.2
Kubuntu 26.04.1 LTS
CPAL: git 79275c2313da30e9f8b1ad8168385d091a2c9ada (current master).
- Lingua principale
- Rust
- Stelle
- 4k
- Fork
- 554
- Merge medio
- 2g 11h
- PR unite (30g)
- 3
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di RustAudio/cpal
-
aaudio: dynamic buffer tuning never grows the buffer (set_buffer_size_in_frames reports Err on success)Forse già presa @dannyward630 l’ha presa 1 giorno fa. Apertahost - aaudio platform - android
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
WebAudio wasm build fails with wasm-bindgen panic=unwind closuresForse già presa @bogusyogi l’ha presa 10 giorni fa. Apertahost - webaudio platform - web
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
RustAudio/cpal#1394 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
New WASAPI implementationApertacode quality dependencies host - wasapi platform - windows
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
RustAudio/cpal#1416 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
host - pipewire platform - linux
Difficoltà 4/5 1-2 giorni Idoneità per principianti 52/100
RustAudio/cpal#1405 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
WASAPI: default-device activation fails with RPC_E_CHANGED_MODE after endpoint-notification callbacks put thread-pool threads into an STAForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertacorrectness host - wasapi platform - windows
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
RustAudio/cpal#1402 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di RustAudio/cpal
Issue simili
-
area:io kernel-paused needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bherbruck/solvecraft#7854 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
transit-audio/transit#159 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
HakanSeven12/OpenCADStudio#2257 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
priority: low ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
storytold/photocraft#9884 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
triage: new type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
Jagalite/superseedr#376 ·
I maintainer di solito rispondono entro 1 giorno