A2DP connection to USB_UAC having issues

I’m planning to connect a device via A2DP on a mobile phone, then upload audio data to a PC through a USB microphone. I found that when using audio_server’s audio_write to write data, the playback sound is normal. However, when writing into a ring buffer and then reading from the USB side to transmit, the audio becomes severely distorted. The sample rates on both sides are exactly matched. Could the issue be caused by an incorrect USB writing method?

The usbd_ep_start_write interface can only transfer data in fixed-size packets. When data exceeds the packet size, it must be split into chunks, which consumes too much CPU time. Is there any way to solve this problem?

image

image