From 206ac6f3ee4e849a80d3449b9e0f7e3d794cac27 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 19 Aug 2006 01:16:38 +0000 Subject: allow importing of external shm data blocks unconditionally, even when local SHM support is disabled git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1283 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/pstream.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c index e2cfcb63..fa5b2788 100644 --- a/src/pulsecore/pstream.c +++ b/src/pulsecore/pstream.c @@ -251,7 +251,9 @@ pa_pstream *pa_pstream_new(pa_mainloop_api *m, pa_iochannel *io, pa_mempool *poo p->use_shm = 0; p->export = NULL; - p->import = NULL; + + /* We do importing unconditionally */ + p->import = pa_memimport_new(p->mempool, memimport_release_cb, p); pa_iochannel_socket_set_rcvbuf(io, 1024*8); pa_iochannel_socket_set_sndbuf(io, 1024*8); @@ -567,7 +569,7 @@ static int do_read(pa_pstream *p) { flags = ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_FLAGS]); - if (!p->use_shm && (flags & PA_FLAG_SHMMASK) != 0) { + if (!p->import && (flags & PA_FLAG_SHMMASK) != 0) { pa_log_warn("Recieved SHM frame on a socket where SHM is disabled."); return -1; } @@ -861,19 +863,11 @@ void pa_pstream_use_shm(pa_pstream *p, int enable) { if (enable) { - if (!p->import) - p->import = pa_memimport_new(p->mempool, memimport_release_cb, p); - if (!p->export) p->export = pa_memexport_new(p->mempool, memexport_revoke_cb, p); } else { - if (p->import) { - pa_memimport_free(p->import); - p->import = NULL; - } - if (p->export) { pa_memexport_free(p->export); p->export = NULL; -- cgit