Cleaned the mmap_commit implementations in plugins.

Added undo callbacks for snd_pcm_plugin based plugins.
  - helpers when mmap_commit proceed only a partial transfer
Fixes to avail_update implementation in pcm_hw.c.
This commit is contained in:
Jaroslav Kysela 2002-02-21 15:01:34 +00:00
parent 9b0eebbcb7
commit e128bf856e
22 changed files with 260 additions and 120 deletions

View file

@ -5122,7 +5122,7 @@ int snd_pcm_mmap_begin(snd_pcm_t *pcm,
f = *frames;
avail = snd_pcm_mmap_avail(pcm);
if (avail > pcm->buffer_size)
return -EPIPE;
avail = pcm->buffer_size;
if (f > avail)
f = avail;
if (f > cont)
@ -5187,26 +5187,10 @@ snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t frames)
{
int res;
snd_pcm_uframes_t appl_ptr;
assert(pcm);
assert(offset == *pcm->appl_ptr % pcm->buffer_size);
assert(frames <= snd_pcm_mmap_avail(pcm));
appl_ptr = *pcm->appl_ptr;
res = pcm->fast_ops->mmap_commit(pcm->fast_op_arg, offset, frames);
if (res < 0) {
snd_pcm_sframes_t diff;
if (appl_ptr == *pcm->appl_ptr)
return res;
diff = *pcm->appl_ptr - appl_ptr;
if (diff < 0)
diff += pcm->boundary;
assert(diff >= 0 && (snd_pcm_uframes_t)diff < pcm->boundary);
return diff;
}
return frames;
return pcm->fast_ops->mmap_commit(pcm->fast_op_arg, offset, frames);
}
#ifndef DOC_HIDDEN