mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-08 13:29:59 -05:00
Make the shared memory segment size configurable
This is useful only on systems where memory overcommit is not available or disabled.
This commit is contained in:
parent
a84b72bf96
commit
79ad4e63f6
23 changed files with 99 additions and 37 deletions
|
|
@ -61,6 +61,7 @@ static const pa_client_conf default_conf = {
|
|||
.disable_shm = FALSE,
|
||||
.cookie_file = NULL,
|
||||
.cookie_valid = FALSE,
|
||||
.shm_size = 0
|
||||
};
|
||||
|
||||
pa_client_conf *pa_client_conf_new(void) {
|
||||
|
|
@ -99,6 +100,7 @@ int pa_client_conf_load(pa_client_conf *c, const char *filename) {
|
|||
{ "autospawn", pa_config_parse_bool, NULL },
|
||||
{ "cookie-file", pa_config_parse_string, NULL },
|
||||
{ "disable-shm", pa_config_parse_bool, NULL },
|
||||
{ "shm-size-bytes", pa_config_parse_size, NULL },
|
||||
{ NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
|
|
@ -110,6 +112,7 @@ int pa_client_conf_load(pa_client_conf *c, const char *filename) {
|
|||
table[5].data = &c->autospawn;
|
||||
table[6].data = &c->cookie_file;
|
||||
table[7].data = &c->disable_shm;
|
||||
table[8].data = &c->shm_size;
|
||||
|
||||
if (filename) {
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ typedef struct pa_client_conf {
|
|||
pa_bool_t autospawn, disable_shm;
|
||||
uint8_t cookie[PA_NATIVE_COOKIE_LENGTH];
|
||||
pa_bool_t cookie_valid; /* non-zero, when cookie is valid */
|
||||
size_t shm_size;
|
||||
} pa_client_conf;
|
||||
|
||||
/* Create a new configuration data object and reset it to defaults */
|
||||
|
|
|
|||
|
|
@ -30,3 +30,4 @@
|
|||
; cookie-file =
|
||||
|
||||
; disable-shm = no
|
||||
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
|
||||
|
|
|
|||
|
|
@ -174,10 +174,10 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
|
|||
pa_client_conf_load(c->conf, NULL);
|
||||
pa_client_conf_env(c->conf);
|
||||
|
||||
if (!(c->mempool = pa_mempool_new(!c->conf->disable_shm))) {
|
||||
if (!(c->mempool = pa_mempool_new(!c->conf->disable_shm, c->conf->shm_size))) {
|
||||
|
||||
if (!c->conf->disable_shm)
|
||||
c->mempool = pa_mempool_new(FALSE);
|
||||
c->mempool = pa_mempool_new(FALSE, c->conf->shm_size);
|
||||
|
||||
if (!c->mempool) {
|
||||
context_free(c);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue