1
Index: alsa-lib-1.0.15/src/pcm/pcm_multi.c
2
===================================================================
3
--- alsa-lib-1.0.15.orig/src/pcm/pcm_multi.c 2008-03-11 22:41:11.000000000 -0400
4
+++ alsa-lib-1.0.15/src/pcm/pcm_multi.c 2008-03-11 22:41:29.000000000 -0400
9
-static int snd_pcm_multi_mmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
10
+static int snd_pcm_multi_munmap(snd_pcm_t *pcm)
12
+ free(pcm->mmap_channels);
13
+ free(pcm->running_areas);
14
+ pcm->mmap_channels = NULL;
15
+ pcm->running_areas = NULL;
19
-static int snd_pcm_multi_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
20
+static int snd_pcm_multi_mmap(snd_pcm_t *pcm)
22
+ snd_pcm_multi_t *multi = pcm->private_data;
25
+ pcm->mmap_channels = calloc(pcm->channels,
26
+ sizeof(pcm->mmap_channels[0]));
27
+ pcm->running_areas = calloc(pcm->channels,
28
+ sizeof(pcm->running_areas[0]));
29
+ if (!pcm->mmap_channels || !pcm->running_areas) {
30
+ snd_pcm_multi_munmap(pcm);
34
+ /* Copy the slave mmapped buffer data */
35
+ for (c = 0; c < pcm->channels; c++) {
36
+ snd_pcm_multi_channel_t *chan = &multi->channels[c];
38
+ if (chan->slave_idx < 0) {
39
+ snd_pcm_multi_munmap(pcm);
42
+ slave = multi->slaves[chan->slave_idx].pcm;
43
+ pcm->mmap_channels[c] =
44
+ slave->mmap_channels[chan->slave_channel];
45
+ pcm->mmap_channels[c].channel = c;
46
+ pcm->running_areas[c] =
47
+ slave->running_areas[chan->slave_channel];
56
+ pcm->mmap_shadow = 1; /* has own mmap method */
57
pcm->ops = &snd_pcm_multi_ops;
58
pcm->fast_ops = &snd_pcm_multi_fast_ops;
59
pcm->private_data = multi;