diff options
| author | 代码人生 <[email protected]> | 2026-07-16 16:09:19 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-07-16 16:09:19 +0800 |
| commit | f76a0f2c0addb4988da2ef7d993d3253a1667d1a (patch) | |
| tree | 97d1c4a8c5b41c81b21f58ef84a3e1234b7b77ae /examples/host/audio_host/src/audio_app.c | |
| parent | 439015377976bb51f6d9ae6c3101b72385ecfb1a (diff) | |
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Diffstat (limited to 'examples/host/audio_host/src/audio_app.c')
| -rw-r--r-- | examples/host/audio_host/src/audio_app.c | 11 |
1 files changed, 8 insertions, 3 deletions
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; } } } |
