Repository navigation
usbhost: poll a full-speed audio stream's isochronous endpoint every frame - #166
Merged
Merged
Conversation
…frame A webcam microphone has one configuration for both speeds and says bInterval 4: 1 ms at high speed, 8 ms at full speed. IDF polls what the descriptor says, so with the host held to full speed behind the DEV-KIT's hub a 16 kHz stereo mic delivered 126 packets a second instead of 999. USB Audio puts a full-speed streaming endpoint at one frame; set the field to 1 in IDF's copy of the descriptor before the interface is claimed, for AudioStreaming interfaces at full speed only. Host-side test with a planted fault, in CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A webcam's microphone behind the DEV-KIT's hub arrived at one packet in eight once the USB host had run at full speed (workspace#16). Its configuration is the same at both speeds and says
bInterval4 on the audio endpoint: eight microframes (1 ms) at high speed, but eight frames (8 ms) at full speed. ESP-IDF's host driver polls what the descriptor says (hcd_dwc.ctakes1 << (bInterval - 1)frames for a full-speed isochronous pipe), so a 16 kHz stereo mic gave 125 packets a second instead of 1000.USB Audio gives a full-speed streaming endpoint a period of one frame, and Linux's audio driver ignores the field at full speed for the same reason.
usbhost_xfer_claim()now sets it to 1 in the library's copy of the configuration descriptor, just beforeusb_host_interface_claim()reads it, and only for an isochronous endpoint of an AudioStreaming interface on a full-speed device. Video endpoints, high speed and everything else are untouched. The walker is inshared/usbhost_audio_interval.h, free of IDF, with a host-side test and a planted fault in the workflow.On the DEV-KIT (C920e mic, reset, Instruments then Wake word,
mic.stats()over 5 s): 125 packets/s and 8174 B/s before, 1000 packets/s and 64000 B/s after, with no errors or empty packets, andinject_clip.pystill gets "Hey Jarvis".