diff options
author | Daniel Mack <zonque@gmail.com> | 2014-08-27 21:09:07 +0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-09-02 18:28:00 +0400 |
commit | 9bb87f168931cf55738ed2fbda3639575cede886 (patch) | |
tree | 55a2a6ba38b24aec42eaed7cc6399e1365e64496 /drivers/usb/dwc3/gadget.h | |
parent | ec9e43138f1219966850477e056f6eb7fbcc4fa4 (diff) | |
download | linux-9bb87f168931cf55738ed2fbda3639575cede886.tar.xz |
usb: gadget: f_uac2: send reasonably sized packets
The UAC2 function driver currently responds to all packets at all times
with wMaxPacketSize packets. That results in way too fast audio
playback as the function driver (which is in fact supposed to define
the audio stream pace) delivers as fast as it can.
Fix this by sizing each packet correctly with the following steps:
a) Set the packet's size by dividing the nominal data rate by the
playback endpoint's interval.
b) If there is a residual value from the calculation in a), add
it to a accumulator to keep track of it across packets.
c) If the accumulator has gathered at least the number of bytes
that are needed for one sample frame, increase the packet size.
This way, the packet size calculation will get rid of any kind of
imprecision that would otherwise occur with a simple division over
time.
Some of the variables that are needed while processing each packet
are pre-computed for performance reasons.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/gadget.h')
0 files changed, 0 insertions, 0 deletions