On Sun, Aug 24, 2014 at 7:26 PM, Daniel Mack <dan...@zonque.org> wrote:
> Hi Jassi,
>
> On 08/19/2014 11:52 AM, Jassi Brar wrote:
>> Its been quite some time now, but I think we designed the uac2 to rely
>> on USB's ISO packets' rate control to send and receive audio data at
>> announced sampling rate.
>
> I'm still thinking how that setup should have ever been possible with
> snd-usb-audio on the host side.
>
> snd-usb-audio prepares its capture USB ISO frames with a pre-calculated
> value of how many bytes per packet to expect on the capture endpoint.
> That value is derived from the currently configured sample rate, and if
> the sound card fills each of its buffers with that number of bytes or
> less, everything's fine. Also, each urb is resubmitted immediately after
> reception, and there is no delay or timing or anything.
>
Doesn't .bInterval, set to get one ISO packet per millisec, play any role?

> f_uac2, however, currently always completes its buffers with 512 bytes
> packets,
Current uac2 uses the max packset size (which may not be 512 for every
udc) for the EP. Probably it (wMaxPacketSize) should be set to
bytes/ms for the sampling rate.

> which causes two problems: a) it leads to -EOVERFLOW errors on
> the host side, as the host doesn't expect such big packets, and b) audio
> is transported as fast as possible, and nothing ties the actual rate to
> any clock on either side. In my tests, audio was transported roughly at
> 3x the actual sample rate. While this works fine if only files are in
> the game on both sides
>
f_uac2 is a virtual sound card that can not play/record sound to/from
a physical codec ... it's basically just a way to capture audio data
in digital form ;)  so 'files' was assumed to be the primary way of
using it.
 Now for USB-IN data flow control, maybe we should play with
bInterval, wMaxPacketSize and an hrtimer for some sampling rates.

> Which OS did you test with on the host side, and what type of gadget
> hardware was in use? I'll send out the patches once I have confidence
> that I'm not missing anything essential :)
>
The host was Ubuntu latest at that time. Testing method and 'quirks'
are documented in archives
http://www.spinics.net/lists/linux-usb/msg50855.html
We didn't have access to a Mac and Windows wouldn't support UAC2.

-jassi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to