summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-06-10 07:26:40 +0200
committerTakashi Iwai <tiwai@suse.de>2009-06-10 07:26:40 +0200
commiteabaf0634a9034f2e487b0be347edc1460c026a4 (patch)
treee950df1ba10e0a29b25afdd446ac44988381a851 /sound/core
parentMerge branch 'topic/oxygen' into for-linus (diff)
parentALSA: usbaudio - Add delay account (diff)
downloadlinux-eabaf0634a9034f2e487b0be347edc1460c026a4.tar.xz
linux-eabaf0634a9034f2e487b0be347edc1460c026a4.zip
Merge branch 'topic/pcm-delay' into for-linus
* topic/pcm-delay: ALSA: usbaudio - Add delay account ALSA: Add extra delay count in PCM
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/pcm_native.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index b5da656d1ece..45dc53fcfa2f 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;
}
@@ -2410,6 +2411,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;