Fixed mmap_xxxx_delay() to follow kernel code

This commit is contained in:
Jaroslav Kysela 2002-10-09 06:44:45 +00:00
parent 3560bb1481
commit f0e5677f29

View file

@ -321,8 +321,34 @@ static inline snd_pcm_uframes_t snd_pcm_mmap_hw_offset(snd_pcm_t *pcm)
return *pcm->hw.ptr % pcm->buffer_size;
}
#define snd_pcm_mmap_playback_delay snd_pcm_mmap_playback_hw_avail
#define snd_pcm_mmap_capture_delay snd_pcm_mmap_capture_avail
static inline snd_pcm_uframes_t snd_pcm_mmap_playback_delay(snd_pcm_t *pcm)
{
snd_pcm_state_t state = snd_pcm_state(pcm);
switch (state) {
case SND_PCM_STATE_RUNNING:
case SND_PCM_STATE_DRAINING:
return snd_pcm_mmap_playback_hw_avail(pcm);
case SND_PCM_STATE_XRUN:
return -EPIPE;
default:
return -EBADFD;
}
}
static inline snd_pcm_uframes_t snd_pcm_mmap_capture_delay(snd_pcm_t *pcm)
{
snd_pcm_state_t state = snd_pcm_state(pcm);
switch (state) {
case SND_PCM_STATE_RUNNING:
return snd_pcm_mmap_capture_hw_avail(pcm);
case SND_PCM_STATE_XRUN:
return -EPIPE;
default:
return -EBADFD;
}
}
static inline snd_pcm_sframes_t snd_pcm_mmap_delay(snd_pcm_t *pcm)
{