zephyr-cp: audiobusio.I2SOut.playing never becomes False after a non-looping sample finishes
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- c
- Área
- embedded-iot
Línea de trabajo
Start in ports/zephyr-cp/common-hal/audiobusio/I2SOut.c, tracing fill_buffer(), the audio thread's exit, and common_hal_audiobusio_i2sout_get_playing(). Then investigate how Zephyr reports that I2S draining has completed and how thread/slab resources are safely released. Done means a non-looping sample finishes draining without its tail being dropped, playing becomes false, and resources can be used safely by a subsequent play().
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Note: This issue was written by Claude (via Claude Code), not by a human. It was filed at the request of @dhalbert while working on the fixes for #10539.
Summary
On the zephyr-cp port, audiobusio.I2SOut has no end-of-playback detection. After a non-looping sample (loop=False) finishes, I2SOut.playing stays True indefinitely — it is only ever cleared by an explicit stop() (or a write error). So the common idiom
i2s.play(sample, loop=False)
while i2s.playing:
pass
hangs forever.
Where
ports/zephyr-cp/common-hal/audiobusio/I2SOut.c
common_hal_audiobusio_i2sout_get_playing()simply returnsself->playing.self->playingis setFalseonly incommon_hal_audiobusio_i2sout_stop()and on ani2s_writeerror.- When a non-looping sample ends,
fill_buffer()setsself->stopping = trueand triggersI2S_TRIGGER_DRAIN; the audio thread then exits — but leavesself->playing == true.
Relationship to #10539
The single-buffer loop=False "no sound" bug (the final GET_BUFFER_DONE buffer being dropped before it was copied) was fixed for zephyr-cp as part of the #10539 work. This playing-never-clears problem is a separate, deeper gap and was deliberately scoped out, because a correct fix is non-trivial in the current design:
- The audio thread cannot clean itself up (it can't
k_thread_join/free from within itself, and settingplaying = falsethere would break the nextplay(), which guards onplaying). - Clearing it from
get_playing()by callingstop()would issueI2S_TRIGGER_DROP, discarding the still-draining tail blocks (theDRAINjust triggered) and cutting off the end of the sample. - Doing it cleanly requires waiting until the I2S peripheral has actually finished draining (a driver-state query the code does not currently perform) before finalizing and freeing resources.
Suggested direction
Add drain-aware completion detection: once the sample is exhausted and the queued blocks have fully drained, clear playing and release the thread/slab resources — without dropping the tail. This likely needs a Zephyr I2S state query and/or coordination with the audio thread's exit.
Notes
- Affects any non-looping sample on zephyr-cp, not just single-buffer
RawSample;WaveFilewithloop=Falsewould exhibit the same stuckplaying. - Other ports (espressif, nordic, raspberrypi, atmel-samd, ...) clear
playingon completion; this gap is specific to zephyr-cp.
- Lenguaje dominante
- C
- Estrellas
- 4.6k
- Forks
- 1.4k
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 153
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de adafruit/circuitpython
-
board breaks api
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
adafruit/circuitpython#11099 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Pico-W: shrink firmware regionAbiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
adafruit/circuitpython#11515 ·
Los mantenedores suelen responder en 1 día
-
Tags and BranchesAbiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
adafruit/circuitpython#11514 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
Move silabs to ZephyrAbiertosilabs
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
adafruit/circuitpython#11507 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Feature/API request: portable camera capture across ESP-IDF, Zephyr, and parallel interfacesAbiertocircuitpython api enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
adafruit/circuitpython#11505 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de adafruit/circuitpython
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
chore(gateway): emit INFO budget reserved/settled logs for proactivity v2 (chip task_2855f4ec)Abiertobackend
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
BasedHardware/omi#20940 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Linux notifications: the default action's ' ' label shows as a blank button in xfce4-notifydAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
kovidgoyal/kitty#10625 ·
Los mantenedores suelen responder en 1 día
-
Feature Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
Los mantenedores suelen responder en 1 día