Skip to content

Commit

Permalink
sound: usb-audio: fix queue length check for high speed devices
Browse files Browse the repository at this point in the history
When checking for the maximum queue length, we have to take into account
that MAX_QUEUE is measured in milliseconds (i.e., frames) while the unit
of urb_packs is whatever data packet interval the device uses (possibly
less than one frame when using high speed devices).

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Clemens Ladisch authored and Takashi Iwai committed Mar 2, 2009
1 parent eab2b55 commit b1c86bb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sound/usb/usbaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,9 +1095,8 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri
total_packs = 2 * packs_per_ms;
} else {
/* and we don't want too long a queue either */
maxpacks = max((unsigned int)MAX_QUEUE, urb_packs * 2);
if (total_packs > maxpacks * packs_per_ms)
total_packs = maxpacks * packs_per_ms;
maxpacks = max(MAX_QUEUE * packs_per_ms, urb_packs * 2);
total_packs = min(total_packs, maxpacks);
}
} else {
total_packs = MAX_URBS * urb_packs;
Expand Down

0 comments on commit b1c86bb

Please sign in to comment.