mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
59a3759d0f
commit
6af3fb72d2
|
@ -1478,7 +1478,6 @@ static int snd_pcm_lib_ioctl_reset(struct snd_pcm_substream *substream,
|
||||||
runtime->status->hw_ptr %= runtime->buffer_size;
|
runtime->status->hw_ptr %= runtime->buffer_size;
|
||||||
else
|
else
|
||||||
runtime->status->hw_ptr = 0;
|
runtime->status->hw_ptr = 0;
|
||||||
runtime->hw_ptr_jiffies = jiffies;
|
|
||||||
snd_pcm_stream_unlock_irqrestore(substream, flags);
|
snd_pcm_stream_unlock_irqrestore(substream, flags);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -848,6 +848,7 @@ static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state)
|
||||||
{
|
{
|
||||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||||
snd_pcm_trigger_tstamp(substream);
|
snd_pcm_trigger_tstamp(substream);
|
||||||
|
runtime->hw_ptr_jiffies = jiffies;
|
||||||
runtime->status->state = state;
|
runtime->status->state = state;
|
||||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
|
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
|
||||||
runtime->silence_size > 0)
|
runtime->silence_size > 0)
|
||||||
|
@ -961,6 +962,11 @@ static int snd_pcm_do_pause(struct snd_pcm_substream *substream, int push)
|
||||||
{
|
{
|
||||||
if (substream->runtime->trigger_master != substream)
|
if (substream->runtime->trigger_master != substream)
|
||||||
return 0;
|
return 0;
|
||||||
|
/* The jiffies check in snd_pcm_update_hw_ptr*() is done by
|
||||||
|
* a delta betwen the current jiffies, this gives a large enough
|
||||||
|
* delta, effectively to skip the check once.
|
||||||
|
*/
|
||||||
|
substream->runtime->hw_ptr_jiffies = jiffies - HZ * 1000;
|
||||||
return substream->ops->trigger(substream,
|
return substream->ops->trigger(substream,
|
||||||
push ? SNDRV_PCM_TRIGGER_PAUSE_PUSH :
|
push ? SNDRV_PCM_TRIGGER_PAUSE_PUSH :
|
||||||
SNDRV_PCM_TRIGGER_PAUSE_RELEASE);
|
SNDRV_PCM_TRIGGER_PAUSE_RELEASE);
|
||||||
|
|
Loading…
Reference in New Issue