From b66d49702f548edad33162fbe2ee8837434af6e5 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 6 Oct 2025 11:17:08 +0200 Subject: [PATCH] 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 --- src/examples/audio-dsp-sink.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/examples/audio-dsp-sink.c b/src/examples/audio-dsp-sink.c index 3f18adb66..caaac3b66 100644 --- a/src/examples/audio-dsp-sink.c +++ b/src/examples/audio-dsp-sink.c @@ -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