[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] context: add property to forcefully disable shared memory channels

PulseAudio Marge Bot gitlab at gitlab.freedesktop.org
Wed Dec 30 08:39:39 UTC 2020



PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio


Commits:
3ecea410 by Igor V. Kovalenko at 2020-12-30T08:35:03+00:00
context: add property to forcefully disable shared memory channels

If application wants last bits of virtual memory, allow it to forcefully disable
shared memory communication channels via PA_PROP_CONTEXT_FORCE_DISABLE_SHM=yes

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/448>

- - - - -


2 changed files:

- src/pulse/context.c
- src/pulse/proplist.h


Changes:

=====================================
src/pulse/context.c
=====================================
@@ -128,6 +128,7 @@ static void reset_callbacks(pa_context *c) {
 pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *name, const pa_proplist *p) {
     pa_context *c;
     pa_mem_type_t type;
+    const char *force_disable_shm_str;
 
     pa_assert(mainloop);
 
@@ -173,6 +174,16 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
     c->conf = pa_client_conf_new();
     pa_client_conf_load(c->conf, true, true);
 
+    force_disable_shm_str = pa_proplist_gets(c->proplist, PA_PROP_CONTEXT_FORCE_DISABLE_SHM);
+    if (force_disable_shm_str) {
+        int b = pa_parse_boolean(force_disable_shm_str);
+        if (b < 0) {
+            pa_log_warn("Ignored invalid value for '%s' property: %s", PA_PROP_CONTEXT_FORCE_DISABLE_SHM, force_disable_shm_str);
+        } else if (b) {
+            c->conf->disable_shm = true;
+        }
+    }
+
     c->srb_template.readfd = -1;
     c->srb_template.writefd = -1;
 


=====================================
src/pulse/proplist.h
=====================================
@@ -267,6 +267,9 @@ PA_C_DECL_BEGIN
 /** For PCM formats: the channel map of the stream as returned by pa_channel_map_snprint() \since 1.0 */
 #define PA_PROP_FORMAT_CHANNEL_MAP             "format.channel_map"
 
+/** For context: whether to forcefully disable data transfer via POSIX or memfd shared memory. This property overrides any other client configuration which would otherwise enable SHM communication channels. \since 15.0 */
+#define PA_PROP_CONTEXT_FORCE_DISABLE_SHM      "context.force.disable.shm"
+
 /** A property list object. Basically a dictionary with ASCII strings
  * as keys and arbitrary data as values. \since 0.9.11 */
 typedef struct pa_proplist pa_proplist;



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/3ecea410d79d398126b54579b422e2f16baede5f

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/3ecea410d79d398126b54579b422e2f16baede5f
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20201230/51e21132/attachment-0001.htm>


More information about the pulseaudio-commits mailing list