[alsa-devel] USB asynchronous mode feedback format

Daniel Mack daniel at caiaq.de
Thu Oct 14 13:56:20 CEST 2010

On Thu, Oct 14, 2010 at 01:44:23PM +0200, Julian Scheel wrote:
> Am Donnerstag, 14. Oktober 2010, 13:15:45 schrieb Alex:
> > Channel inversion is a known issue and u need to sync the channel to the
> > LRCK, and resync when the USB stream is stopped and restarted and when
> > doing sample rate changes (48 to 96 etc).
> So far I only support one fixed sample rate (48 kHz) in the device. Regarding 
> the sync I am wondering how to determine the alignment of the data coming from 
> USB. Is there some way to be sure that the data frames do start with the left 
> channel when reading them from USB?

Yes, a USB packet always starts at a sample frame boundary. In other
words, after the SOF, the USB stream will start with the first byte of
the first channel. One USB packet must also transport multiple full
audio frames (ie, samples for all channels), and not only fractions

> The output to the I2S is done in bigger chunks through the DMA engine of the 
> AT91SAM7 - it might be possible that I loose one packet in some case at this 
> place... This would actually cause a inversion on the channels...

If you lose one entire packet and catch up with the next one, there
shouldn't be any channel inversion, just a data dropout. However I would
add an extra check to assure your internal counters are in sync whenever
a SOF is received.


More information about the Alsa-devel mailing list