Takashi: added shadow pcm to avoid problem with plug plugin and mmaped access

This commit is contained in:
Jaroslav Kysela 2003-08-08 09:06:41 +00:00
parent 18927bfe9a
commit 63c19961b9
3 changed files with 17 additions and 2 deletions

View file

@ -295,6 +295,8 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
err = pcm->ops->mmap(pcm);
if (err < 0)
return err;
if (pcm->shadow_mmap)
return 0;
pcm->mmap_channels = calloc(pcm->channels, sizeof(pcm->mmap_channels[0]));
if (!pcm->mmap_channels)
return -ENOMEM;
@ -427,6 +429,8 @@ int snd_pcm_munmap(snd_pcm_t *pcm)
unsigned int c;
assert(pcm);
assert(pcm->mmap_channels);
if (pcm->shadow_mmap)
return pcm->ops->munmap(pcm);
for (c = 0; c < pcm->channels; ++c) {
snd_pcm_channel_info_t *i = &pcm->mmap_channels[c];
unsigned int c1;