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]

 



Hi,

On 08/25/2014 07:43 PM, Jassi Brar wrote:
> On Mon, Aug 25, 2014 at 10:52 PM, Jassi Brar <jassisinghbrar@xxxxxxxxx> wrote:

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

Yes, that would be another way, but as we might have sample rates and
formats that can be configured at runtime, I opted for another variable
and leave max_psize = wMaxPacketSize. That should work equally well but
it's more flexible in the future, right?

> Also USB-IN is capture for host, but in f_uac2 it is playback. So you
> may want to do
> 
> - rate = opts->c_srate * opts->c_ssize * num_channels(opts->c_chmask);
> - rate = opts->p_srate * opts->p_ssize * num_channels(opts->p_chmask);

Ah, right. Will also fix in v3.

> BTW, why not do the same for USB-OUT as well? it shouldn't hurt.

Not sure if I'm following, but on the OUT side (capture on the gadget),
the model is entirely different. We don't have to estimate the packet
sizes, and we're not really interested whether the data rate matches our
system clock. The host will start sending in whatever it believes to be
the correct rate. With other sound interfaces, it will normally be
notified on a regular base if it should speed up or slow down. But as we
don't have a feedback endpoint in f_uac2, the host will keep sending at
its original data rate, and we have to sink away whatever we get, and
feed it to the virtual ALSA device.

As I've described in my previous mail, this is intended for audio
streaming. The virtual capture interface on the gadget will be in sync
with the host's clock, not with its own system clock. If we wanted to
change that, we'd need to implement a feedback endpoint, but I don't
currently see any need for that.

I'll fix the two things you pointed out, and resend v3. Probably tomorrow.



Best regards, and thanks for your feedback,
Daniel
--
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