diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/pcm_lib.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 063c675177a9..fbb2e391591e 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -222,8 +222,9 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) | |||
222 | hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size; | 222 | hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size; |
223 | delta = new_hw_ptr - hw_ptr_interrupt; | 223 | delta = new_hw_ptr - hw_ptr_interrupt; |
224 | if (hw_ptr_interrupt >= runtime->boundary) { | 224 | if (hw_ptr_interrupt >= runtime->boundary) { |
225 | hw_ptr_interrupt %= runtime->boundary; | 225 | hw_ptr_interrupt -= runtime->boundary; |
226 | if (!hw_base) /* hw_base was already lapped; recalc delta */ | 226 | if (hw_base < runtime->boundary / 2) |
227 | /* hw_base was already lapped; recalc delta */ | ||
227 | delta = new_hw_ptr - hw_ptr_interrupt; | 228 | delta = new_hw_ptr - hw_ptr_interrupt; |
228 | } | 229 | } |
229 | if (delta < 0) { | 230 | if (delta < 0) { |
@@ -241,7 +242,7 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) | |||
241 | delta = 0; | 242 | delta = 0; |
242 | } else { | 243 | } else { |
243 | hw_base += runtime->buffer_size; | 244 | hw_base += runtime->buffer_size; |
244 | if (hw_base == runtime->boundary) | 245 | if (hw_base >= runtime->boundary) |
245 | hw_base = 0; | 246 | hw_base = 0; |
246 | new_hw_ptr = hw_base + pos; | 247 | new_hw_ptr = hw_base + pos; |
247 | } | 248 | } |
@@ -296,7 +297,7 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) | |||
296 | return 0; | 297 | return 0; |
297 | } | 298 | } |
298 | hw_base += runtime->buffer_size; | 299 | hw_base += runtime->buffer_size; |
299 | if (hw_base == runtime->boundary) | 300 | if (hw_base >= runtime->boundary) |
300 | hw_base = 0; | 301 | hw_base = 0; |
301 | new_hw_ptr = hw_base + pos; | 302 | new_hw_ptr = hw_base + pos; |
302 | } | 303 | } |