pipewire: update patches 44/21844/3
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>
Wed, 10 Jul 2019 15:07:13 +0000 (18:07 +0300)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Fri, 12 Jul 2019 12:49:22 +0000 (12:49 +0000)
0004 adds a useful cli utility
0006 aids debugging
0007 fixes audio in qemu (SPEC-2570)
0008 & 0009 add functionality necessary for implementing multiple
  streams per device
The rest is the same as before

Bug-AGL: SPEC-2570

Change-Id: If6736f0fc87491edce6981c0be44094239ddaa89
Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-spa-include-install-missing-headers.patch
meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-extensions-implement-Endpoint-ClientEndpoint-interfa.patch [moved from meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-extensions-implement-Endpoint-ClientEndpoint-interfa.patch with 99% similarity]
meta-pipewire/recipes-multimedia/pipewire/pipewire/0003-pipewire-cli-add-support-for-printing-endpoint-info-.patch [moved from meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-pipewire-cli-add-support-for-printing-endpoint-info-.patch with 96% similarity]
meta-pipewire/recipes-multimedia/pipewire/pipewire/0004-pipewire-cli-add-command-to-modify-endpoint-control-.patch [new file with mode: 0644]
meta-pipewire/recipes-multimedia/pipewire/pipewire/0005-arm-build-with-mno-unaligned-access.patch [moved from meta-pipewire/recipes-multimedia/pipewire/pipewire/0004-arm-build-with-mno-unaligned-access.patch with 78% similarity]
meta-pipewire/recipes-multimedia/pipewire/pipewire/0006-logger-print-timestamps-on-logged-messages.patch [new file with mode: 0644]
meta-pipewire/recipes-multimedia/pipewire/pipewire/0007-alsa-make-corrections-on-the-timeout-based-on-how-fa.patch [new file with mode: 0644]
meta-pipewire/recipes-multimedia/pipewire/pipewire/0008-audio-dsp-allow-mode-to-be-set-with-a-property.patch [new file with mode: 0644]
meta-pipewire/recipes-multimedia/pipewire/pipewire/0009-audioconvert-do-setup-internal-links-and-buffers-als.patch [new file with mode: 0644]
meta-pipewire/recipes-multimedia/pipewire/pipewire_git.bb

index 01efe77..5b92811 100644 (file)
@@ -1,8 +1,9 @@
-From 14893ae87ab0b15b7e438779433c4973c797c5f5 Mon Sep 17 00:00:00 2001
+From dbb6e10df8c2ba9b874eb9350d4cb93c62dba5a9 Mon Sep 17 00:00:00 2001
 From: George Kiagiadakis <george.kiagiadakis@collabora.com>
 Date: Wed, 29 May 2019 12:09:13 +0300
 Subject: [PATCH] spa/include: install missing headers
 
 From: George Kiagiadakis <george.kiagiadakis@collabora.com>
 Date: Wed, 29 May 2019 12:09:13 +0300
 Subject: [PATCH] spa/include: install missing headers
 
+Upstream-Status: Accepted
 ---
  spa/include/spa/meson.build | 3 +++
  1 file changed, 3 insertions(+)
 ---
  spa/include/spa/meson.build | 3 +++
  1 file changed, 3 insertions(+)
@@ -1,13 +1,14 @@
-From 3d186f7b97c508cc16955a96a69ee5d6c9db57dc Mon Sep 17 00:00:00 2001
+From 5afe82a430642c2f7e116941709a624b8fd73011 Mon Sep 17 00:00:00 2001
 From: George Kiagiadakis <george.kiagiadakis@collabora.com>
 Date: Thu, 23 May 2019 18:59:05 +0300
 From: George Kiagiadakis <george.kiagiadakis@collabora.com>
 Date: Thu, 23 May 2019 18:59:05 +0300
-Subject: [PATCH 1/2] extensions: implement Endpoint & ClientEndpoint
- interfaces
+Subject: [PATCH] extensions: implement Endpoint & ClientEndpoint interfaces
 
 The ClientEndpoint interface allows session managers to register
 endpoint objects on pipewire.
 The Endpoint interface allows other clients to interact with
 endpoints provided by the session manager.
 
 The ClientEndpoint interface allows session managers to register
 endpoint objects on pipewire.
 The Endpoint interface allows other clients to interact with
 endpoints provided by the session manager.
