mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	context: only go to READY after registry is loaded
This way we can lookup the node name when connecting a stream. See !314
This commit is contained in:
		
							parent
							
								
									cced538901
								
							
						
					
					
						commit
						520c2a0e16
					
				
					 1 changed files with 15 additions and 3 deletions
				
			
		| 
						 | 
					@ -1541,9 +1541,6 @@ static void core_info(void *data, const struct pw_core_info *info)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	c->core_info = pw_core_info_update(c->core_info, info);
 | 
						c->core_info = pw_core_info_update(c->core_info, info);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (first)
 | 
					 | 
				
			||||||
		pa_context_set_state(c, PA_CONTEXT_READY);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void core_error(void *data, uint32_t id, int seq, int res, const char *message)
 | 
					static void core_error(void *data, uint32_t id, int seq, int res, const char *message)
 | 
				
			||||||
| 
						 | 
					@ -1842,10 +1839,19 @@ pa_context_state_t pa_context_get_state(PA_CONST pa_context *c)
 | 
				
			||||||
	return c->state;
 | 
						return c->state;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void on_connected(pa_operation *o, void *userdata)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						pa_context *c = o->context;
 | 
				
			||||||
 | 
						pw_log_debug("context %p: connected", c);
 | 
				
			||||||
 | 
						pa_context_set_state(c, PA_CONTEXT_READY);
 | 
				
			||||||
 | 
						pa_operation_done(o);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
int pa_context_connect(pa_context *c, const char *server, pa_context_flags_t flags, const pa_spawn_api *api)
 | 
					int pa_context_connect(pa_context *c, const char *server, pa_context_flags_t flags, const pa_spawn_api *api)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int res = 0;
 | 
						int res = 0;
 | 
				
			||||||
 | 
						pa_operation *o;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pa_assert(c);
 | 
						pa_assert(c);
 | 
				
			||||||
	pa_assert(c->refcount >= 1);
 | 
						pa_assert(c->refcount >= 1);
 | 
				
			||||||
| 
						 | 
					@ -1877,6 +1883,10 @@ int pa_context_connect(pa_context *c, const char *server, pa_context_flags_t fla
 | 
				
			||||||
			&c->registry_listener,
 | 
								&c->registry_listener,
 | 
				
			||||||
			®istry_events, c);
 | 
								®istry_events, c);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						o = pa_operation_new(c, NULL, on_connected, sizeof(struct success_data));
 | 
				
			||||||
 | 
						pa_operation_sync(o);
 | 
				
			||||||
 | 
						pa_operation_unref(o);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exit:
 | 
					exit:
 | 
				
			||||||
	pa_context_unref(c);
 | 
						pa_context_unref(c);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1889,6 +1899,8 @@ void pa_context_disconnect(pa_context *c)
 | 
				
			||||||
	pa_assert(c);
 | 
						pa_assert(c);
 | 
				
			||||||
	pa_assert(c->refcount >= 1);
 | 
						pa_assert(c->refcount >= 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_log_debug("%p", c);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	c->disconnect = true;
 | 
						c->disconnect = true;
 | 
				
			||||||
	if (c->registry) {
 | 
						if (c->registry) {
 | 
				
			||||||
		pw_proxy_destroy((struct pw_proxy*)c->registry);
 | 
							pw_proxy_destroy((struct pw_proxy*)c->registry);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue