From 0ad9464b54c2d981399a24889f85d1f252726e8c Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Wed, 19 Jun 2019 12:19:36 +0300
Subject: [PATCH] softdsp-endpoint: workaround pipewire bug

spa audioconvert (the backend of audio-dsp) does not adevertise
property changes, therefore subscribe_params() is useless.
In order to get the real value from the node we need to call
enum_params() manually.

https://github.com/PipeWire/pipewire/issues/157
---
 modules/module-pw-audio-softdsp-endpoint.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/module-pw-audio-softdsp-endpoint.c b/modules/module-pw-audio-softdsp-endpoint.c
index 94652e3d..481c3c4b 100644
--- a/modules/module-pw-audio-softdsp-endpoint.c
+++ b/modules/module-pw-audio-softdsp-endpoint.c
@@ -232,7 +232,6 @@ emit_audio_dsp_node (WpPwAudioSoftdspEndpoint *self)
   uint8_t buf[1024];
   struct spa_pod_builder pod_builder = { 0, };
   struct spa_pod *param;
-  uint32_t ids[1] = { SPA_PARAM_Props };
   const struct pw_node_info *node_info;
   const struct spa_audio_info_raw *port_format;
   struct spa_audio_info_raw format;
@@ -269,7 +268,7 @@ emit_audio_dsp_node (WpPwAudioSoftdspEndpoint *self)
       PW_TYPE_INTERFACE_Node, PW_VERSION_NODE, &props->dict, 0);
   pw_node_proxy_add_listener(self->dsp_proxy, &self->dsp_listener,
       &dsp_node_events, self);
-  pw_node_proxy_subscribe_params (self->dsp_proxy, ids, SPA_N_ELEMENTS (ids));
+  pw_node_proxy_enum_params (self->dsp_proxy, 0, SPA_PARAM_Props, 0, -1, NULL);
 
   /* Set DSP proxy params */
   spa_pod_builder_init(&pod_builder, buf, sizeof(buf));
@@ -448,6 +447,8 @@ endpoint_set_control_value (WpEndpoint * ep, guint32 control_id,
               SPA_TYPE_OBJECT_Props, SPA_PARAM_Props,
               SPA_PROP_volume, SPA_POD_Float(volume),
               NULL));
+      pw_node_proxy_enum_params (self->dsp_proxy, 0, SPA_PARAM_Props, 0, -1,
+          NULL);
       break;
 
     case CONTROL_MUTE:
@@ -462,6 +463,8 @@ endpoint_set_control_value (WpEndpoint * ep, guint32 control_id,
               SPA_TYPE_OBJECT_Props, SPA_PARAM_Props,
               SPA_PROP_mute, SPA_POD_Bool(mute),
               NULL));
+      pw_node_proxy_enum_params (self->dsp_proxy, 0, SPA_PARAM_Props, 0, -1,
+          NULL);
       break;
 
     case CONTROL_SELECTED:
-- 
GitLab