summaryrefslogtreecommitdiff
path: root/examples/host/audio_host/src/audio_app.c
diff options
context:
space:
mode:
authorHiFiPHile <[email protected]>2026-08-25 09:29:07 +0200
committerHiFiPHile <[email protected]>2026-08-25 09:29:07 +0200
commitea7d4ef12a4cd2b6fb6986a091888bc838b12574 (patch)
tree95c485b8e14ab714010a04a9bea1bf2c40695b2d /examples/host/audio_host/src/audio_app.c
parentad9ecddd7f51ede415992397b82399d7a2639c0f (diff)
fix(audio): discard capture data without playback
Continue draining the capture FIFO but skip channel conversion and writes when playback is unavailable or intentionally stopped. This keeps capture running safely in microphone-only phases. Signed-off-by: HiFiPHile <[email protected]>
Diffstat (limited to 'examples/host/audio_host/src/audio_app.c')
-rw-r--r--examples/host/audio_host/src/audio_app.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/host/audio_host/src/audio_app.c b/examples/host/audio_host/src/audio_app.c
index 0c4ed8a23..3102c28c9 100644
--- a/examples/host/audio_host/src/audio_app.c
+++ b/examples/host/audio_host/src/audio_app.c
@@ -287,6 +287,9 @@ void audio_app_task_read(void) {
if (frames == 0) {
return;
}
+ if (!spk_ready) {
+ return; // capture-only device or playback intentionally stopped
+ }
if (spk_config.channels == mic_config.channels) {
memcpy(spk_samples, mic_samples, frames * mic_config.channels * sizeof(int16_t));