diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2005-05-13 01:50:28 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-05-29 04:08:53 -0400 |
commit | 29b16931f936fdbcd78995e66d0f5626f3afbda8 (patch) | |
tree | 938e0d682b0977d093690481a842132fb5a22718 | |
parent | 50cdbf1519a891bec4ce306c7bae397a0d8e7246 (diff) |
[ALSA] usb-audio - avoid unnecessary double buffering
USB generic driver
When a USB packet boundary falls exactly on a buffer boundary, hwptr
remains at the end of the buffer which causes an overflow in the next
iteration and triggers double buffering although the next packet would
actually be contiguous.
This patch ensures that hwptr is always smaller than buffer_size.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
-rw-r--r-- | sound/usb/usbaudio.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index a6ed0d08337e..076da19a9e28 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -565,6 +565,8 @@ static int prepare_playback_urb(snd_usb_substream_t *subs, | |||
565 | /* set the buffer pointer */ | 565 | /* set the buffer pointer */ |
566 | urb->transfer_buffer = runtime->dma_area + subs->hwptr * stride; | 566 | urb->transfer_buffer = runtime->dma_area + subs->hwptr * stride; |
567 | subs->hwptr += offs; | 567 | subs->hwptr += offs; |
568 | if (subs->hwptr == runtime->buffer_size) | ||
569 | subs->hwptr = 0; | ||
568 | } | 570 | } |
569 | spin_unlock_irqrestore(&subs->lock, flags); | 571 | spin_unlock_irqrestore(&subs->lock, flags); |
570 | urb->transfer_buffer_length = offs * stride; | 572 | urb->transfer_buffer_length = offs * stride; |