summaryrefslogtreecommitdiff
path: root/pipewire-pulseaudio
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2020-07-31 13:57:19 +0200
committerWim Taymans <wtaymans@redhat.com>2020-07-31 13:57:19 +0200
commitf2313920930a264bb4ac46da574b4c57dfd831e1 (patch)
treeb14bf3af2321a0cedc5c1c96dba5812f1d3100ed /pipewire-pulseaudio
parent47ce3746366060dd5e410de9558ee1d1582ea52c (diff)
pulse: improve param enumeration
Use user data field in param to check for changes and only perform a clear+enum when it changed.
Diffstat (limited to 'pipewire-pulseaudio')
-rw-r--r--pipewire-pulseaudio/src/context.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/pipewire-pulseaudio/src/context.c b/pipewire-pulseaudio/src/context.c
index c6235630..4e646455 100644
--- a/pipewire-pulseaudio/src/context.c
+++ b/pipewire-pulseaudio/src/context.c
@@ -348,39 +348,48 @@ static void device_event_info(void *object, const struct pw_device_info *info)
}
if (info->change_mask & PW_DEVICE_CHANGE_MASK_PARAMS) {
for (n = 0; n < info->n_params; n++) {
- if (!(info->params[n].flags & SPA_PARAM_INFO_READ))
+ uint32_t id = info->params[n].id;
+ bool do_enum = true;
+
+ if (info->params[n].user == 0)
continue;
- switch (info->params[n].id) {
+ info->params[n].user = 0;
+
+ switch (id) {
case SPA_PARAM_EnumProfile:
if (g->card_info.pending_profiles)
continue;
- remove_params(&g->card_info.profiles, SPA_PARAM_EnumProfile);
+ remove_params(&g->card_info.profiles, id);
g->card_info.n_profiles = 0;
- g->card_info.pending_profiles = true;
- pw_device_enum_params((struct pw_device*)g->proxy,
- 0, SPA_PARAM_EnumProfile, 0, -1, NULL);
- break;
- case SPA_PARAM_Profile:
- pw_device_enum_params((struct pw_device*)g->proxy,
- 0, SPA_PARAM_Profile, 0, -1, NULL);
break;
case SPA_PARAM_EnumRoute:
if (g->card_info.pending_ports)
continue;
- remove_params(&g->card_info.ports, SPA_PARAM_EnumRoute);
+ remove_params(&g->card_info.ports, id);
g->card_info.n_ports = 0;
- g->card_info.pending_ports = true;
- pw_device_enum_params((struct pw_device*)g->proxy,
- 0, SPA_PARAM_EnumRoute, 0, -1, NULL);
break;
case SPA_PARAM_Route:
- pw_device_enum_params((struct pw_device*)g->proxy,
- 0, SPA_PARAM_Route, 0, -1, NULL);
+ case SPA_PARAM_Profile:
break;
default:
+ do_enum = false;
break;
}
+ if (!(info->params[n].flags & SPA_PARAM_INFO_READ))
+ continue;
+ if (do_enum) {
+ switch (id) {
+ case SPA_PARAM_EnumProfile:
+ g->card_info.pending_profiles = true;
+ break;
+ case SPA_PARAM_EnumRoute:
+ g->card_info.pending_ports = true;
+ break;
+ }
+ pw_device_enum_params((struct pw_device*)g->proxy,
+ 0, id, 0, -1, NULL);
+ }
}
}
global_sync(g);
@@ -817,6 +826,10 @@ static void node_event_info(void *object, const struct pw_node_info *info)
if (info->change_mask & PW_NODE_CHANGE_MASK_PARAMS) {
for (i = 0; i < info->n_params; i++) {
+ if (info->params[i].user == 0)
+ continue;
+ info->params[i].user = 0;
+
if (!(info->params[i].flags & SPA_PARAM_INFO_READ))
continue;