summaryrefslogtreecommitdiff
path: root/pipewire-pulseaudio
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2020-08-18 17:56:05 +0200
committerWim Taymans <wtaymans@redhat.com>2020-08-18 17:56:05 +0200
commit0c04481ba71ad397c5e164b5f717b3d77eb7c55f (patch)
tree3b39a7c9bd5802855df3baab58d8684ad3c618f3 /pipewire-pulseaudio
parent759e1ccb6b2f5a7c52cf3ccc329a59f093f794bd (diff)
metadata: improve default sink/source
Only check defaults when subject is PW_ID_CORE Handle NULL keys: remove the defaults
Diffstat (limited to 'pipewire-pulseaudio')
-rw-r--r--pipewire-pulseaudio/src/context.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/pipewire-pulseaudio/src/context.c b/pipewire-pulseaudio/src/context.c
index 23c7124d..c4c050b1 100644
--- a/pipewire-pulseaudio/src/context.c
+++ b/pipewire-pulseaudio/src/context.c
@@ -1013,14 +1013,16 @@ static int metadata_property(void *object,
uint32_t val;
bool changed = false;
- if (key && strcmp(key, METADATA_DEFAULT_SINK) == 0) {
- val = value ? (uint32_t)atoi(value) : SPA_ID_INVALID;
- changed = c->default_sink != val;
- c->default_sink = val;
- } else if (key && strcmp(key, METADATA_DEFAULT_SOURCE) == 0) {
- val = value ? (uint32_t)atoi(value) : SPA_ID_INVALID;
- changed = c->default_source != val;
- c->default_source = val;
+ if (subject == PW_ID_CORE) {
+ val = (key && value) ? (uint32_t)atoi(value) : SPA_ID_INVALID;
+ if (key == NULL || strcmp(key, METADATA_DEFAULT_SINK) == 0) {
+ changed = c->default_sink != val;
+ c->default_sink = val;
+ }
+ if (key == NULL || strcmp(key, METADATA_DEFAULT_SOURCE) == 0) {
+ changed = c->default_source != val;
+ c->default_source = val;
+ }
}
if (changed)
emit_event(global->context, global, PA_SUBSCRIPTION_EVENT_CHANGE);