mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
pulsecore: Transform pa_mempool_new() into a factory method
Soon we're going to have three types of memory pools: POSIX shm_open() pools, memfd memfd_create() ones, and privately malloc()-ed pools. Thus introduce annotations for the memory types supported and change pa_mempool_new() into a factory method based on required memory. Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
This commit is contained in:
parent
211a520543
commit
b88acd0266
18 changed files with 97 additions and 37 deletions
|
|
@ -69,14 +69,14 @@ pa_core* pa_core_new(pa_mainloop_api *m, bool shared, size_t shm_size) {
|
|||
pa_assert(m);
|
||||
|
||||
if (shared) {
|
||||
if (!(pool = pa_mempool_new(shared, shm_size))) {
|
||||
if (!(pool = pa_mempool_new(PA_MEM_TYPE_SHARED_POSIX, shm_size))) {
|
||||
pa_log_warn("Failed to allocate shared memory pool. Falling back to a normal memory pool.");
|
||||
shared = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!shared) {
|
||||
if (!(pool = pa_mempool_new(shared, shm_size))) {
|
||||
if (!(pool = pa_mempool_new(PA_MEM_TYPE_PRIVATE, shm_size))) {
|
||||
pa_log("pa_mempool_new() failed.");
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue