pulse: mark the global changed when volume/mute changed

When we change the volume/mute of a sink/source, mark the source
as changed so that when we get the update from the server we
emit a CHANGE event. We don't do this otherwise because the server
volume update and our local volume is the same.

Fixes #298
This commit is contained in:
Wim Taymans 2020-10-22 13:18:09 +02:00
parent 55b4042512
commit 4450ddadcf

View file

@ -363,10 +363,12 @@ static int set_node_volume(pa_context *c, struct global *g, const pa_cvolume *vo
return 0; return 0;
} }
g->node_info.mute = mute; g->node_info.mute = mute;
g->changed++;
if (!SPA_FLAG_IS_SET(g->permissions, PW_PERM_W | PW_PERM_X)) if (!SPA_FLAG_IS_SET(g->permissions, PW_PERM_W | PW_PERM_X))
return PA_ERR_ACCESS; return PA_ERR_ACCESS;
pw_log_debug("node %p: id:%u", g, g->id);
pw_node_set_param((struct pw_node*)g->proxy, pw_node_set_param((struct pw_node*)g->proxy,
SPA_PARAM_Props, 0, SPA_PARAM_Props, 0,
spa_pod_builder_add_object(&b, spa_pod_builder_add_object(&b,
@ -410,6 +412,7 @@ static int set_device_volume(pa_context *c, struct global *g, struct global *cg,
return 0; return 0;
} }
g->node_info.mute = mute; g->node_info.mute = mute;
g->changed++;
if (!SPA_FLAG_IS_SET(cg->permissions, PW_PERM_W | PW_PERM_X)) if (!SPA_FLAG_IS_SET(cg->permissions, PW_PERM_W | PW_PERM_X))
return PA_ERR_ACCESS; return PA_ERR_ACCESS;
@ -430,6 +433,7 @@ static int set_device_volume(pa_context *c, struct global *g, struct global *cg,
vols)); vols));
param = spa_pod_builder_pop(&b, &f[0]); param = spa_pod_builder_pop(&b, &f[0]);
pw_log_debug("device %p: id:%u", cg, cg->id);
pw_device_set_param((struct pw_node*)cg->proxy, pw_device_set_param((struct pw_node*)cg->proxy,
SPA_PARAM_Route, 0, param); SPA_PARAM_Route, 0, param);
@ -446,7 +450,7 @@ static int set_volume(pa_context *c, struct global *g, const pa_cvolume *volume,
card_id = g->node_info.device_id; card_id = g->node_info.device_id;
device_id = g->node_info.profile_device_id; device_id = g->node_info.profile_device_id;
pw_log_info("card:%u global:%u flags:%08x", card_id, g->id, g->node_info.flags); pw_log_debug("card:%u global:%u flags:%08x", card_id, g->id, g->node_info.flags);
if (SPA_FLAG_IS_SET(g->node_info.flags, NODE_FLAG_DEVICE_VOLUME | NODE_FLAG_DEVICE_MUTE) && if (SPA_FLAG_IS_SET(g->node_info.flags, NODE_FLAG_DEVICE_VOLUME | NODE_FLAG_DEVICE_MUTE) &&
(cg = pa_context_find_global(c, card_id)) != NULL) { (cg = pa_context_find_global(c, card_id)) != NULL) {