+
+Upstream-Status: Pending
 ---
  src/extensions/client-endpoint.h              | 106 ++++
  src/extensions/endpoint.h                     | 237 +++++++++
 ---
  src/extensions/client-endpoint.h              | 106 ++++
  src/extensions/endpoint.h                     | 237 +++++++++
@@ -141,7 +142,7 @@ index 00000000..0389893c
 +#endif /* PIPEWIRE_EXT_CLIENT_ENDPOINT_H */
 diff --git a/src/extensions/endpoint.h b/src/extensions/endpoint.h
 new file mode 100644
 +#endif /* PIPEWIRE_EXT_CLIENT_ENDPOINT_H */
 diff --git a/src/extensions/endpoint.h b/src/extensions/endpoint.h
 new file mode 100644
-index 00000000..3b84dd49
+index 00000000..211c0895
 --- /dev/null
 +++ b/src/extensions/endpoint.h
 @@ -0,0 +1,237 @@
 --- /dev/null
 +++ b/src/extensions/endpoint.h
 @@ -0,0 +1,237 @@
@@ -231,7 +232,7 @@ index 00000000..3b84dd49
 +      { PW_ENDPOINT_PARAM_CONTROL_stream_id, SPA_TYPE_Int, PW_ENDPOINT_TYPE_INFO_PARAM_CONTROL_BASE "streamId", NULL },
 +      { PW_ENDPOINT_PARAM_CONTROL_name, SPA_TYPE_String, PW_ENDPOINT_TYPE_INFO_PARAM_CONTROL_BASE "name", NULL },
 +      { PW_ENDPOINT_PARAM_CONTROL_type, SPA_TYPE_Pod, PW_ENDPOINT_TYPE_INFO_PARAM_CONTROL_BASE "type", NULL },
 +      { PW_ENDPOINT_PARAM_CONTROL_stream_id, SPA_TYPE_Int, PW_ENDPOINT_TYPE_INFO_PARAM_CONTROL_BASE "streamId", NULL },
 +      { PW_ENDPOINT_PARAM_CONTROL_name, SPA_TYPE_String, PW_ENDPOINT_TYPE_INFO_PARAM_CONTROL_BASE "name", NULL },
 +      { PW_ENDPOINT_PARAM_CONTROL_type, SPA_TYPE_Pod, PW_ENDPOINT_TYPE_INFO_PARAM_CONTROL_BASE "type", NULL },
-+      { PW_ENDPOINT_PARAM_CONTROL_value, SPA_TYPE_Struct, PW_ENDPOINT_TYPE_INFO_PARAM_CONTROL_BASE "labels", NULL },
++      { PW_ENDPOINT_PARAM_CONTROL_value, SPA_TYPE_Struct, PW_ENDPOINT_TYPE_INFO_PARAM_CONTROL_BASE "value", NULL },
 +      { 0, 0, NULL, NULL },
 +};
 +
 +      { 0, 0, NULL, NULL },
 +};
 +
@@ -1,12 +1,13 @@
-From e76140c534dde71424eb9abd1dde69cf14152da5 Mon Sep 17 00:00:00 2001
+From 0e9fe3cfb19c751655f16ce4b8c6100269f23ff2 Mon Sep 17 00:00:00 2001
 From: George Kiagiadakis <george.kiagiadakis@collabora.com>
 Date: Tue, 28 May 2019 11:46:36 +0300
 From: George Kiagiadakis <george.kiagiadakis@collabora.com>
 Date: Tue, 28 May 2019 11:46:36 +0300
-Subject: [PATCH 2/2] pipewire-cli: add support for printing endpoint info &
- params
+Subject: [PATCH] pipewire-cli: add support for printing endpoint info & params
 
 Note that you have to run:
   load-module libpipewire-module-endpoint
 before trying to query any endpoints
 
 Note that you have to run:
   load-module libpipewire-module-endpoint
 before trying to query any endpoints
+
+Upstream-Status: Pending
 ---
  src/tools/pipewire-cli.c | 78 +++++++++++++++++++++++++++++++++++++++-
  1 file changed, 77 insertions(+), 1 deletion(-)
 ---
  src/tools/pipewire-cli.c | 78 +++++++++++++++++++++++++++++++++++++++-
  1 file changed, 77 insertions(+), 1 deletion(-)
diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0004-pipewire-cli-add-command-to-modify-endpoint-control-.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0004-pipewire-cli-add-command-to-modify-endpoint-control-.patch
new file mode 100644 (file)
index 0000000..4394d60
--- /dev/null
@@ -0,0 +1,124 @@
+From 824c8abf88e9ee82567c177145798b619298ab91 Mon Sep 17 00:00:00 2001
+From: George Kiagiadakis <george.kiagiadakis@collabora.com>
+Date: Wed, 5 Jun 2019 14:57:37 +0300
+Subject: [PATCH] pipewire-cli: add command to modify endpoint control values
+
+Upstream-Status: Pending
+---
+ src/tools/pipewire-cli.c | 86 ++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 86 insertions(+)
+
+diff --git a/src/tools/pipewire-cli.c b/src/tools/pipewire-cli.c
+index 9511db82..b52ab100 100644
+--- a/src/tools/pipewire-cli.c
++++ b/src/tools/pipewire-cli.c
+@@ -210,6 +210,7 @@ static bool do_export_node(struct data *data, const char *cmd, char *args, char
+ static bool do_enum_params(struct data *data, const char *cmd, char *args, char **error);
+ static bool do_permissions(struct data *data, const char *cmd, char *args, char **error);
+ static bool do_get_permissions(struct data *data, const char *cmd, char *args, char **error);
++static bool do_endpoint_control(struct data *data, const char *cmd, char *args, char **error);
+ static struct command command_list[] = {
+       { "help", "Show this help", do_help },
+@@ -228,6 +229,7 @@ static struct command command_list[] = {
+       { "enum-params", "Enumerate params of an object <object-id> [<param-id-name>]", do_enum_params },
+       { "permissions", "Set permissions for a client <client-id> <permissions>", do_permissions },
+       { "get-permissions", "Get permissions of a client <client-id>", do_get_permissions },
++      { "endpoint-control", "Set control value on an endpoint <object-id> <control-id> <type: b|i|l|d> <value>", do_endpoint_control },
+ };
+ static bool do_help(struct data *data, const char *cmd, char *args, char **error)
+@@ -1357,6 +1359,90 @@ static bool do_get_permissions(struct data *data, const char *cmd, char *args, c
+       return true;
+ }
++static bool do_endpoint_control(struct data *data, const char *cmd, char *args, char **error)
++{
++      struct remote_data *rd = data->current;
++      int n;
++      char *a[4];
++      uint32_t id, control_id;
++      struct global *global;
++      char buffer[1024];
++      struct spa_pod_builder b;
++      struct spa_pod_frame f;
++      struct spa_pod *param;
++
++      n = pw_split_ip(args, WHITESPACE, 4, a);
++      if (n < 4) {
++              asprintf(error, "%s <object-id> <control-id> <type: b|i|l|d> <value>", cmd);
++              return false;
++      }
++
++      id = atoi(a[0]);
++      global = pw_map_lookup(&rd->globals, id);
++      if (global == NULL) {
++              asprintf(error, "%s: unknown global %d", cmd, id);
++              return false;
++      }
++      if (global->type != PW_TYPE_INTERFACE_Endpoint) {
++              asprintf(error, "object %d is not an endpoint", atoi(a[0]));
++              return false;
++      }
++      if (global->proxy == NULL) {
++              if (!bind_global(rd, global, error))
++                      return false;
++      }
++
++      control_id = atoi(a[1]);
++
++      spa_pod_builder_init(&b, buffer, 1024);
++      spa_pod_builder_push_object (&b, &f,
++              PW_ENDPOINT_OBJECT_ParamControl, PW_ENDPOINT_PARAM_Control);
++      spa_pod_builder_add(&b,
++              PW_ENDPOINT_PARAM_CONTROL_id, SPA_POD_Int(control_id),
++              NULL);
++
++      switch (*a[2]) {
++      case 'b': {
++              bool val = atoi(a[3]);
++              spa_pod_builder_add(&b,
++                      PW_ENDPOINT_PARAM_CONTROL_value, SPA_POD_Bool(val),
++                      NULL);
++              break;
++      }
++      case 'i': {
++              int val = atoi(a[3]);
++              spa_pod_builder_add(&b,
++                      PW_ENDPOINT_PARAM_CONTROL_value, SPA_POD_Int(val),
++                      NULL);
++              break;
++      }
++      case 'l': {
++              int64_t val = strtoll(a[3], NULL, 10);
++              spa_pod_builder_add(&b,
++                      PW_ENDPOINT_PARAM_CONTROL_value, SPA_POD_Long(val),
++                      NULL);
++              break;
++      }
++      case 'd': {
++              double val = strtod(a[3], NULL);
++              spa_pod_builder_add(&b,
++                      PW_ENDPOINT_PARAM_CONTROL_value, SPA_POD_Double(val),
++                      NULL);
++              break;
++      }
++      default:
++              asprintf(error, "%s: unknown value type %s", cmd, a[2]);
++              return false;
++      }
++
++      param = spa_pod_builder_pop(&b, &f);
++
++      pw_endpoint_proxy_set_param((struct pw_endpoint_proxy *) global->proxy,
++              PW_ENDPOINT_PARAM_Control, 0, param);
++
++      return true;
++}
++
+ static bool parse(struct data *data, char *buf, size_t size, char **error)
+ {
+       char *a[2];
+-- 
+2.20.1
+
@@ -1,8 +1,10 @@
-From 4e1c70e9b4e8f3ece722f82d49b283a0c6ef0130 Mon Sep 17 00:00:00 2001
+From 2016605938f02835c75928648e99b25f7248aa5b Mon Sep 17 00:00:00 2001
 From: George Kiagiadakis <george.kiagiadakis@collabora.com>
 Date: Mon, 24 Jun 2019 12:19:20 +0300
 Subject: [PATCH] arm: build with -mno-unaligned-access
 
 From: George Kiagiadakis <george.kiagiadakis@collabora.com>
 Date: Mon, 24 Jun 2019 12:19:20 +0300
 Subject: [PATCH] arm: build with -mno-unaligned-access
 
+Upstream-Status: Inappropriate [workaround]
+See also https://github.com/PipeWire/pipewire/issues/161
 ---
  meson.build | 5 +++++
  1 file changed, 5 insertions(+)
 ---
  meson.build | 5 +++++
  1 file changed, 5 insertions(+)
diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0006-logger-print-timestamps-on-logged-messages.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0006-logger-print-timestamps-on-logged-messages.patch
new file mode 100644 (file)
index 0000000..4d9117f
--- /dev/null
@@ -0,0 +1,52 @@
+From 352c58357e5922b21d664c1f5a0b89a74f864f41 Mon Sep 17 00:00:00 2001
+From: George Kiagiadakis <george.kiagiadakis@collabora.com>
+Date: Wed, 3 Jul 2019 17:47:46 +0300
+Subject: [PATCH] logger: print timestamps on logged messages
+
+Timestamps have usec precision and the seconds are limited
+to 9 digits. Usually what matters in these messages is to spot
+delays between printouts and not really what is the absolute
+time of the system.
+
+Upstream-Status: Submitted [https://github.com/PipeWire/pipewire/pull/164]
+---
+ spa/plugins/support/logger.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/spa/plugins/support/logger.c b/spa/plugins/support/logger.c
+index 87ba3c21..2976601c 100644
+--- a/spa/plugins/support/logger.c
++++ b/spa/plugins/support/logger.c
+@@ -27,6 +27,7 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <stdio.h>
++#include <time.h>
+ #include <sys/eventfd.h>
+ #include <spa/support/log.h>
+@@ -70,6 +71,9 @@ impl_log_logv(struct spa_log *log,
+       const char *prefix = "", *suffix = "";
+       int size;
+       bool do_trace;
++      struct timespec now;
++
++      clock_gettime(CLOCK_MONOTONIC_RAW, &now);
+       if ((do_trace = (level == SPA_LOG_LEVEL_TRACE && impl->have_source)))
+               level++;
+@@ -86,8 +90,9 @@ impl_log_logv(struct spa_log *log,
+       }
+       vsnprintf(text, sizeof(text), fmt, args);
+-      size = snprintf(location, sizeof(location), "%s[%s][%s:%i %s()] %s%s\n",
+-              prefix, levels[level], strrchr(file, '/') + 1, line, func, text, suffix);
++      size = snprintf(location, sizeof(location), "%s[%s][%09lu.%06lu][%s:%i %s()] %s%s\n",
++              prefix, levels[level], now.tv_sec & 0x1FFFFFFF, now.tv_nsec / 1000,
++              strrchr(file, '/') + 1, line, func, text, suffix);
+       if (SPA_UNLIKELY(do_trace)) {
+               uint32_t index;
+-- 
+2.20.1
+
diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0007-alsa-make-corrections-on-the-timeout-based-on-how-fa.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0007-alsa-make-corrections-on-the-timeout-based-on-how-fa.patch
new file mode 100644 (file)
index 0000000..8649501
--- /dev/null
@@ -0,0 +1,130 @@
+From 05a3a926df4906cdf60f7978843c637bbf37714a Mon Sep 17 00:00:00 2001
+From: George Kiagiadakis <george.kiagiadakis@collabora.com>
+Date: Tue, 9 Jul 2019 18:06:18 +0300
+Subject: [PATCH] alsa: make corrections on the timeout based on how fast ALSA
+ consumes samples
+
+This feels a bit hacky, but it actually makes huge difference when pipewire is
+running in qemu.
+
+The idea is that it keeps track of how much samples are in the device
+(fill level) and calculates how many are consumed when a timeout occurs.
+Then it converts that into a time based on the sample rate and compares it to
+the system clock time that elapsed since the last write to the device.
+The division between the two gives a rate (drift) that can be used to shorten
+the timeout window.
+
+So for instance, if the timeout window was 21.3 ms, but the device actually
+consumed an equivalent of 28 ms in samples, the drift will be 21.3/28 = 0.76
+and the next timeout window will be approximately 21.3 * 0.76 = 16.1 ms
+
+To avoid making things worse, the drift is clamped between 0.6 and 1.0.
+Min 0.6 was arbitrarily chosen, but sometimes alsa does report strange numbers,
+causing the drift to be very low, which in turn causes an early wakeup.
+Max 1.0 basically means that we don't care if the device is consuming samples
+slower. In that case, the early wakeup mechanism will throttle pipewire.
+
+Fixes #163
+
+Upstream-Status: Submitted [https://github.com/PipeWire/pipewire/pull/166]
+---
+ spa/plugins/alsa/alsa-utils.c | 31 ++++++++++++++++++++++++++-----
+ spa/plugins/alsa/alsa-utils.h |  2 ++
+ 2 files changed, 28 insertions(+), 5 deletions(-)
+
+diff --git a/spa/plugins/alsa/alsa-utils.c b/spa/plugins/alsa/alsa-utils.c
+index 87582c1c..872969bf 100644
+--- a/spa/plugins/alsa/alsa-utils.c
++++ b/spa/plugins/alsa/alsa-utils.c
+@@ -593,7 +593,21 @@ static int get_status(struct state *state, snd_pcm_sframes_t *delay)
+ static int update_time(struct state *state, uint64_t nsec, snd_pcm_sframes_t delay, bool slave)
+ {
+-      double err, corr;
++      double err, corr, drift;
++      snd_pcm_sframes_t consumed;
++
++      consumed = state->fill_level - delay;
++      if (state->alsa_started && consumed > 0) {
++              double sysclk_diff = nsec - state->last_time;
++              double devclk_diff = ((double) consumed) * 1e9 / state->rate;
++              drift = sysclk_diff / devclk_diff;
++              drift = SPA_CLAMP(drift, 0.6, 1.0);
++
++              spa_log_trace_fp(state->log, "cons:%ld sclk:%f dclk:%f drift:%f",
++                      consumed, sysclk_diff, devclk_diff, drift);
++      } else {
++              drift = 1.0;
++      }
+       if (state->stream == SND_PCM_STREAM_PLAYBACK)
+               err = delay - state->last_threshold;
+@@ -650,11 +664,11 @@ static int update_time(struct state *state, uint64_t nsec, snd_pcm_sframes_t del
+               state->clock->rate_diff = corr;
+       }
+-      spa_log_trace_fp(state->log, "slave:%d %"PRIu64" %f %ld %f %f %d", slave, nsec,
+-                      corr, delay, err, state->threshold * corr,
++      spa_log_trace_fp(state->log, "slave:%d %"PRIu64" %f %ld %f %f %f %d", slave, nsec,
++                      corr, delay, err, state->threshold * corr, drift,
+                       state->threshold);
+-      state->next_time += state->threshold / corr * 1e9 / state->rate;
++      state->next_time += state->threshold / corr * drift * 1e9 / state->rate;
+       state->last_threshold = state->threshold;
+       return 0;
+@@ -783,6 +797,10 @@ again:
+               goto again;
+       state->sample_count += total_written;
++      state->fill_level += total_written;
++
++      clock_gettime(CLOCK_MONOTONIC, &state->now);
++      state->last_time = SPA_TIMESPEC_TO_NSEC (&state->now);
+       if (!state->alsa_started && total_written > 0) {
+               spa_log_trace(state->log, "snd_pcm_start %lu", written);
+@@ -935,7 +953,7 @@ static int handle_play(struct state *state, uint64_t nsec, snd_pcm_sframes_t del
+ {
+       int res;
+-      if (delay >= state->last_threshold * 2) {
++      if (delay > state->last_threshold * 2) {
+               spa_log_trace(state->log, "early wakeup %ld %d", delay, state->threshold);
+               state->next_time = nsec + (delay - state->last_threshold) * SPA_NSEC_PER_SEC / state->rate;
+               return -EAGAIN;
+@@ -944,6 +962,8 @@ static int handle_play(struct state *state, uint64_t nsec, snd_pcm_sframes_t del
+       if ((res = update_time(state, nsec, delay, false)) < 0)
+               return res;
++      state->fill_level = delay;
++
+       if (spa_list_is_empty(&state->ready)) {
+               struct spa_io_buffers *io = state->io;
+@@ -1072,6 +1092,7 @@ int spa_alsa_start(struct state *state)
+       state->slaved = is_slaved(state);
+       state->last_threshold = state->threshold;
++      state->fill_level = 0;
+       init_loop(state);
+       state->safety = 0.0;
+diff --git a/spa/plugins/alsa/alsa-utils.h b/spa/plugins/alsa/alsa-utils.h
+index a862873f..b53890b5 100644
+--- a/spa/plugins/alsa/alsa-utils.h
++++ b/spa/plugins/alsa/alsa-utils.h
+@@ -134,7 +134,9 @@ struct state {
+       int64_t sample_time;
+       uint64_t next_time;
+       uint64_t base_time;
++      uint64_t last_time;
++      snd_pcm_uframes_t fill_level;
+       uint64_t underrun;
+       double safety;
+-- 
+2.20.1
+
diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0008-audio-dsp-allow-mode-to-be-set-with-a-property.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0008-audio-dsp-allow-mode-to-be-set-with-a-property.patch
new file mode 100644 (file)
index 0000000..681bae6
--- /dev/null
@@ -0,0 +1,45 @@
+From 0c85e1110e32720785f861c7a85cf0636394eee4 Mon Sep 17 00:00:00 2001
+From: Julian Bouzas <julian.bouzas@collabora.com>
+Date: Thu, 27 Jun 2019 12:44:39 -0400
+Subject: [PATCH] audio-dsp: allow mode to be set with a property
+
+Upstream-Status: Submitted [https://github.com/PipeWire/pipewire/pull/167]
+---
+ src/modules/module-audio-dsp/audio-dsp.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/modules/module-audio-dsp/audio-dsp.c b/src/modules/module-audio-dsp/audio-dsp.c
+index be8a7592..68249307 100644
+--- a/src/modules/module-audio-dsp/audio-dsp.c
++++ b/src/modules/module-audio-dsp/audio-dsp.c
+@@ -264,7 +264,7 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core,
+ {
+       struct pw_node *node;
+       struct node *n;
+-      const char *api, *alias, *str, *factory;
++      const char *api, *alias, *str, *factory, *mode;
+       char node_name[128];
+       struct pw_properties *pr;
+       int i;
+@@ -279,6 +279,7 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core,
+               pw_log_error("missing audio-dsp.name property");
+               goto error;
+       }
++      mode = pw_properties_get(pr, "audio-dsp.mode");
+       snprintf(node_name, sizeof(node_name), "system_%s", alias);
+       for (i = 0; node_name[i]; i++) {
+@@ -296,7 +297,9 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core,
+       if ((str = pw_properties_get(pr, "node.id")) != NULL)
+               pw_properties_set(pr, "node.session", str);
+-      if (direction == PW_DIRECTION_OUTPUT) {
++      if (mode) {
++              factory = mode;
++      } else if (direction == PW_DIRECTION_OUTPUT) {
+               pw_properties_set(pr, "merger.monitor", "1");
+               factory = "merge";
+       } else {
+-- 
+2.20.1
+
diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0009-audioconvert-do-setup-internal-links-and-buffers-als.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0009-audioconvert-do-setup-internal-links-and-buffers-als.patch
new file mode 100644 (file)
index 0000000..87141e9
--- /dev/null
@@ -0,0 +1,55 @@
+From ddcda9fa6ec49168c5ddd9fbeda748c5fad18fce Mon Sep 17 00:00:00 2001
+From: George Kiagiadakis <george.kiagiadakis@collabora.com>
+Date: Wed, 10 Jul 2019 14:53:15 +0300
+Subject: [PATCH] audioconvert: do setup internal links and buffers also in
+ convert mode
+
+Upstream-Status: Submitted [https://github.com/PipeWire/pipewire/pull/167]
+---
+ spa/plugins/audioconvert/audioconvert.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c
+index fa8dec97..0af0732d 100644
+--- a/spa/plugins/audioconvert/audioconvert.c
++++ b/spa/plugins/audioconvert/audioconvert.c
+@@ -79,6 +79,8 @@ struct impl {
+ #define MODE_MERGE    1
+ #define MODE_CONVERT  2
+       int mode;
++      bool fmt_is_set[2];
++      bool buffers_set[2];
+       bool started;
+       struct spa_handle *hnd_fmt[2];
+@@ -791,11 +793,11 @@ impl_node_port_set_param(struct spa_node *node,
+       if (id == SPA_PARAM_Format) {
+               if (param == NULL)
+                       clean_convert(this);
+-              else if ((direction == SPA_DIRECTION_OUTPUT && this->mode == MODE_MERGE) ||
+-                  (direction == SPA_DIRECTION_INPUT && this->mode == MODE_SPLIT)) {
++              else if (this->fmt_is_set[SPA_DIRECTION_REVERSE(direction)]) {
+                       if ((res = setup_convert(this)) < 0)
+                               return res;
+               }
++              this->fmt_is_set[direction] = (param != NULL);
+       }
+       return res;
+ }
+@@ -824,11 +826,11 @@ impl_node_port_use_buffers(struct spa_node *node,
+                                       direction, port_id, buffers, n_buffers)) < 0)
+               return res;
+-      if ((direction == SPA_DIRECTION_OUTPUT && this->mode == MODE_MERGE) ||
+-          (direction == SPA_DIRECTION_INPUT && this->mode == MODE_SPLIT)) {
++      if (buffers && this->buffers_set[SPA_DIRECTION_REVERSE(direction)]) {
+               if ((res = setup_buffers(this, SPA_DIRECTION_INPUT)) < 0)
+                       return res;
+       }
++      this->buffers_set[direction] = (buffers != NULL);
+       return res;
+ }
+-- 
+2.20.1
+
index a968004..dd1eebc 100644 (file)
@@ -2,9 +2,14 @@ require pipewire.inc
 
 SRC_URI = "gitsm://github.com/PipeWire/pipewire;protocol=https;branch=work \
     file://0001-spa-include-install-missing-headers.patch \
 
 SRC_URI = "gitsm://github.com/PipeWire/pipewire;protocol=https;branch=work \
     file://0001-spa-include-install-missing-headers.patch \
-    file://0001-extensions-implement-Endpoint-ClientEndpoint-interfa.patch \
-    file://0002-pipewire-cli-add-support-for-printing-endpoint-info-.patch \
-    file://0004-arm-build-with-mno-unaligned-access.patch \
+    file://0002-extensions-implement-Endpoint-ClientEndpoint-interfa.patch \
+    file://0003-pipewire-cli-add-support-for-printing-endpoint-info-.patch \
+    file://0004-pipewire-cli-add-command-to-modify-endpoint-control-.patch \
+    file://0005-arm-build-with-mno-unaligned-access.patch \
+    file://0006-logger-print-timestamps-on-logged-messages.patch \
+    file://0007-alsa-make-corrections-on-the-timeout-based-on-how-fa.patch \
+    file://0008-audio-dsp-allow-mode-to-be-set-with-a-property.patch \
+    file://0009-audioconvert-do-setup-internal-links-and-buffers-als.patch \
     "
 
 SRCREV = "4be788962e60891237f1f018627bf709ae3981e6"
     "
 
 SRCREV = "4be788962e60891237f1f018627bf709ae3981e6"