From: Jaroslav Kysela Date: Fri, 28 Feb 2003 20:32:07 +0000 (+0000) Subject: Fixed nasty bug when we used more ipc buffers for interleaved access X-Git-Tag: v1.0.3~239 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=8faee9967f8b4f206400b6a2761fa3450ebc9638;p=alsa-lib.git Fixed nasty bug when we used more ipc buffers for interleaved access --- diff --git a/src/pcm/pcm_mmap.c b/src/pcm/pcm_mmap.c index 09a46907..92320942 100644 --- a/src/pcm/pcm_mmap.c +++ b/src/pcm/pcm_mmap.c @@ -363,6 +363,17 @@ int snd_pcm_mmap(snd_pcm_t *pcm) } i->u.shm.shmid = id; i->u.shm.remove = 1; + if (pcm->access == SND_PCM_ACCESS_MMAP_INTERLEAVED || + pcm->access == SND_PCM_ACCESS_RW_INTERLEAVED) { + unsigned int c1; + for (c1 = c + 1; c1 < pcm->channels; c1++) { + snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1]; + if (i1->u.shm.shmid < 0) { + i1->u.shm.shmid = id; + i1->u.shm.remove = 1; + } + } + } } ptr = shmat(i->u.shm.shmid, 0, 0); if (ptr == (void*) -1) {