examples: avoid mmap in the example

We don't need to do this ourselves, the MAP_BUFFERS port flag already
makes sure this is done for use.

We used to have to do this here to ensure the mixer could find the data
pointer and not error out. Now that the mixer can MMAP, this can go.

See #4918
This commit is contained in:
Wim Taymans 2025-10-06 11:17:08 +02:00
parent af3ad7bf9f
commit b66d49702f

View file

@ -87,7 +87,6 @@ static void on_remove_buffer(void *_data, void *_port_data, struct pw_buffer *bu
d = buf->datas;
pw_log_info("remove buffer %p", buffer);
munmap(d[0].data, d[0].maxsize);
close(d[0].fd);
}
@ -127,13 +126,6 @@ static void on_add_buffer(void *_data, void *_port_data, struct pw_buffer *buffe
pw_log_error("can't truncate to %d: %m", d[0].maxsize);
return;
}
/* now mmap so we can read it in the process function above */
d[0].data = mmap(NULL, d[0].maxsize, PROT_READ | PROT_WRITE,
MAP_SHARED, d[0].fd, d[0].mapoffset);
if (d[0].data == MAP_FAILED) {
pw_log_error("can't mmap memory: %m");
return;
}
}
#endif