AAudio: output `playback` timestamp seconds ahead after `pause()` then `play()`
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 54/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- android, rust
- Ambito
- audio-video-rtc, backend
Direzione di ricerca
Start by reading output_stream_instant and monotonic_output_callback in the AAudio output stream code, then trace how pause and play affect the frame position and frames written used for timestamp projection. Reproduce the reported sequence and check how invalid timestamps fall back. Done means playback timestamps after resuming stay near the callback time and latency remains reasonable without breaking normal output timestamps.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
AAudio: output playback timestamp seconds ahead after pause() then play()
cpal 0.18.2, AAudio host, Android 16 (Pixel 11 Pro), output stream.
What happens
After an output stream is paused with StreamTrait::pause() and started
again with play(), OutputCallbackInfo::timestamp().playback lies seconds
in the future. The difference to callback (the output latency) was about
13.9 s in one run and 40 s in another, instead of about 13 ms. Because
monotonic_output_callback keeps playback from going back, the wrong value
then holds, and the latency only shrinks as time passes.
Why
output_stream_instant projects AAudioStream_getTimestamp's anchor (frame
position and time) to the callback's first frame using
AAudioStream_getFramesWritten. After the pause, the two no longer count
from the same origin: the frame position starts over lower, while the frames
written carry on. Readings we logged in the data callback:
| frame position | frames written | written − position | |
|---|---|---|---|
last callback before pause() |
734 832 | 738 240 | 3 408 (71 ms) |
first callback after play() |
getTimestamp failed |
738 432 | – |
| a few seconds later | 149 328 | 814 848 | 665 520 (13 865 ms) |
The first callback after play() falls back to now() (no latency), so the
next good reading is far ahead of it, and the monotonic hold keeps it.
Possible fixes
- Treat a projected
playbackfurther ahead than the stream's buffer
capacity as not valid (fall back as on a failedgetTimestamp), or - re-anchor after
play(): take the frames written at the first successful
timestamp after a start, or - document that a paused AAudio output stream gives wrong timestamps until
recreated.
We work around it by closing the stream instead of pausing it, and opening a
new one when the app comes back.
- Lingua principale
- Rust
- Stelle
- 4k
- Fork
- 554
- Merge medio
- 1g 3h
- PR unite (30g)
- 1
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
-
API design
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
-
correctness
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
aaudio: dynamic buffer tuning never grows the buffer (set_buffer_size_in_frames reports Err on success)Forse già presa @dannyward630 l’ha presa 39 giorni fa. Apertahost - aaudio platform - android
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
-
WebAudio wasm build fails with wasm-bindgen panic=unwind closuresForse già presa @bogusyogi l’ha presa 48 giorni fa. Apertahost - webaudio platform - web
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
PipeWire: dropping callback captures on the realtime worker can terminate the process with SIGXCPUApertahost - pipewire platform - linux
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
Tutte le issue di RustAudio/cpal
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
ci: migrate pinned macos-15 runners to macos-26 and macos-26-intelForse già presa @hawkingrei l’ha presa oggi. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
nowledge-co/hawdb#2224 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
eclipse-score/coverage_tool#95 ·
I maintainer di solito rispondono entro 2 giorni
-
bug nvim
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100