ALSA: snd-usb: fix calls to next_packet_size
authorDaniel Mack <zonque@gmail.com>
Thu, 30 Aug 2012 16:52:30 +0000 (18:52 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 31 Aug 2012 19:03:48 +0000 (21:03 +0200)
commit245baf983cc39524cce39c24d01b276e6e653c9e
tree2fbd88aebcbbe95b60a6ae62d946a840ae1ff28b
parentfbcfbf5f673847657ccd98afb4d8e13af7fdc372
ALSA: snd-usb: fix calls to next_packet_size

In order to support devices with implicit feedback streaming models,
packet sizes are now stored with each individual urb, and the PCM
handling code which fills the buffers purely relies on the size fields
now.

However, calling snd_usb_audio_next_packet_size() for all possible
packets in an URB at once, prior to letting the PCM code do its job
does in fact not lead to the same behaviour than what the old code did:
The PCM code will break its loop once a period boundary is reached,
consequently using up less packets that it really could.

As snd_usb_audio_next_packet_size() implements a feedback mechanism to
the endpoints phase accumulator, the number of calls to that function
matters, and when called too often, the data rate runs out of bounds.

Fix this by making the next_packet function public, and call it from the
PCM code as before if the packet data sizes are not defined.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: stable@kernel.org [v3.5+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/endpoint.c
sound/usb/endpoint.h
sound/usb/pcm.c