-
Notifications
You must be signed in to change notification settings - Fork 8k
fix:Report the full buffer length to the UAC stack by setting bytes_r… (IDFGH-16855) #17926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…ead in usb_uac_device_input_cb(), so the host correctly detects received audio data instead of seeing zero bytes.
|
|
👋 Hello KinhoLeung, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| return ESP_FAIL; | ||
| } | ||
|
|
||
| /* Report full-length data for UAC */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: bytes_read not set on error path
When esp_codec_dev_read fails, the function returns early without setting *bytes_read. This leaves the output parameter uninitialized or containing stale data, potentially causing the caller to misinterpret how many bytes were actually read. The error path needs to set *bytes_read = 0 before returning to indicate no data was successfully read.
Description

Set bytes_read to len in usb_uac_device_input_cb() after a successful esp_codec_dev_read().
This ensures the UAC stack receives the correct number of bytes and no longer interprets the callback as producing zero-length audio data.
Related
N/A (found while testing the USB UAC device input callback).
Testing
Built the USB UAC example.
Ran on an ESP32-S4 board and verified that audio input is correctly received by the host (no more zero-length data reported).
Note
Set
bytes_read = leninusb_uac_device_input_cbso the UAC stack receives full-length audio data instead of zero-length.Written by Cursor Bugbot for commit 05d11f8. This will update automatically on new commits. Configure here.