c->mempool = pool;
pa_silence_cache_init(&c->silence_cache);
+ if (shared && !(c->rw_mempool = pa_mempool_new(shared, shm_size)))
+ pa_log_warn("failed to allocate shared writable memory pool.");
+ if (c->rw_mempool)
+ pa_mempool_set_is_remote_writable(c->rw_mempool, true);
+
c->exit_event = NULL;
c->exit_idle_time = -1;
pa_assert(!c->default_sink);
pa_silence_cache_done(&c->silence_cache);
+ if (c->rw_mempool)
+ pa_mempool_free(c->rw_mempool);
pa_mempool_free(c->mempool);
for (j = 0; j < PA_CORE_HOOK_MAX; j++)
if (pa_idxset_isempty(c->sink_inputs) && pa_idxset_isempty(c->source_outputs)) {
pa_log_debug("Hmm, no streams around, trying to vacuum.");
- pa_mempool_vacuum(c->mempool);
} else {
pa_sink *si;
pa_source *so;
return;
pa_log_info("All sinks and sources are suspended, vacuuming memory");
- pa_mempool_vacuum(c->mempool);
}
+
+ pa_mempool_vacuum(c->mempool);
+
+ if (c->rw_mempool)
+ pa_mempool_vacuum(c->rw_mempool);
}
pa_time_event* pa_core_rttime_new(pa_core *c, pa_usec_t usec, pa_time_event_cb_t cb, void *userdata) {
PA_LLIST_HEAD(pa_subscription_event, subscription_event_queue);
pa_subscription_event *subscription_event_last;
- pa_mempool *mempool;
+ /* The mempool is used for data we write to, it's readonly for the client.
+ The rw_mempool is used for data writable by both server and client (and
+ can be NULL in some cases). */
+ pa_mempool *mempool, *rw_mempool;
pa_silence_cache silence_cache;
pa_time_event *exit_event;