Skip to content

Commit

Permalink
ALSA: pcm_lib: fix "something must be really wrong" condition
Browse files Browse the repository at this point in the history
When runtime->periods == 1 or when pointer crosses end of ring buffer,
the delta might be greater than buffer_size.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
  • Loading branch information
Jaroslav Kysela committed Jan 8, 2010
1 parent 1250932 commit 7b3a177
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/core/pcm_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
(unsigned long)runtime->hw_ptr_base);
}
/* something must be really wrong */
if (delta >= runtime->buffer_size) {
if (delta >= runtime->buffer_size + runtime->period_size) {
hw_ptr_error(substream,
"Unexpected hw_pointer value %s"
"(stream=%i, pos=%ld, new_hw_ptr=%ld, "
Expand Down

0 comments on commit 7b3a177

Please sign in to comment.