diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-05-27 04:49:26 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-05-27 05:04:18 -0400 |
commit | 6af3fb72d2437239e5eb13a59e95dc43ccab3e8f (patch) | |
tree | a34f63d4c1904b2cff6a10926364c8ed557bb8c2 | |
parent | 59a3759d0fe8d969888c741bb33f4946e4d3750d (diff) |
ALSA: Fix invalid jiffies check after pause
The hw_ptr_jiffies has to be reset properly to avoid the invalid
check of jiffies delta in snd_pcm_update_hw_ptr*() functions.
Especailly this patch fixes the bogus jiffies check after the puase
and resume.
This patch is a modified version of the original patch by Jaroslav.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/core/pcm_lib.c | 1 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index a2a792c18c40..3eea98a4e65a 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -1478,7 +1478,6 @@ static int snd_pcm_lib_ioctl_reset(struct snd_pcm_substream *substream, | |||
1478 | runtime->status->hw_ptr %= runtime->buffer_size; | 1478 | runtime->status->hw_ptr %= runtime->buffer_size; |
1479 | else | 1479 | else |
1480 | runtime->status->hw_ptr = 0; | 1480 | runtime->status->hw_ptr = 0; |
1481 | runtime->hw_ptr_jiffies = jiffies; | ||
1482 | snd_pcm_stream_unlock_irqrestore(substream, flags); | 1481 | snd_pcm_stream_unlock_irqrestore(substream, flags); |
1483 | return 0; | 1482 | return 0; |
1484 | } | 1483 | } |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index fc6f98e257df..b5da656d1ece 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -848,6 +848,7 @@ static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state) | |||
848 | { | 848 | { |
849 | struct snd_pcm_runtime *runtime = substream->runtime; | 849 | struct snd_pcm_runtime *runtime = substream->runtime; |
850 | snd_pcm_trigger_tstamp(substream); | 850 | snd_pcm_trigger_tstamp(substream); |
851 | runtime->hw_ptr_jiffies = jiffies; | ||
851 | runtime->status->state = state; | 852 | runtime->status->state = state; |
852 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && | 853 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && |
853 | runtime->silence_size > 0) | 854 | runtime->silence_size > 0) |
@@ -961,6 +962,11 @@ static int snd_pcm_do_pause(struct snd_pcm_substream *substream, int push) | |||
961 | { | 962 | { |
962 | if (substream->runtime->trigger_master != substream) | 963 | if (substream->runtime->trigger_master != substream) |
963 | return 0; | 964 | return 0; |
965 | /* The jiffies check in snd_pcm_update_hw_ptr*() is done by | ||
966 | * a delta betwen the current jiffies, this gives a large enough | ||
967 | * delta, effectively to skip the check once. | ||
968 | */ | ||
969 | substream->runtime->hw_ptr_jiffies = jiffies - HZ * 1000; | ||
964 | return substream->ops->trigger(substream, | 970 | return substream->ops->trigger(substream, |
965 | push ? SNDRV_PCM_TRIGGER_PAUSE_PUSH : | 971 | push ? SNDRV_PCM_TRIGGER_PAUSE_PUSH : |
966 | SNDRV_PCM_TRIGGER_PAUSE_RELEASE); | 972 | SNDRV_PCM_TRIGGER_PAUSE_RELEASE); |