]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fixed nasty bug when we used more ipc buffers for interleaved access
authorJaroslav Kysela <perex@perex.cz>
Fri, 28 Feb 2003 20:32:07 +0000 (20:32 +0000)
committerJaroslav Kysela <perex@perex.cz>
Fri, 28 Feb 2003 20:32:07 +0000 (20:32 +0000)
src/pcm/pcm_mmap.c

index 09a46907c4e5fb43f611794eca7070b11ad740c1..923209423b7ebb4e0f74c938eb9743b5f9daffab 100644 (file)
@@ -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) {