mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	media-session: reevaluate current profile only for its own routes
Only check the current active profile when some routes changed that are part of the profile. If some other route changed, just ignore it. Fixes #1403
This commit is contained in:
		
							parent
							
								
									de394866e3
								
							
						
					
					
						commit
						afb7090ba0
					
				
					 1 changed files with 9 additions and 4 deletions
				
			
		| 
						 | 
					@ -155,6 +155,7 @@ struct route {
 | 
				
			||||||
	uint32_t priority;
 | 
						uint32_t priority;
 | 
				
			||||||
	enum spa_param_availability available;
 | 
						enum spa_param_availability available;
 | 
				
			||||||
	struct spa_pod *props;
 | 
						struct spa_pod *props;
 | 
				
			||||||
 | 
						struct spa_pod *profiles;
 | 
				
			||||||
	bool save;
 | 
						bool save;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -231,7 +232,8 @@ static int parse_enum_route(struct sm_param *p, uint32_t device_id, struct route
 | 
				
			||||||
			SPA_PARAM_ROUTE_name, SPA_POD_String(&r->name),
 | 
								SPA_PARAM_ROUTE_name, SPA_POD_String(&r->name),
 | 
				
			||||||
			SPA_PARAM_ROUTE_priority,  SPA_POD_OPT_Int(&r->priority),
 | 
								SPA_PARAM_ROUTE_priority,  SPA_POD_OPT_Int(&r->priority),
 | 
				
			||||||
			SPA_PARAM_ROUTE_available,  SPA_POD_OPT_Id(&r->available),
 | 
								SPA_PARAM_ROUTE_available,  SPA_POD_OPT_Id(&r->available),
 | 
				
			||||||
			SPA_PARAM_ROUTE_devices, SPA_POD_OPT_Pod(&devices))) < 0)
 | 
								SPA_PARAM_ROUTE_devices, SPA_POD_OPT_Pod(&devices),
 | 
				
			||||||
 | 
								SPA_PARAM_ROUTE_profiles, SPA_POD_OPT_Pod(&r->profiles))) < 0)
 | 
				
			||||||
		return res;
 | 
							return res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (device_id != SPA_ID_INVALID && !array_contains(devices, device_id))
 | 
						if (device_id != SPA_ID_INVALID && !array_contains(devices, device_id))
 | 
				
			||||||
| 
						 | 
					@ -764,11 +766,13 @@ static int handle_device(struct device *dev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct profile pr;
 | 
						struct profile pr;
 | 
				
			||||||
	struct sm_param *p;
 | 
						struct sm_param *p;
 | 
				
			||||||
	int res;
 | 
					 | 
				
			||||||
	bool route_changed = false;
 | 
						bool route_changed = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dev->generation++;
 | 
						dev->generation++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (find_current_profile(dev, &pr) < 0)
 | 
				
			||||||
 | 
							pr.index = SPA_ID_INVALID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* first look at all routes and update */
 | 
						/* first look at all routes and update */
 | 
				
			||||||
	spa_list_for_each(p, &dev->obj->param_list, link) {
 | 
						spa_list_for_each(p, &dev->obj->param_list, link) {
 | 
				
			||||||
		struct route r;
 | 
							struct route r;
 | 
				
			||||||
| 
						 | 
					@ -786,6 +790,7 @@ static int handle_device(struct device *dev)
 | 
				
			||||||
			pw_log_info("device %d: route %s available changed %d -> %d",
 | 
								pw_log_info("device %d: route %s available changed %d -> %d",
 | 
				
			||||||
					dev->id, r.name, ri->available, r.available);
 | 
										dev->id, r.name, ri->available, r.available);
 | 
				
			||||||
			ri->available = r.available;
 | 
								ri->available = r.available;
 | 
				
			||||||
 | 
								if (array_contains(r.profiles, pr.index))
 | 
				
			||||||
				route_changed = true;
 | 
									route_changed = true;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		ri->generation = dev->generation;
 | 
							ri->generation = dev->generation;
 | 
				
			||||||
| 
						 | 
					@ -804,7 +809,7 @@ static int handle_device(struct device *dev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	prune_route_info(dev);
 | 
						prune_route_info(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = find_current_profile(dev, &pr)) >= 0) {
 | 
						if (pr.index != SPA_ID_INVALID) {
 | 
				
			||||||
		bool restore = dev->active_profile != pr.index;
 | 
							bool restore = dev->active_profile != pr.index;
 | 
				
			||||||
		if (restore || route_changed)
 | 
							if (restore || route_changed)
 | 
				
			||||||
			reconfigure_profile(dev, &pr, restore);
 | 
								reconfigure_profile(dev, &pr, restore);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue