mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse: improve debug of events
This commit is contained in:
		
							parent
							
								
									c20100eabb
								
							
						
					
					
						commit
						4346cad322
					
				
					 2 changed files with 49 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -177,18 +177,59 @@ struct global *pa_context_find_linked(pa_context *c, uint32_t idx)
 | 
			
		|||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const char *str_etype(pa_subscription_event_type_t event)
 | 
			
		||||
{
 | 
			
		||||
	switch (event & PA_SUBSCRIPTION_EVENT_TYPE_MASK) {
 | 
			
		||||
	case PA_SUBSCRIPTION_EVENT_NEW:
 | 
			
		||||
		return "new";
 | 
			
		||||
	case PA_SUBSCRIPTION_EVENT_CHANGE:
 | 
			
		||||
		return "change";
 | 
			
		||||
	case PA_SUBSCRIPTION_EVENT_REMOVE:
 | 
			
		||||
		return "remove";
 | 
			
		||||
	}
 | 
			
		||||
	return "invalid";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const char *str_efac(pa_subscription_event_type_t event)
 | 
			
		||||
{
 | 
			
		||||
	switch (event & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) {
 | 
			
		||||
	case PA_SUBSCRIPTION_EVENT_SINK:
 | 
			
		||||
		return "sink";
 | 
			
		||||
	case PA_SUBSCRIPTION_EVENT_SOURCE:
 | 
			
		||||
		return "source";
 | 
			
		||||
	case PA_SUBSCRIPTION_EVENT_SINK_INPUT:
 | 
			
		||||
		return "sink-input";
 | 
			
		||||
	case PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT:
 | 
			
		||||
		return "source-output";
 | 
			
		||||
	case PA_SUBSCRIPTION_EVENT_MODULE:
 | 
			
		||||
		return "module";
 | 
			
		||||
	case PA_SUBSCRIPTION_EVENT_CLIENT:
 | 
			
		||||
		return "client";
 | 
			
		||||
	case PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE:
 | 
			
		||||
		return "sample-cache";
 | 
			
		||||
	case PA_SUBSCRIPTION_EVENT_SERVER:
 | 
			
		||||
		return "server";
 | 
			
		||||
	case PA_SUBSCRIPTION_EVENT_AUTOLOAD:
 | 
			
		||||
		return "autoload";
 | 
			
		||||
	case PA_SUBSCRIPTION_EVENT_CARD:
 | 
			
		||||
		return "card";
 | 
			
		||||
	}
 | 
			
		||||
	return "invalid";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void emit_event(pa_context *c, struct global *g, pa_subscription_event_type_t event)
 | 
			
		||||
{
 | 
			
		||||
	if (c->subscribe_callback && (c->subscribe_mask & g->mask)) {
 | 
			
		||||
		pw_log_debug("context %p: obj %d: emit %d:%d", c, g->id, event, g->event);
 | 
			
		||||
		pw_log_debug("context %p: obj %d: emit %s:%s", c, g->id,
 | 
			
		||||
				str_etype(event), str_efac(g->event));
 | 
			
		||||
		c->subscribe_callback(c,
 | 
			
		||||
				event | g->event,
 | 
			
		||||
				g->id,
 | 
			
		||||
				c->subscribe_userdata);
 | 
			
		||||
 | 
			
		||||
		if (g->mask == (PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SOURCE)) {
 | 
			
		||||
			pw_log_debug("context %p: obj %d: emit %d:%d", c, g->node_info.monitor,
 | 
			
		||||
					event, PA_SUBSCRIPTION_EVENT_SOURCE);
 | 
			
		||||
			pw_log_debug("context %p: obj %d: emit %s:source", c, g->node_info.monitor,
 | 
			
		||||
					str_etype(event));
 | 
			
		||||
			c->subscribe_callback(c,
 | 
			
		||||
					event | PA_SUBSCRIPTION_EVENT_SOURCE,
 | 
			
		||||
					g->node_info.monitor,
 | 
			
		||||
| 
						 | 
				
			
			@ -376,6 +417,8 @@ static void parse_props(struct global *g, const struct spa_pod *param)
 | 
			
		|||
					g->node_info.channel_volumes, SPA_AUDIO_MAX_CHANNELS);
 | 
			
		||||
 | 
			
		||||
			if (n_vals != g->node_info.n_channel_volumes) {
 | 
			
		||||
				pw_log_debug("channel change %d->%d, trigger remove",
 | 
			
		||||
						g->node_info.n_channel_volumes, n_vals);
 | 
			
		||||
				emit_event(g->context, g, PA_SUBSCRIPTION_EVENT_REMOVE);
 | 
			
		||||
				emit_event(g->context, g, PA_SUBSCRIPTION_EVENT_NEW);
 | 
			
		||||
				g->node_info.n_channel_volumes = n_vals;
 | 
			
		||||
| 
						 | 
				
			
			@ -514,6 +557,7 @@ static void proxy_done(void *data, int seq)
 | 
			
		|||
		} else {
 | 
			
		||||
			event = PA_SUBSCRIPTION_EVENT_CHANGE;
 | 
			
		||||
		}
 | 
			
		||||
		pw_log_debug("emit because of pending");
 | 
			
		||||
		emit_event(g->context, g, event);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue