mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	
							parent
							
								
									adee9931b6
								
							
						
					
					
						commit
						dd9fd95c75
					
				
					 1 changed files with 4 additions and 5 deletions
				
			
		| 
						 | 
					@ -593,13 +593,13 @@ static struct pw_global *find_global(struct pw_context *context, uint32_t id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static uint32_t next_global_id(struct pw_context *context)
 | 
					static uint32_t next_global_id(struct pw_context *context)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uint32_t id, start = context->serial;
 | 
						uint32_t id, retry = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (true) {
 | 
						while (true) {
 | 
				
			||||||
		id = context->serial;
 | 
							id = context->serial++ & 0xffffff;
 | 
				
			||||||
		context->serial = (context->serial+1) & 0xffffff;
 | 
					 | 
				
			||||||
		if (find_global(context, id) == NULL)
 | 
							if (find_global(context, id) == NULL)
 | 
				
			||||||
			return id;
 | 
								return id;
 | 
				
			||||||
		if (context->serial == start)
 | 
							if (retry++ > 4096)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return SPA_ID_INVALID;
 | 
						return SPA_ID_INVALID;
 | 
				
			||||||
| 
						 | 
					@ -609,7 +609,6 @@ uint32_t pw_context_add_global(struct pw_context *context, struct pw_global *glo
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	global->id = next_global_id(context);
 | 
						global->id = next_global_id(context);
 | 
				
			||||||
	spa_list_append(&context->global_list, &global->link);
 | 
						spa_list_append(&context->global_list, &global->link);
 | 
				
			||||||
	return global->id;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void pw_context_remove_global(struct pw_context *context, struct pw_global *global)
 | 
					void pw_context_remove_global(struct pw_context *context, struct pw_global *global)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue