Commit b1c86bb8 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Takashi Iwai

sound: usb-audio: fix queue length check for high speed devices

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: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent eab2b553
...@@ -1095,9 +1095,8 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri ...@@ -1095,9 +1095,8 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri
total_packs = 2 * packs_per_ms; total_packs = 2 * packs_per_ms;
} else { } else {
/* and we don't want too long a queue either */ /* and we don't want too long a queue either */
maxpacks = max((unsigned int)MAX_QUEUE, urb_packs * 2); maxpacks = max(MAX_QUEUE * packs_per_ms, urb_packs * 2);
if (total_packs > maxpacks * packs_per_ms) total_packs = min(total_packs, maxpacks);
total_packs = maxpacks * packs_per_ms;
} }
} else { } else {
total_packs = MAX_URBS * urb_packs; total_packs = MAX_URBS * urb_packs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment