mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-02 09:01:48 -05:00
Fixed longstanding avail compute bug. Cosmetic fixes
This commit is contained in:
parent
31fcb58e9d
commit
c71b72ee27
2 changed files with 10 additions and 4 deletions
|
|
@ -208,7 +208,9 @@ static inline snd_pcm_uframes_t snd_pcm_mmap_playback_avail(snd_pcm_t *pcm)
|
|||
{
|
||||
snd_pcm_sframes_t avail;
|
||||
avail = *pcm->hw_ptr + pcm->buffer_size - *pcm->appl_ptr;
|
||||
if (avail < 0)
|
||||
if (avail >= pcm->boundary)
|
||||
avail -= pcm->boundary;
|
||||
else if (avail < 0)
|
||||
avail += pcm->boundary;
|
||||
return avail;
|
||||
}
|
||||
|
|
@ -226,8 +228,11 @@ static inline snd_pcm_uframes_t snd_pcm_mmap_avail(snd_pcm_t *pcm)
|
|||
{
|
||||
snd_pcm_sframes_t avail;
|
||||
avail = *pcm->hw_ptr - *pcm->appl_ptr;
|
||||
if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
|
||||
if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
|
||||
avail += pcm->buffer_size;
|
||||
if (avail >= pcm->boundary)
|
||||
avail -= pcm->boundary;
|
||||
}
|
||||
if (avail < 0)
|
||||
avail += pcm->boundary;
|
||||
return avail;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue