mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
pulse: don't try to do set_param when not writable
This commit is contained in:
parent
cbc579825c
commit
ac97175380
3 changed files with 16 additions and 0 deletions
|
|
@ -1214,6 +1214,7 @@ static void registry_event_global(void *data, uint32_t id,
|
|||
pw_log_debug("context %p: global %d %s %p", c, id, type, g);
|
||||
g->context = c;
|
||||
g->id = id;
|
||||
g->permissions = permissions;
|
||||
g->type = strdup(type);
|
||||
g->init = true;
|
||||
g->props = props ? pw_properties_new_dict(props) : NULL;
|
||||
|
|
|
|||
|
|
@ -243,6 +243,7 @@ struct global_info {
|
|||
struct global {
|
||||
struct spa_list link;
|
||||
uint32_t id;
|
||||
uint32_t permissions;
|
||||
char *type;
|
||||
struct pw_properties *props;
|
||||
|
||||
|
|
|
|||
|
|
@ -372,6 +372,9 @@ static int set_node_volume(pa_context *c, struct global *g, const pa_cvolume *vo
|
|||
}
|
||||
g->node_info.mute = mute;
|
||||
|
||||
if (!SPA_FLAG_IS_SET(g->permissions, PW_PERM_W | PW_PERM_X))
|
||||
return PA_ERR_ACCESS;
|
||||
|
||||
pw_node_set_param((struct pw_node*)g->proxy,
|
||||
SPA_PARAM_Props, 0,
|
||||
spa_pod_builder_add_object(&b,
|
||||
|
|
@ -416,6 +419,9 @@ static int set_device_volume(pa_context *c, struct global *g, struct global *cg,
|
|||
}
|
||||
g->node_info.mute = mute;
|
||||
|
||||
if (!SPA_FLAG_IS_SET(cg->permissions, PW_PERM_W | PW_PERM_X))
|
||||
return PA_ERR_ACCESS;
|
||||
|
||||
spa_pod_builder_push_object(&b, &f[0],
|
||||
SPA_TYPE_OBJECT_ParamRoute, SPA_PARAM_Route);
|
||||
spa_pod_builder_add(&b,
|
||||
|
|
@ -696,6 +702,9 @@ static int set_device_route(pa_context *c, struct global *g, const char *port, e
|
|||
if (id == SPA_ID_INVALID)
|
||||
return PA_ERR_NOENTITY;
|
||||
|
||||
if (!SPA_FLAG_IS_SET(cg->permissions, PW_PERM_W | PW_PERM_X))
|
||||
return PA_ERR_ACCESS;
|
||||
|
||||
pw_device_set_param((struct pw_device*)cg->proxy,
|
||||
SPA_PARAM_Route, 0,
|
||||
spa_pod_builder_add_object(&b,
|
||||
|
|
@ -1753,6 +1762,11 @@ static void card_profile(pa_operation *o, void *userdata)
|
|||
if (id == SPA_ID_INVALID)
|
||||
goto done;;
|
||||
|
||||
if (!SPA_FLAG_IS_SET(g->permissions, PW_PERM_W | PW_PERM_X)) {
|
||||
pa_context_set_error(c, PA_ERR_ACCESS);
|
||||
goto done;
|
||||
}
|
||||
|
||||
pw_device_set_param((struct pw_device*)g->proxy,
|
||||
SPA_PARAM_Profile, 0,
|
||||
spa_pod_builder_add_object(&b,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue