Skip to content

Conversation

@TDA-2030
Copy link
Collaborator

@TDA-2030 TDA-2030 commented Nov 4, 2025

Description

UAC

  • Fixed a playback stuttering issue when bInterval was not equal to 1 in the full-speed device audio endpoint descriptor

UVC

  • Added SOI check to prevent output of corrupted MJPEG frames
  • Moved usb_types_uvc.h to private_include directory

Related

Testing


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

Note

Fix UAC FS isochronous interval handling and harden UVC streaming with header/SOI validation; add an audio player example; bump UAC to 1.3.3 and UVC to 2.3.2.

  • UAC (usb_host_uac)

    • Fix/Compat: Force bInterval = 1 on Full-Speed isoch endpoints during descriptor parse to prevent playback stutter; reject Low-Speed.
    • API/Logs: Clearer Suspend/Resume logs; endpoint logs use USB_EP_DESC_GET_EP_NUM; direction asserts use USB masks.
    • Examples: New examples/audio_player (embedded WAV playback, optional MIC loopback) with build files, Kconfig, and configs.
    • Release: Bump to 1.3.3; update CHANGELOG.md.
  • UVC (usb_host_uvc)

    • Robustness: Add uvc_frame_payload_header_validate() and MJPEG SOI checks; improve BULK EoF handling; validate headers in ISOC; skip tiny/invalid frames; warn on missed EoF.
    • Refactor: Move usb_types_uvc.h to private_include; update includes across sources and tests.
    • Examples: Enhance basic stream example with driver event callback and FPS macro; tidy sdkconfig (per-target defaults).
    • Release: Bump to 2.3.2; update CHANGELOG.md.

Written by Cursor Bugbot for commit fd1c730. This will update automatically on new commits. Configure here.

cursor[bot]

This comment was marked as outdated.

@TDA-2030 TDA-2030 force-pushed the fix/improve_uac_compatibility_and_add_checks_for_uvc branch 2 times, most recently from ae92d53 to efa0fe5 Compare November 4, 2025 08:10
cursor[bot]

This comment was marked as outdated.

@TDA-2030 TDA-2030 force-pushed the fix/improve_uac_compatibility_and_add_checks_for_uvc branch 2 times, most recently from 016831a to 4ef3e94 Compare November 4, 2025 10:05
@TDA-2030 TDA-2030 changed the title Fix/improve uac compatibility and add checks for uvc fix(uvc): improve uac compatibility and add checks for uvc Nov 5, 2025
@TDA-2030 TDA-2030 force-pushed the fix/improve_uac_compatibility_and_add_checks_for_uvc branch 2 times, most recently from fae33ed to 389afe6 Compare November 6, 2025 11:39
@TDA-2030 TDA-2030 force-pushed the fix/improve_uac_compatibility_and_add_checks_for_uvc branch from 389afe6 to fd1c730 Compare November 7, 2025 02:14
Copy link
Collaborator

@tore-espressif tore-espressif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TDA-2030 UAC changes look OK. Could you please provide more information about the bInterval!=1 issue? Maybe there is a better way to fix it.

I have more comments for the UVC part, so if you want to speed up the release, please split this PR into 2. One for UAC and one for UVC, thanks!

@@ -0,0 +1,12 @@
| Supported Targets | ESP32-S2 | ESP32-S3 | ESP32-P4 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should work also on H4

| Supported Targets | ESP32-S2 | ESP32-S3 | ESP32-P4 |
| ----------------- | -------- | -------- | -------- |

# UVC driver example: Video stream
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outdated description.

It would be nice to provide a simple 'how-to' use this example

Comment on lines +812 to +826
if (is_full_speed && ep_desc->bInterval != 1) {
// Full-Speed isochronous endpoints must have bInterval = 1
uint8_t *_bInterval = (uint8_t *) & (ep_desc->bInterval);
// Check if we can modify the bInterval value
if (esp_ptr_in_dram(_bInterval) || esp_ptr_in_diram_dram(_bInterval)
#if CONFIG_SPIRAM
|| esp_ptr_in_psram(_bInterval)
#endif
) {
ESP_LOGW(TAG, "UAC Full-Speed device, Endpoint %d, bInterval %d, set to 1", USB_EP_DESC_GET_EP_NUM(ep_desc), ep_desc->bInterval);
*_bInterval = 1;
} else {
ESP_LOGW(TAG, "UAC Full-Speed device, Endpoint %d, bInterval %d, can't set to 1", USB_EP_DESC_GET_EP_NUM(ep_desc), ep_desc->bInterval);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very risky, non-standard way that deserves explanation comment.

BTW, have you found the underlaying problem? If the device needs bInterval=2 why doesn't it work correctly with 2ms polling?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants