From ab9070a7b8cf2dcbfbf56ec4f24f77ea6e5f927c Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Thu, 5 Dec 2019 14:09:14 +0200 Subject: pipewire: update to master as of Dec 5th 2019 * Refreshed & combined some patches Bug-AGL: SPEC-2837 Change-Id: Ibd5849eff26bb51eb68580eac144aa07e646d127 Signed-off-by: George Kiagiadakis --- ...t-version-check-to-require-meson-0.47-not.patch | 2 +- .../0002-arm-build-with-mno-unaligned-access.patch | 2 +- ...nt-new-pwaudio-src-sink-elements-based-on.patch | 76 +++++++++++------ ...t-always-assume-that-output-ports-are-NOT.patch | 35 ++++++++ ...ringbuffer-request-pause-play-on-the-appr.patch | 77 ------------------ ...ringbuffer-wait-only-for-STREAM_STATE_CON.patch | 36 --------- ...005-module-access-add-same-sec-label-mode.patch | 94 ++++++++++++++++++++++ ...sink-set-the-default-latency-time-buffer-.patch | 38 --------- ...ringbuffer-set-node.latency-to-get-schedu.patch | 42 ---------- ...t-always-assume-that-output-ports-are-NOT.patch | 35 -------- ...009-module-access-add-same-sec-label-mode.patch | 94 ---------------------- .../recipes-multimedia/pipewire/pipewire_git.bb | 10 +-- 12 files changed, 187 insertions(+), 354 deletions(-) create mode 100644 meta-pipewire/recipes-multimedia/pipewire/pipewire/0004-audioconvert-always-assume-that-output-ports-are-NOT.patch delete mode 100644 meta-pipewire/recipes-multimedia/pipewire/pipewire/0004-gst-pwaudioringbuffer-request-pause-play-on-the-appr.patch delete mode 100644 meta-pipewire/recipes-multimedia/pipewire/pipewire/0005-gst-pwaudioringbuffer-wait-only-for-STREAM_STATE_CON.patch create mode 100644 meta-pipewire/recipes-multimedia/pipewire/pipewire/0005-module-access-add-same-sec-label-mode.patch delete mode 100644 meta-pipewire/recipes-multimedia/pipewire/pipewire/0006-gst-pwaudiosink-set-the-default-latency-time-buffer-.patch delete mode 100644 meta-pipewire/recipes-multimedia/pipewire/pipewire/0007-gst-pwaudioringbuffer-set-node.latency-to-get-schedu.patch delete mode 100644 meta-pipewire/recipes-multimedia/pipewire/pipewire/0008-audioconvert-always-assume-that-output-ports-are-NOT.patch delete mode 100644 meta-pipewire/recipes-multimedia/pipewire/pipewire/0009-module-access-add-same-sec-label-mode.patch diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-meson-revert-version-check-to-require-meson-0.47-not.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-meson-revert-version-check-to-require-meson-0.47-not.patch index 80a2b39e..4e7bb0d4 100644 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-meson-revert-version-check-to-require-meson-0.47-not.patch +++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-meson-revert-version-check-to-require-meson-0.47-not.patch @@ -1,4 +1,4 @@ -From 8d448cc2d3bd141742ede4636d2208f4dedc16f6 Mon Sep 17 00:00:00 2001 +From 5a249321aa84cd74e3d83bcd555c85fba3cd682d Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Sun, 22 Sep 2019 17:59:19 +0300 Subject: [PATCH] meson: revert version check to require meson 0.47, not 0.50 diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-arm-build-with-mno-unaligned-access.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-arm-build-with-mno-unaligned-access.patch index 3c4e45f4..2077af63 100644 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-arm-build-with-mno-unaligned-access.patch +++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-arm-build-with-mno-unaligned-access.patch @@ -1,4 +1,4 @@ -From c55e7b8e0028686afb74f4444b88c9e1dd6605c9 Mon Sep 17 00:00:00 2001 +From e4b81946baf2d8c08de87088c01a1d87ae4f03d9 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Mon, 24 Jun 2019 12:19:20 +0300 Subject: [PATCH] arm: build with -mno-unaligned-access diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0003-gst-Implement-new-pwaudio-src-sink-elements-based-on.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0003-gst-Implement-new-pwaudio-src-sink-elements-based-on.patch index bca551ca..b3eba21f 100644 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0003-gst-Implement-new-pwaudio-src-sink-elements-based-on.patch +++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0003-gst-Implement-new-pwaudio-src-sink-elements-based-on.patch @@ -1,4 +1,4 @@ -From 4696c0071d7a713d3e415f7d0cf29364a2b19aa2 Mon Sep 17 00:00:00 2001 +From 1b1f884a165ed7b2147affbdddf85a641d4cf180 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Tue, 19 Feb 2019 18:23:19 +0200 Subject: [PATCH] gst: Implement new pwaudio{src,sink} elements, based on @@ -18,14 +18,14 @@ Upstream-Status: Denied See https://gitlab.freedesktop.org/pipewire/pipewire/merge_requests/140 --- src/gst/gstpipewire.c | 8 +- - src/gst/gstpwaudioringbuffer.c | 542 +++++++++++++++++++++++++++++++++ + src/gst/gstpwaudioringbuffer.c | 565 +++++++++++++++++++++++++++++++++ src/gst/gstpwaudioringbuffer.h | 83 +++++ - src/gst/gstpwaudiosink.c | 200 ++++++++++++ + src/gst/gstpwaudiosink.c | 207 ++++++++++++ src/gst/gstpwaudiosink.h | 48 +++ src/gst/gstpwaudiosrc.c | 200 ++++++++++++ src/gst/gstpwaudiosrc.h | 48 +++ src/gst/meson.build | 6 + - 8 files changed, 1134 insertions(+), 1 deletion(-) + 8 files changed, 1164 insertions(+), 1 deletion(-) create mode 100644 src/gst/gstpwaudioringbuffer.c create mode 100644 src/gst/gstpwaudioringbuffer.h create mode 100644 src/gst/gstpwaudiosink.c @@ -66,10 +66,10 @@ index 4040264b..68fd446f 100644 } diff --git a/src/gst/gstpwaudioringbuffer.c b/src/gst/gstpwaudioringbuffer.c new file mode 100644 -index 00000000..989b2cd7 +index 00000000..babf2d83 --- /dev/null +++ b/src/gst/gstpwaudioringbuffer.c -@@ -0,0 +1,542 @@ +@@ -0,0 +1,565 @@ +/* PipeWire + * + * Copyright © 2018 Wim Taymans @@ -274,24 +274,41 @@ index 00000000..989b2cd7 + enum pw_stream_state state, const char *error) +{ + GstPwAudioRingBuffer *self = GST_PW_AUDIO_RING_BUFFER (data); ++ GstMessage *msg; + + GST_DEBUG_OBJECT (self->elem, "got stream state: %s", + pw_stream_state_as_string (state)); + + switch (state) { ++ case PW_STREAM_STATE_ERROR: ++ GST_ELEMENT_ERROR (self->elem, RESOURCE, FAILED, ++ ("stream error: %s", error), (NULL)); ++ break; + case PW_STREAM_STATE_UNCONNECTED: + GST_ELEMENT_ERROR (self->elem, RESOURCE, FAILED, + ("stream disconnected unexpectedly"), (NULL)); + break; + case PW_STREAM_STATE_CONNECTING: -+ case PW_STREAM_STATE_CONFIGURE: -+ case PW_STREAM_STATE_READY: ++ break; + case PW_STREAM_STATE_PAUSED: -+ case PW_STREAM_STATE_STREAMING: ++ if (old == PW_STREAM_STATE_STREAMING) { ++ if (GST_STATE (self->elem) != GST_STATE_PAUSED && ++ GST_STATE_TARGET (self->elem) != GST_STATE_PAUSED) { ++ GST_DEBUG_OBJECT (self->elem, "requesting GST_STATE_PAUSED"); ++ msg = gst_message_new_request_state (GST_OBJECT (self->elem), ++ GST_STATE_PAUSED); ++ gst_element_post_message (self->elem, msg); ++ } ++ } + break; -+ case PW_STREAM_STATE_ERROR: -+ GST_ELEMENT_ERROR (self->elem, RESOURCE, FAILED, -+ ("stream error: %s", error), (NULL)); ++ case PW_STREAM_STATE_STREAMING: ++ if (GST_STATE (self->elem) != GST_STATE_PLAYING && ++ GST_STATE_TARGET (self->elem) != GST_STATE_PLAYING) { ++ GST_DEBUG_OBJECT (self->elem, "requesting GST_STATE_PLAYING"); ++ msg = gst_message_new_request_state (GST_OBJECT (self->elem), ++ GST_STATE_PLAYING); ++ gst_element_post_message (self->elem, msg); ++ } + break; + } + pw_thread_loop_signal (self->main_loop, FALSE); @@ -312,13 +329,16 @@ index 00000000..989b2cd7 +} + +static void -+on_stream_format_changed (void *data, const struct spa_pod *format) ++on_stream_param_changed (void *data, uint32_t id, const struct spa_pod *format) +{ + GstPwAudioRingBuffer *self = GST_PW_AUDIO_RING_BUFFER (data); + const struct spa_pod *params[1]; + struct spa_pod_builder b = { NULL }; + uint8_t buffer[512]; + ++ if (format == NULL || id != SPA_PARAM_Format) ++ return; ++ + spa_pod_builder_init (&b, buffer, sizeof (buffer)); + params[0] = spa_pod_builder_add_object (&b, + SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers, @@ -329,7 +349,7 @@ index 00000000..989b2cd7 + SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)); + + GST_DEBUG_OBJECT (self->elem, "doing finish format, buffer size:%d", self->segsize); -+ pw_stream_finish_format (self->stream, 0, params, 1); ++ pw_stream_update_params (self->stream, params, 1); +} + +static void @@ -354,7 +374,7 @@ index 00000000..989b2cd7 + + b = pw_stream_dequeue_buffer (self->stream); + if (!b) { -+ GST_WARNING_OBJECT (self->elem, "no pipewire buffer available"); ++ GST_INFO_OBJECT (self->elem, "no pipewire buffer available"); + return; + } + @@ -418,7 +438,7 @@ index 00000000..989b2cd7 +static const struct pw_stream_events stream_events = { + PW_VERSION_STREAM_EVENTS, + .state_changed = on_stream_state_changed, -+ .format_changed = on_stream_format_changed, ++ .param_changed = on_stream_param_changed, + .process = on_stream_process, +}; + @@ -455,11 +475,9 @@ index 00000000..989b2cd7 + + /* construct param & props objects */ + ++ props = pw_properties_new (NULL, NULL); + if (self->props->properties) { -+ props = pw_properties_new (NULL, NULL); + gst_structure_foreach (self->props->properties, copy_properties, props); -+ } else { -+ props = NULL; + } + + spa_pod_builder_init (&b, buffer, sizeof (buffer)); @@ -476,6 +494,11 @@ index 00000000..989b2cd7 + self->rate = GST_AUDIO_INFO_RATE (&spec->info); + self->segoffset = 0; + ++ pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%u/%u", ++ self->segsize / self->bpf, self->rate); ++ GST_DEBUG_OBJECT (self->elem, "segsize:%u, bpf:%u, node.latency = %s", ++ self->segsize, self->bpf, pw_properties_get (props, PW_KEY_NODE_LATENCY)); ++ + /* connect stream */ + + pw_thread_loop_lock (self->main_loop); @@ -495,9 +518,9 @@ index 00000000..989b2cd7 + params, 1) < 0) + goto start_error; + -+ GST_DEBUG_OBJECT (self->elem, "waiting for stream READY"); ++ GST_DEBUG_OBJECT (self->elem, "waiting for stream CONFIGURE"); + -+ if (!wait_for_stream_state (self, PW_STREAM_STATE_READY)) ++ if (!wait_for_stream_state (self, PW_STREAM_STATE_PAUSED)) + goto start_error; + + pw_thread_loop_unlock (self->main_loop); @@ -703,10 +726,10 @@ index 00000000..f47f668a +#endif diff --git a/src/gst/gstpwaudiosink.c b/src/gst/gstpwaudiosink.c new file mode 100644 -index 00000000..6cb71385 +index 00000000..069996c3 --- /dev/null +++ b/src/gst/gstpwaudiosink.c -@@ -0,0 +1,200 @@ +@@ -0,0 +1,207 @@ +/* PipeWire + * + * Copyright © 2018 Wim Taymans @@ -766,6 +789,13 @@ index 00000000..6cb71385 +gst_pw_audio_sink_init (GstPwAudioSink * self) +{ + self->props.fd = -1; ++ ++ /* Bump the default buffer size up to 21.3 ms, which is the default on most ++ * sound cards, in hope to match the alsa buffer size on the pipewire server. ++ * This may not always happen, but it still sounds better than the 10ms ++ * default latency. This is temporary until we have a better mechanism to ++ * select the appropriate latency */ ++ GST_AUDIO_BASE_SINK (self)->latency_time = 21333; +} + +static void diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0004-audioconvert-always-assume-that-output-ports-are-NOT.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0004-audioconvert-always-assume-that-output-ports-are-NOT.patch new file mode 100644 index 00000000..beb87839 --- /dev/null +++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0004-audioconvert-always-assume-that-output-ports-are-NOT.patch @@ -0,0 +1,35 @@ +From ce155eb0073fba84556782633f79bb7d03492c07 Mon Sep 17 00:00:00 2001 +From: George Kiagiadakis +Date: Wed, 2 Oct 2019 21:40:34 +0300 +Subject: [PATCH] audioconvert: always assume that output ports are NOT monitor + ports + +Otherwise, when we setup audioconvert in merge+split mode, +it assumes that the splitter's ports are monitor ports and +belong to the merger. + +Upstream-Status: Inappropriate [workaround] +--- + spa/plugins/audioconvert/audioconvert.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c +index 74a62a35..72da37d1 100644 +--- a/spa/plugins/audioconvert/audioconvert.c ++++ b/spa/plugins/audioconvert/audioconvert.c +@@ -113,8 +113,12 @@ struct impl { + unsigned int add_listener:1; + }; + ++#if 0 + #define IS_MONITOR_PORT(this,dir,port_id) (dir == SPA_DIRECTION_OUTPUT && port_id > 0 && \ + this->mode[SPA_DIRECTION_INPUT] == SPA_PARAM_PORT_CONFIG_MODE_dsp) ++#else ++#define IS_MONITOR_PORT(this,dir,port_id) (false) ++#endif + + static void emit_node_info(struct impl *this, bool full) + { +-- +2.24.0 + diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0004-gst-pwaudioringbuffer-request-pause-play-on-the-appr.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0004-gst-pwaudioringbuffer-request-pause-play-on-the-appr.patch deleted file mode 100644 index 29febbfc..00000000 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0004-gst-pwaudioringbuffer-request-pause-play-on-the-appr.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 1027efb2ced95a9548007ccc2f07805d48073846 Mon Sep 17 00:00:00 2001 -From: George Kiagiadakis -Date: Thu, 11 Jul 2019 16:21:17 +0300 -Subject: [PATCH] gst/pwaudioringbuffer: request pause/play on the appropriate - stream state changes - -This allows the client to properly go to PAUSED when the session manager -unlinks the stream and go again to PLAYING when the sm re-links it. -This allows the session manager to implement policies without letting -the client pipeline freeze (in the absence of a running audio clock) -when it is unlinked. Note that in case the client doesn't handle the -request, there is still no issue. Like in pulseaudio, the clock just -freezes, so the pipeline stops progressing. - -This is similar to the pulseaudio cork/uncork mechanism. - -Upstream-Status: Denied -See https://gitlab.freedesktop.org/pipewire/pipewire/merge_requests/140 ---- - src/gst/gstpwaudioringbuffer.c | 27 +++++++++++++++++++++++---- - 1 file changed, 23 insertions(+), 4 deletions(-) - -diff --git a/src/gst/gstpwaudioringbuffer.c b/src/gst/gstpwaudioringbuffer.c -index 989b2cd7..97350f38 100644 ---- a/src/gst/gstpwaudioringbuffer.c -+++ b/src/gst/gstpwaudioringbuffer.c -@@ -202,11 +202,16 @@ on_stream_state_changed (void *data, enum pw_stream_state old, - enum pw_stream_state state, const char *error) - { - GstPwAudioRingBuffer *self = GST_PW_AUDIO_RING_BUFFER (data); -+ GstMessage *msg; - - GST_DEBUG_OBJECT (self->elem, "got stream state: %s", - pw_stream_state_as_string (state)); - - switch (state) { -+ case PW_STREAM_STATE_ERROR: -+ GST_ELEMENT_ERROR (self->elem, RESOURCE, FAILED, -+ ("stream error: %s", error), (NULL)); -+ break; - case PW_STREAM_STATE_UNCONNECTED: - GST_ELEMENT_ERROR (self->elem, RESOURCE, FAILED, - ("stream disconnected unexpectedly"), (NULL)); -@@ -214,12 +219,26 @@ on_stream_state_changed (void *data, enum pw_stream_state old, - case PW_STREAM_STATE_CONNECTING: - case PW_STREAM_STATE_CONFIGURE: - case PW_STREAM_STATE_READY: -+ break; - case PW_STREAM_STATE_PAUSED: -- case PW_STREAM_STATE_STREAMING: -+ if (old == PW_STREAM_STATE_STREAMING) { -+ if (GST_STATE (self->elem) != GST_STATE_PAUSED && -+ GST_STATE_TARGET (self->elem) != GST_STATE_PAUSED) { -+ GST_DEBUG_OBJECT (self->elem, "requesting GST_STATE_PAUSED"); -+ msg = gst_message_new_request_state (GST_OBJECT (self->elem), -+ GST_STATE_PAUSED); -+ gst_element_post_message (self->elem, msg); -+ } -+ } - break; -- case PW_STREAM_STATE_ERROR: -- GST_ELEMENT_ERROR (self->elem, RESOURCE, FAILED, -- ("stream error: %s", error), (NULL)); -+ case PW_STREAM_STATE_STREAMING: -+ if (GST_STATE (self->elem) != GST_STATE_PLAYING && -+ GST_STATE_TARGET (self->elem) != GST_STATE_PLAYING) { -+ GST_DEBUG_OBJECT (self->elem, "requesting GST_STATE_PLAYING"); -+ msg = gst_message_new_request_state (GST_OBJECT (self->elem), -+ GST_STATE_PLAYING); -+ gst_element_post_message (self->elem, msg); -+ } - break; - } - pw_thread_loop_signal (self->main_loop, FALSE); --- -2.24.0 - diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0005-gst-pwaudioringbuffer-wait-only-for-STREAM_STATE_CON.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0005-gst-pwaudioringbuffer-wait-only-for-STREAM_STATE_CON.patch deleted file mode 100644 index 66fd4247..00000000 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0005-gst-pwaudioringbuffer-wait-only-for-STREAM_STATE_CON.patch +++ /dev/null @@ -1,36 +0,0 @@ -From ea2ba0fcf561fecd7e62e80e2c34bf6bd23f917b Mon Sep 17 00:00:00 2001 -From: George Kiagiadakis -Date: Thu, 11 Jul 2019 16:34:35 +0300 -Subject: [PATCH] gst/pwaudioringbuffer: wait only for STREAM_STATE_CONFIGURE - when starting - -The CONFIGURE state is reached when the pw_client_node is exported, -while the READY state requires the session manager to try and link -the stream. If the SM does not want to link the stream due to policy, -the client should not hang there forever. - -Upstream-Status: Denied -See https://gitlab.freedesktop.org/pipewire/pipewire/merge_requests/140 ---- - src/gst/gstpwaudioringbuffer.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/gst/gstpwaudioringbuffer.c b/src/gst/gstpwaudioringbuffer.c -index 97350f38..3efec6ec 100644 ---- a/src/gst/gstpwaudioringbuffer.c -+++ b/src/gst/gstpwaudioringbuffer.c -@@ -442,9 +442,9 @@ gst_pw_audio_ring_buffer_acquire (GstAudioRingBuffer *buf, - params, 1) < 0) - goto start_error; - -- GST_DEBUG_OBJECT (self->elem, "waiting for stream READY"); -+ GST_DEBUG_OBJECT (self->elem, "waiting for stream CONFIGURE"); - -- if (!wait_for_stream_state (self, PW_STREAM_STATE_READY)) -+ if (!wait_for_stream_state (self, PW_STREAM_STATE_CONFIGURE)) - goto start_error; - - pw_thread_loop_unlock (self->main_loop); --- -2.24.0 - diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0005-module-access-add-same-sec-label-mode.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0005-module-access-add-same-sec-label-mode.patch new file mode 100644 index 00000000..07a1ec11 --- /dev/null +++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0005-module-access-add-same-sec-label-mode.patch @@ -0,0 +1,94 @@ +From 19fad1a4fa8bdc4f02aac4e169e7ff9cab18bdcd Mon Sep 17 00:00:00 2001 +From: George Kiagiadakis +Date: Tue, 19 Nov 2019 17:09:07 +0200 +Subject: [PATCH] module-access: add same-sec-label-mode + +This is a mode where the access module allows all clients that have +the same security label as the pipewire daemon, and every other +client is put on the restricted state. + +In systems that use SMACK security labels, such as AGL, this allows +the session manager (which is spawned by pipewire, inheriting the +same smack label) to have full access to all objects, while every +other client is restricted and the session manager must decide +what to do with it + +Note that while this option is configurable, there is no loss of +security if this option is not set in the configuration. Clients +that don't have the same security context will be considered to +be flatpak clients because pipewire will not be able to open +/proc/pid/cmdline. This however results in some unwanted error +messages that may be confusing. + +Upstream-Status: Inappropriate [agl/smack specific] +--- + src/modules/module-access.c | 45 ++++++++++++++++++++++++++++++++++++- + 1 file changed, 44 insertions(+), 1 deletion(-) + +diff --git a/src/modules/module-access.c b/src/modules/module-access.c +index 09dafa43..f75306d9 100644 +--- a/src/modules/module-access.c ++++ b/src/modules/module-access.c +@@ -50,6 +50,30 @@ struct impl { + struct spa_hook module_listener; + }; + ++static int check_seclabel(const char *str) ++{ ++ char attr[1024]; ++ int fd, len; ++ ++ fd = open("/proc/self/attr/current", O_RDONLY); ++ if (fd < 0) ++ return -errno; ++ ++ if ((len = read(fd, attr, 1024)) <= 0) { ++ close(fd); ++ return -EIO; ++ } ++ attr[len] = '\0'; ++ ++ if (strcmp(attr, str) == 0) { ++ close(fd); ++ return 1; ++ } ++ ++ close(fd); ++ return 0; ++} ++ + static int check_cmdline(struct pw_client *client, int pid, const char *str) + { + char path[2048]; +@@ -121,8 +145,27 @@ core_check_access(void *data, struct pw_client *client) + const char *str; + int pid, res; + ++ props = pw_client_get_properties(client); ++ ++ if (impl->properties && ++ (str = pw_properties_get(impl->properties, "same-sec-label-mode")) != NULL && ++ strcmp(str, "1") == 0) { ++ if (props && (str = pw_properties_get(props, PW_KEY_SEC_LABEL)) != NULL) { ++ res = check_seclabel(str); ++ if (res == 1) ++ goto granted; ++ else if (res < 0) ++ pw_log_warn("module %p: client %p seclabel check failed: %s", ++ impl, client, spa_strerror(res)); ++ } ++ pw_log_debug("module %p: seclabel restricted client %p added", ++ impl, client); ++ items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, "restricted"); ++ goto wait_permissions; ++ } ++ + pid = -EINVAL; +- if ((props = pw_client_get_properties(client)) != NULL) { ++ if (props != NULL) { + if ((str = pw_properties_get(props, PW_KEY_SEC_PID)) != NULL) + pid = atoi(str); + } +-- +2.24.0 + diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0006-gst-pwaudiosink-set-the-default-latency-time-buffer-.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0006-gst-pwaudiosink-set-the-default-latency-time-buffer-.patch deleted file mode 100644 index b3c35fe5..00000000 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0006-gst-pwaudiosink-set-the-default-latency-time-buffer-.patch +++ /dev/null @@ -1,38 +0,0 @@ -From cc5ad0de4afb4c283e3c6b373b5fd891f9c19381 Mon Sep 17 00:00:00 2001 -From: George Kiagiadakis -Date: Thu, 11 Jul 2019 17:07:15 +0300 -Subject: [PATCH] gst/pwaudiosink: set the default latency time (buffer size) - to be 21.3ms - -This is to solve underrun issues that seem to appear with the default -10ms latency that GstBaseAudioSink has. -Hopefully in the future we will have a better mechanism to pick -the appropriate latency instead of hardcoding it here. - -Upstream-Status: Denied -See https://gitlab.freedesktop.org/pipewire/pipewire/merge_requests/140 ---- - src/gst/gstpwaudiosink.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/gst/gstpwaudiosink.c b/src/gst/gstpwaudiosink.c -index 6cb71385..069996c3 100644 ---- a/src/gst/gstpwaudiosink.c -+++ b/src/gst/gstpwaudiosink.c -@@ -57,6 +57,13 @@ static void - gst_pw_audio_sink_init (GstPwAudioSink * self) - { - self->props.fd = -1; -+ -+ /* Bump the default buffer size up to 21.3 ms, which is the default on most -+ * sound cards, in hope to match the alsa buffer size on the pipewire server. -+ * This may not always happen, but it still sounds better than the 10ms -+ * default latency. This is temporary until we have a better mechanism to -+ * select the appropriate latency */ -+ GST_AUDIO_BASE_SINK (self)->latency_time = 21333; - } - - static void --- -2.24.0 - diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0007-gst-pwaudioringbuffer-set-node.latency-to-get-schedu.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0007-gst-pwaudioringbuffer-set-node.latency-to-get-schedu.patch deleted file mode 100644 index 1f542cb4..00000000 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0007-gst-pwaudioringbuffer-set-node.latency-to-get-schedu.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 3357a7d5bfb32a26f6c4fd3df2ea3a8f04f20770 Mon Sep 17 00:00:00 2001 -From: George Kiagiadakis -Date: Tue, 20 Aug 2019 18:33:35 +0300 -Subject: [PATCH] gst: pwaudioringbuffer: set node.latency to get scheduled - correctly in capture mode - -Upstream-Status: Denied -See https://gitlab.freedesktop.org/pipewire/pipewire/merge_requests/140 ---- - src/gst/gstpwaudioringbuffer.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/src/gst/gstpwaudioringbuffer.c b/src/gst/gstpwaudioringbuffer.c -index 3efec6ec..8136b815 100644 ---- a/src/gst/gstpwaudioringbuffer.c -+++ b/src/gst/gstpwaudioringbuffer.c -@@ -402,11 +402,9 @@ gst_pw_audio_ring_buffer_acquire (GstAudioRingBuffer *buf, - - /* construct param & props objects */ - -+ props = pw_properties_new (NULL, NULL); - if (self->props->properties) { -- props = pw_properties_new (NULL, NULL); - gst_structure_foreach (self->props->properties, copy_properties, props); -- } else { -- props = NULL; - } - - spa_pod_builder_init (&b, buffer, sizeof (buffer)); -@@ -423,6 +421,9 @@ gst_pw_audio_ring_buffer_acquire (GstAudioRingBuffer *buf, - self->rate = GST_AUDIO_INFO_RATE (&spec->info); - self->segoffset = 0; - -+ pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%u/%u", -+ self->segsize / self->bpf, self->rate); -+ - /* connect stream */ - - pw_thread_loop_lock (self->main_loop); --- -2.24.0 - diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0008-audioconvert-always-assume-that-output-ports-are-NOT.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0008-audioconvert-always-assume-that-output-ports-are-NOT.patch deleted file mode 100644 index b20881dd..00000000 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0008-audioconvert-always-assume-that-output-ports-are-NOT.patch +++ /dev/null @@ -1,35 +0,0 @@ -From c4028fd5d07bd6f901ca76cd7218150c658193f8 Mon Sep 17 00:00:00 2001 -From: George Kiagiadakis -Date: Wed, 2 Oct 2019 21:40:34 +0300 -Subject: [PATCH] audioconvert: always assume that output ports are NOT monitor - ports - -Otherwise, when we setup audioconvert in merge+split mode, -it assumes that the splitter's ports are monitor ports and -belong to the merger. - -Upstream-Status: Inappropriate [workaround] ---- - spa/plugins/audioconvert/audioconvert.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c -index 74a62a35..72da37d1 100644 ---- a/spa/plugins/audioconvert/audioconvert.c -+++ b/spa/plugins/audioconvert/audioconvert.c -@@ -113,8 +113,12 @@ struct impl { - unsigned int add_listener:1; - }; - -+#if 0 - #define IS_MONITOR_PORT(this,dir,port_id) (dir == SPA_DIRECTION_OUTPUT && port_id > 0 && \ - this->mode[SPA_DIRECTION_INPUT] == SPA_PARAM_PORT_CONFIG_MODE_dsp) -+#else -+#define IS_MONITOR_PORT(this,dir,port_id) (false) -+#endif - - static void emit_node_info(struct impl *this, bool full) - { --- -2.24.0 - diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0009-module-access-add-same-sec-label-mode.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0009-module-access-add-same-sec-label-mode.patch deleted file mode 100644 index f0fc11b2..00000000 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0009-module-access-add-same-sec-label-mode.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 7bde580db9b67c503de90211d344b15b933fecbe Mon Sep 17 00:00:00 2001 -From: George Kiagiadakis -Date: Tue, 19 Nov 2019 17:09:07 +0200 -Subject: [PATCH] module-access: add same-sec-label-mode - -This is a mode where the access module allows all clients that have -the same security label as the pipewire daemon, and every other -client is put on the restricted state. - -In systems that use SMACK security labels, such as AGL, this allows -the session manager (which is spawned by pipewire, inheriting the -same smack label) to have full access to all objects, while every -other client is restricted and the session manager must decide -what to do with it - -Note that while this option is configurable, there is no loss of -security if this option is not set in the configuration. Clients -that don't have the same security context will be considered to -be flatpak clients because pipewire will not be able to open -/proc/pid/cmdline. This however results in some unwanted error -messages that may be confusing. - -Upstream-Status: Inappropriate [agl/smack specific] ---- - src/modules/module-access.c | 45 ++++++++++++++++++++++++++++++++++++- - 1 file changed, 44 insertions(+), 1 deletion(-) - -diff --git a/src/modules/module-access.c b/src/modules/module-access.c -index 09dafa43..f75306d9 100644 ---- a/src/modules/module-access.c -+++ b/src/modules/module-access.c -@@ -50,6 +50,30 @@ struct impl { - struct spa_hook module_listener; - }; - -+static int check_seclabel(const char *str) -+{ -+ char attr[1024]; -+ int fd, len; -+ -+ fd = open("/proc/self/attr/current", O_RDONLY); -+ if (fd < 0) -+ return -errno; -+ -+ if ((len = read(fd, attr, 1024)) <= 0) { -+ close(fd); -+ return -EIO; -+ } -+ attr[len] = '\0'; -+ -+ if (strcmp(attr, str) == 0) { -+ close(fd); -+ return 1; -+ } -+ -+ close(fd); -+ return 0; -+} -+ - static int check_cmdline(struct pw_client *client, int pid, const char *str) - { - char path[2048]; -@@ -121,8 +145,27 @@ core_check_access(void *data, struct pw_client *client) - const char *str; - int pid, res; - -+ props = pw_client_get_properties(client); -+ -+ if (impl->properties && -+ (str = pw_properties_get(impl->properties, "same-sec-label-mode")) != NULL && -+ strcmp(str, "1") == 0) { -+ if (props && (str = pw_properties_get(props, PW_KEY_SEC_LABEL)) != NULL) { -+ res = check_seclabel(str); -+ if (res == 1) -+ goto granted; -+ else if (res < 0) -+ pw_log_warn("module %p: client %p seclabel check failed: %s", -+ impl, client, spa_strerror(res)); -+ } -+ pw_log_debug("module %p: seclabel restricted client %p added", -+ impl, client); -+ items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, "restricted"); -+ goto wait_permissions; -+ } -+ - pid = -EINVAL; -- if ((props = pw_client_get_properties(client)) != NULL) { -+ if (props != NULL) { - if ((str = pw_properties_get(props, PW_KEY_SEC_PID)) != NULL) - pid = atoi(str); - } --- -2.24.0 - diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire_git.bb b/meta-pipewire/recipes-multimedia/pipewire/pipewire_git.bb index ec3a0572..68eb3d1e 100644 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire_git.bb +++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire_git.bb @@ -4,15 +4,11 @@ SRC_URI = "git://gitlab.freedesktop.org/pipewire/pipewire.git;protocol=https;bra file://0001-meson-revert-version-check-to-require-meson-0.47-not.patch \ file://0002-arm-build-with-mno-unaligned-access.patch \ file://0003-gst-Implement-new-pwaudio-src-sink-elements-based-on.patch \ - file://0004-gst-pwaudioringbuffer-request-pause-play-on-the-appr.patch \ - file://0005-gst-pwaudioringbuffer-wait-only-for-STREAM_STATE_CON.patch \ - file://0006-gst-pwaudiosink-set-the-default-latency-time-buffer-.patch \ - file://0007-gst-pwaudioringbuffer-set-node.latency-to-get-schedu.patch \ - file://0008-audioconvert-always-assume-that-output-ports-are-NOT.patch \ - file://0009-module-access-add-same-sec-label-mode.patch \ + file://0004-audioconvert-always-assume-that-output-ports-are-NOT.patch \ + file://0005-module-access-add-same-sec-label-mode.patch \ " -SRCREV = "e18a24493a254c881a1bda384fdcd70cd671fd1c" +SRCREV = "b0932e687fc47e0872ca291531f2291d99042d70" PV = "0.2.91+git${SRCPV}+1" S = "${WORKDIR}/git" -- cgit 1.2.3-korg