[alsa-devel] USB Audio questions
Clemens Ladisch
clemens at ladisch.de
Tue Aug 16 18:09:40 CEST 2011
Pierre-Louis Bossart wrote:
> What is this USB frame counter and what would to enable its use, at
> least for playback where there is scope for lots of power
> optimizations.
USB timing is defined by frames, of which there are about 1000 per
second. The audio driver schedules one packet to be sent/received for
each frame. Multiple packets are grouped in a URB (USB request buffer);
the controller raises an interrupt when the last packet of the URB has
been completed.
By reading the current frame number, the driver could deduce how many
packets (and therefore, how many samples) have been processed by the
controller.
> > Why more efficient? You cannot avoid double-buffering when a USB packet
> > wraps around the end of the ALSA ring buffer.
>
> What I had in mind is a case where the ring buffer is divided in separate
> periods, which would each correspond to an integer number of URBs/packets.
This works only when the driver has control over how many samples
actually are transmitted in each USB frame. The playback streams of
many USB audio devices work this way, but quite a few others, and
capture streams, don't.
> It's probably less generic than the current driver but a whole lot
> simpler/efficient.
The code wouldn't be simpler because we'd still need the other
algorithm. This would be just an optimization.
Regards,
Clemens
More information about the Alsa-devel
mailing list