From f76a0f2c0addb4988da2ef7d993d3253a1667d1a Mon Sep 17 00:00:00 2001 From: 代码人生 Date: Thu, 16 Jul 2026 16:09:19 +0800 Subject: Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- examples/host/audio_host/src/audio_app.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/host/audio_host/src/audio_app.c b/examples/host/audio_host/src/audio_app.c index ac7596d91..d264426fd 100644 --- a/examples/host/audio_host/src/audio_app.c +++ b/examples/host/audio_host/src/audio_app.c @@ -204,15 +204,20 @@ void tuh_audio_rx_cb(uint8_t idx, uint8_t ep_addr, uint16_t xferred_bytes) { (void)ep_addr; audio_rx_busy = false; - if (xferred_bytes > 0) { + if (xferred_bytes > 0 && audio_ep_out != 0 && !audio_tx_busy) { + bool ok; if (audio_mic_channels == 1) { // Mono microphone, convert to stereo and send to OUT endpoint uint16_t samples = xferred_bytes / 2; mono_to_stereo(audio_rx_buffer, audio_tx_buffer, samples); - tuh_audio_send(audio_dev_addr, audio_idx, audio_tx_buffer, xferred_bytes * 2); + ok = tuh_audio_send(audio_dev_addr, audio_idx, audio_tx_buffer, xferred_bytes * 2); } else { // Stereo microphone, send directly to OUT endpoint - tuh_audio_send(audio_dev_addr, audio_idx, audio_rx_buffer, xferred_bytes); + ok = tuh_audio_send(audio_dev_addr, audio_idx, audio_rx_buffer, xferred_bytes); + } + + if (ok) { + audio_tx_busy = true; } } } -- cgit v1.3.1