diff options
-rw-r--r-- | include/sound/pcm.h | 1 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index c17296891617..267effddb070 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -270,6 +270,7 @@ struct snd_pcm_runtime { | |||
270 | snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */ | 270 | snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */ |
271 | snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */ | 271 | snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */ |
272 | unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */ | 272 | unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */ |
273 | snd_pcm_sframes_t delay; /* extra delay; typically FIFO size */ | ||
273 | 274 | ||
274 | /* -- HW params -- */ | 275 | /* -- HW params -- */ |
275 | snd_pcm_access_t access; /* access mode */ | 276 | snd_pcm_access_t access; /* access mode */ |
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, | |||
587 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 587 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
588 | status->avail = snd_pcm_playback_avail(runtime); | 588 | status->avail = snd_pcm_playback_avail(runtime); |
589 | if (runtime->status->state == SNDRV_PCM_STATE_RUNNING || | 589 | if (runtime->status->state == SNDRV_PCM_STATE_RUNNING || |
590 | runtime->status->state == SNDRV_PCM_STATE_DRAINING) | 590 | runtime->status->state == SNDRV_PCM_STATE_DRAINING) { |
591 | status->delay = runtime->buffer_size - status->avail; | 591 | status->delay = runtime->buffer_size - status->avail; |
592 | else | 592 | status->delay += runtime->delay; |
593 | } else | ||
593 | status->delay = 0; | 594 | status->delay = 0; |
594 | } else { | 595 | } else { |
595 | status->avail = snd_pcm_capture_avail(runtime); | 596 | status->avail = snd_pcm_capture_avail(runtime); |
596 | if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) | 597 | if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) |
597 | status->delay = status->avail; | 598 | status->delay = status->avail + runtime->delay; |
598 | else | 599 | else |
599 | status->delay = 0; | 600 | status->delay = 0; |
600 | } | 601 | } |
@@ -2404,6 +2405,7 @@ static int snd_pcm_delay(struct snd_pcm_substream *substream, | |||
2404 | n = snd_pcm_playback_hw_avail(runtime); | 2405 | n = snd_pcm_playback_hw_avail(runtime); |
2405 | else | 2406 | else |
2406 | n = snd_pcm_capture_avail(runtime); | 2407 | n = snd_pcm_capture_avail(runtime); |
2408 | n += runtime->delay; | ||
2407 | break; | 2409 | break; |
2408 | case SNDRV_PCM_STATE_XRUN: | 2410 | case SNDRV_PCM_STATE_XRUN: |
2409 | err = -EPIPE; | 2411 | err = -EPIPE; |