mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Fixed mmap_xxxx_delay() to follow kernel code
This commit is contained in:
parent
3560bb1481
commit
f0e5677f29
1 changed files with 28 additions and 2 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue