diff options
author | Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> | 2011-09-06 19:15:34 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-09-12 10:30:20 +0200 |
commit | 294c4fb8ab01728358836f478bcc1174ba7fb9d8 (patch) | |
tree | 2afde5810233ceb00dafa573061f224026238ada /sound/usb/card.h | |
parent | 1ef0e0a05345b7411bdabbfca27f58bd33dcc7c8 (diff) | |
download | kernel_goldelico_gta04-294c4fb8ab01728358836f478bcc1174ba7fb9d8.zip kernel_goldelico_gta04-294c4fb8ab01728358836f478bcc1174ba7fb9d8.tar.gz kernel_goldelico_gta04-294c4fb8ab01728358836f478bcc1174ba7fb9d8.tar.bz2 |
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>
Diffstat (limited to 'sound/usb/card.h')
-rw-r--r-- | sound/usb/card.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/usb/card.h b/sound/usb/card.h index ae4251d..a39edcc 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h @@ -94,6 +94,8 @@ struct snd_usb_substream { spinlock_t lock; struct snd_urb_ops ops; /* callbacks (must be filled at init) */ + int last_frame_number; /* stored frame number */ + int last_delay; /* stored delay */ }; struct snd_usb_stream { |