Re: [PATCH v2 3/4] usb: gadget: f_uac2: send reasonably sized packets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 25, 2014 at 9:30 PM, Daniel Mack <zonque@xxxxxxxxx> wrote:
> 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 pre-calculating the size of each packet to meet the
> requested sample rate and format. This won't be 100% accurate, but
> that's acceptable.
>
For rates like 44100 we will always hear clicks because we can not
transfer 176400bytes by packets of equal size over duration of 1
second. The inaccuracy here is due to the way we program, and not due
to system/bus load.

Have you tried the approach I suggested - {4x176, 1x178} pattern
packets, and does that not work? Please let me know if I am
overlooking something. Otherwise let us do the best we can (If you
want me to give that a try, I can in a day or two).

> @@ -187,7 +189,7 @@ agdev_iso_complete(struct usb_ep *ep, struct usb_request *req)
>
>         if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
>                 src = prm->dma_area + prm->hw_ptr;
> -               req->actual = req->length;
> +               req->length = req->actual = uac2->c_pktsize;
>
This doesn't seem right.
We asked req->length to be transmitted by the udc which shouldn't
return until that is done. So at this point setting 'length' doesn't
mean much. The original assignment to 'actual' is only because we want
to ignore any issue that caused the udc to transmit fewer bytes (we
drop that data).

I believe you want to do the following in afunc_set_alt().
  -  req->length = prm->max_psize;
 +  req->length =  uac2->c_pktsize;

which should render the patch-4/4 needless, I hope because there is
nowhere 512 in the code and neither did I assume any such fixed value.
We simply alloc 2 usb requests of wMaxPacketSize each and copy data
to/from the ALSA ring buffer. For you the wMaxPacketSize might be 512,
but the code should work for any value.

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux