summaryrefslogtreecommitdiff
path: root/sound/core/pcm_native.c
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2010-01-26 17:08:24 +0100
committerJaroslav Kysela <perex@perex.cz>2010-01-26 17:50:50 +0100
commite7636925789b042ff9d98c51d48392e8c5549480 (patch)
tree4462f95057322b7d63d3b625644abd1f8fef6d7a /sound/core/pcm_native.c
parentfd0b092a7b14559e2ff17ef3aaefb5d8adc7e15f (diff)
downloadlwn-e7636925789b042ff9d98c51d48392e8c5549480.tar.gz
lwn-e7636925789b042ff9d98c51d48392e8c5549480.zip
ALSA: pcm_lib - return back hw_ptr_interrupt
Clemens Ladisch noted for hw_ptr_removal in "cleanup & merge hw_ptr update functions" commit: "It is possible for the status/delay ioctls to be called when the sound card's pointer register alreay shows a position at the beginning of the new period, but immediately before the interrupt is actually executed. (This happens regularly on a SMP machine with mplayer.) When that happens, the code thinks that the position must be at least one period ahead of the current position and drops an entire buffer of data." Return back the hw_ptr_interrupt variable. The last interrupt pointer is always computed from the latest hw_ptr instead of tracking it separately (in this case all hw_ptr checks and modifications might influence also hw_ptr_interrupt and it is difficult to keep it consistent). Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r--sound/core/pcm_native.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 56ec35e8510b..7a002db512b4 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1252,6 +1252,8 @@ static int snd_pcm_do_reset(struct snd_pcm_substream *substream, int state)
if (err < 0)
return err;
runtime->hw_ptr_base = 0;
+ runtime->hw_ptr_interrupt = runtime->status->hw_ptr -
+ runtime->status->hw_ptr % runtime->period_size;
runtime->silence_start = runtime->status->hw_ptr;
runtime->silence_filled = 0;
return 0;