Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 6520
b: refs/heads/master
c: 15a24c0
h: refs/heads/master
v: v3
  • Loading branch information
Clemens Ladisch authored and Jaroslav Kysela committed Aug 30, 2005
1 parent 0e95183 commit 39bcedc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a53fc188ec6fc406276799da465fe789c40d96b2
refs/heads/master: 15a24c0778e9bdd48d8e1cf60a263837b5c30ed5
18 changes: 12 additions & 6 deletions trunk/sound/usb/usbaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ MODULE_PARM_DESC(async_unlink, "Use async unlink mode.");

#define MAX_PACKS 10
#define MAX_PACKS_HS (MAX_PACKS * 8) /* in high speed mode */
#define MAX_URBS 5 /* max. 20ms long packets */
#define MAX_URBS 8
#define SYNC_URBS 4 /* always four urbs for sync */
#define MIN_PACKS_URB 1 /* minimum 1 packet per urb */

Expand Down Expand Up @@ -920,10 +920,12 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by
else
subs->curpacksize = maxsize;

if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL)
if (is_playback)
urb_packs = nrpacks;
else
urb_packs = (nrpacks * 8) >> subs->datainterval;
urb_packs = 1;
if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH)
urb_packs = (urb_packs * 8) >> subs->datainterval;

/* allocate a temporary buffer for playback */
if (is_playback) {
Expand All @@ -935,9 +937,13 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by
}

/* decide how many packets to be used */
total_packs = (period_bytes + maxsize - 1) / maxsize;
if (total_packs < 2 * MIN_PACKS_URB)
total_packs = 2 * MIN_PACKS_URB;
if (is_playback) {
total_packs = (period_bytes + maxsize - 1) / maxsize;
if (total_packs < 2 * MIN_PACKS_URB)
total_packs = 2 * MIN_PACKS_URB;
} else {
total_packs = MAX_URBS * urb_packs;
}
subs->nurbs = (total_packs + urb_packs - 1) / urb_packs;
if (subs->nurbs > MAX_URBS) {
/* too much... */
Expand Down

0 comments on commit 39bcedc

Please sign in to comment.