]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: usb: refine delay information with USB frame counter
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Wed, 7 Sep 2011 00:15:34 +0000 (19:15 -0500)
committerTakashi Iwai <tiwai@suse.de>
Mon, 12 Sep 2011 08:30:20 +0000 (10:30 +0200)
commitcf6d7aba0ea7609f120c0ee8c33637e311143ec3
tree2afde5810233ceb00dafa573061f224026238ada
parent400c4699a334533dd662b82c5413ed58f170186a
ALSA: usb: refine delay information with USB frame counter

Existing code only updates the audio delay when URBs were
submitted/retired. This can introduce an uncertainty of 8ms
on the number of samples played out with the default settings,
and a lot more when URBs convey more packets to reduce the
interrupt rate and power consumption.

This patch relies on the USB frame counter to reduce the
uncertainty to less than 2ms worst-case. The delay information
essentially becomes independent of the URB size and number of
packets. This should help applications like PulseAudio which
require accurate audio timing. Clemens Ladisch reported
a decrease of mplayer's A-V difference from nrpacks down to at
most 1ms.

Thanks to Clemens for also pointing out that the implementation
of frame counters varies between different HCDs. Only the
8 lowest-bits are used to estimate the delay.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
[clemens: changed debug code]
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/card.h
sound/usb/pcm.c
sound/usb/pcm.h
sound/usb/urb.c