diff options
-rw-r--r-- | sound/usb/usbaudio.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 9e38d3d1322a..d28106e390c4 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -938,7 +938,15 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
938 | 938 | ||
939 | /* decide how many packets to be used */ | 939 | /* decide how many packets to be used */ |
940 | if (is_playback) { | 940 | if (is_playback) { |
941 | total_packs = (period_bytes + maxsize - 1) / maxsize; | 941 | unsigned int minsize; |
942 | /* determine how small a packet can be */ | ||
943 | minsize = (subs->freqn >> (16 - subs->datainterval)) | ||
944 | * (frame_bits >> 3); | ||
945 | /* with sync from device, assume it can be 25% lower */ | ||
946 | if (subs->syncpipe) | ||
947 | minsize -= minsize >> 2; | ||
948 | minsize = max(minsize, 1u); | ||
949 | total_packs = (period_bytes + minsize - 1) / minsize; | ||
942 | if (total_packs < 2 * MIN_PACKS_URB) | 950 | if (total_packs < 2 * MIN_PACKS_URB) |
943 | total_packs = 2 * MIN_PACKS_URB; | 951 | total_packs = 2 * MIN_PACKS_URB; |
944 | } else { | 952 | } else { |