diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/usbaudio.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 417d557ed641..f3d4de23fedf 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -108,6 +108,7 @@ MODULE_PARM_DESC(ignore_ctl_error, | |||
108 | #define MAX_URBS 8 | 108 | #define MAX_URBS 8 |
109 | #define SYNC_URBS 4 /* always four urbs for sync */ | 109 | #define SYNC_URBS 4 /* always four urbs for sync */ |
110 | #define MIN_PACKS_URB 1 /* minimum 1 packet per urb */ | 110 | #define MIN_PACKS_URB 1 /* minimum 1 packet per urb */ |
111 | #define MAX_QUEUE 24 /* try not to exceed this queue length, in ms */ | ||
111 | 112 | ||
112 | struct audioformat { | 113 | struct audioformat { |
113 | struct list_head list; | 114 | struct list_head list; |
@@ -1079,7 +1080,7 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri | |||
1079 | 1080 | ||
1080 | /* decide how many packets to be used */ | 1081 | /* decide how many packets to be used */ |
1081 | if (is_playback) { | 1082 | if (is_playback) { |
1082 | unsigned int minsize; | 1083 | unsigned int minsize, maxpacks; |
1083 | /* determine how small a packet can be */ | 1084 | /* determine how small a packet can be */ |
1084 | minsize = (subs->freqn >> (16 - subs->datainterval)) | 1085 | minsize = (subs->freqn >> (16 - subs->datainterval)) |
1085 | * (frame_bits >> 3); | 1086 | * (frame_bits >> 3); |
@@ -1094,6 +1095,12 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri | |||
1094 | /* we need at least two URBs for queueing */ | 1095 | /* we need at least two URBs for queueing */ |
1095 | if (total_packs < 2 * MIN_PACKS_URB * packs_per_ms) | 1096 | if (total_packs < 2 * MIN_PACKS_URB * packs_per_ms) |
1096 | total_packs = 2 * MIN_PACKS_URB * packs_per_ms; | 1097 | total_packs = 2 * MIN_PACKS_URB * packs_per_ms; |
1098 | else { | ||
1099 | /* and we don't want too long a queue either */ | ||
1100 | maxpacks = max((unsigned int)MAX_QUEUE, urb_packs * 2); | ||
1101 | if (total_packs > maxpacks * packs_per_ms) | ||
1102 | total_packs = maxpacks * packs_per_ms; | ||
1103 | } | ||
1097 | } else { | 1104 | } else { |
1098 | total_packs = MAX_URBS * urb_packs; | 1105 | total_packs = MAX_URBS * urb_packs; |
1099 | } | 1106 | } |