Rework profile/route handling

Add save property to Profile and Route params to notify the session
manager that they should be saved. Let the session manager only save
the Profile and Routes with the save flag.
Make pulse-server set the save flag on Profile and Route changes.
The result is that we can make a difference between user requested
changes and automatical changes and only remember the user preferences.
When a port changes availability, first check if we need to perform
a profile switch, if not select the new best port.
This commit is contained in:
Wim Taymans 2021-02-22 16:42:29 +01:00
parent 5ae92fd643
commit 8414092763
9 changed files with 176 additions and 105 deletions

View file

@ -2949,6 +2949,8 @@ static int set_card_volume_mute_delay(struct pw_manager_object *o, uint32_t id,
spa_pod_builder_add(&b,
SPA_PROP_latencyOffsetNsec, SPA_POD_Long(*latency_offset), 0);
spa_pod_builder_pop(&b, &f[1]);
spa_pod_builder_prop(&b, SPA_PARAM_ROUTE_save, 0);
spa_pod_builder_bool(&b, true);
param = spa_pod_builder_pop(&b, &f[0]);
pw_device_set_param((struct pw_device*)o->proxy,
@ -2970,7 +2972,8 @@ static int set_card_port(struct pw_manager_object *o, uint32_t device_id,
spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamRoute, SPA_PARAM_Route,
SPA_PARAM_ROUTE_index, SPA_POD_Int(port_id),
SPA_PARAM_ROUTE_device, SPA_POD_Int(device_id)));
SPA_PARAM_ROUTE_device, SPA_POD_Int(device_id),
SPA_PARAM_ROUTE_save, SPA_POD_Bool(true)));
return 0;
}
@ -4693,7 +4696,8 @@ static int do_set_profile(struct client *client, uint32_t command, uint32_t tag,
SPA_PARAM_Profile, 0,
spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamProfile, SPA_PARAM_Profile,
SPA_PARAM_PROFILE_index, SPA_POD_Int(profile_id)));
SPA_PARAM_PROFILE_index, SPA_POD_Int(profile_id),
SPA_PARAM_PROFILE_save, SPA_POD_Bool(true)));
return reply_simple_ack(client, tag);
}