diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-10-13 05:07:14 +0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-05-05 16:47:21 +0400 |
commit | 4bbe1ddf89a5ba3ec30fe5980912d8bda3a3cbb2 (patch) | |
tree | c57b1b83a23bd80535ea5b9220d07a3ab09df955 /sound/core | |
parent | 091438dd5668396328a3419abcbc6591159eb8d1 (diff) | |
download | linux-4bbe1ddf89a5ba3ec30fe5980912d8bda3a3cbb2.tar.xz |
ALSA: Add extra delay count in PCM
Added runtime->delay field to adjust the delayed samples for snd_pcm_delay().
Typically a hardware FIFO length is stored in this field, so that the
extra delay between hwptr and applptr can be computed.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/pcm_native.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index fc6f98e257df..cb769d415db7 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -587,14 +587,15 @@ int snd_pcm_status(struct snd_pcm_substream *substream, if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { status->avail = snd_pcm_playback_avail(runtime); if (runtime->status->state == SNDRV_PCM_STATE_RUNNING || - runtime->status->state == SNDRV_PCM_STATE_DRAINING) + runtime->status->state == SNDRV_PCM_STATE_DRAINING) { status->delay = runtime->buffer_size - status->avail; - else + status->delay += runtime->delay; + } else status->delay = 0; } else { status->avail = snd_pcm_capture_avail(runtime); if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) - status->delay = status->avail; + status->delay = status->avail + runtime->delay; else status->delay = 0; } @@ -2404,6 +2405,7 @@ static int snd_pcm_delay(struct snd_pcm_substream *substream, n = snd_pcm_playback_hw_avail(runtime); else n = snd_pcm_capture_avail(runtime); + n += runtime->delay; break; case SNDRV_PCM_STATE_XRUN: err = -EPIPE; |