mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	audioconvert: only emit node_info once in add_listener
This commit is contained in:
		
							parent
							
								
									ab069d45be
								
							
						
					
					
						commit
						697976f416
					
				
					 2 changed files with 18 additions and 2 deletions
				
			
		| 
						 | 
					@ -71,6 +71,7 @@ struct impl {
 | 
				
			||||||
	struct spa_hook_list hooks;
 | 
						struct spa_hook_list hooks;
 | 
				
			||||||
	struct spa_callbacks callbacks;
 | 
						struct spa_callbacks callbacks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						unsigned int add_listener:1;
 | 
				
			||||||
	unsigned int use_converter:1;
 | 
						unsigned int use_converter:1;
 | 
				
			||||||
	unsigned int started:1;
 | 
						unsigned int started:1;
 | 
				
			||||||
	unsigned int driver:1;
 | 
						unsigned int driver:1;
 | 
				
			||||||
| 
						 | 
					@ -186,6 +187,9 @@ static int link_io(struct impl *this)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void emit_node_info(struct impl *this, bool full)
 | 
					static void emit_node_info(struct impl *this, bool full)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						if (this->add_listener)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (full)
 | 
						if (full)
 | 
				
			||||||
		this->info.change_mask = this->info_all;
 | 
							this->info.change_mask = this->info_all;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -446,7 +450,7 @@ static int impl_node_add_listener(void *object,
 | 
				
			||||||
	spa_log_trace(this->log, NAME" %p: add listener %p", this, listener);
 | 
						spa_log_trace(this->log, NAME" %p: add listener %p", this, listener);
 | 
				
			||||||
	spa_hook_list_isolate(&this->hooks, &save, listener, events, data);
 | 
						spa_hook_list_isolate(&this->hooks, &save, listener, events, data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	emit_node_info(this, true);
 | 
						this->add_listener = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->use_converter) {
 | 
						if (this->use_converter) {
 | 
				
			||||||
		spa_zero(l);
 | 
							spa_zero(l);
 | 
				
			||||||
| 
						 | 
					@ -454,6 +458,10 @@ static int impl_node_add_listener(void *object,
 | 
				
			||||||
		spa_hook_remove(&l);
 | 
							spa_hook_remove(&l);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						this->add_listener = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						emit_node_info(this, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_hook_list_join(&this->hooks, &save);
 | 
						spa_hook_list_join(&this->hooks, &save);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -106,6 +106,7 @@ struct impl {
 | 
				
			||||||
	struct spa_hook listener[2];
 | 
						struct spa_hook listener[2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	unsigned int started:1;
 | 
						unsigned int started:1;
 | 
				
			||||||
 | 
						unsigned int add_listener:1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IS_MONITOR_PORT(this,dir,port_id) (dir == SPA_DIRECTION_OUTPUT && port_id > 0 &&	\
 | 
					#define IS_MONITOR_PORT(this,dir,port_id) (dir == SPA_DIRECTION_OUTPUT && port_id > 0 &&	\
 | 
				
			||||||
| 
						 | 
					@ -113,6 +114,9 @@ struct impl {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void emit_node_info(struct impl *this, bool full)
 | 
					static void emit_node_info(struct impl *this, bool full)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						if (this->add_listener)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (full)
 | 
						if (full)
 | 
				
			||||||
		this->info.change_mask = this->info_all;
 | 
							this->info.change_mask = this->info_all;
 | 
				
			||||||
	if (this->info.change_mask) {
 | 
						if (this->info.change_mask) {
 | 
				
			||||||
| 
						 | 
					@ -798,7 +802,7 @@ impl_node_add_listener(void *object,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_log_trace(this->log, "%p: add listener %p", this, listener);
 | 
						spa_log_trace(this->log, "%p: add listener %p", this, listener);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	emit_node_info(this, true);
 | 
						this->add_listener = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_zero(l);
 | 
						spa_zero(l);
 | 
				
			||||||
	spa_node_add_listener(this->fmt[SPA_DIRECTION_INPUT],
 | 
						spa_node_add_listener(this->fmt[SPA_DIRECTION_INPUT],
 | 
				
			||||||
| 
						 | 
					@ -815,6 +819,10 @@ impl_node_add_listener(void *object,
 | 
				
			||||||
	spa_hook_remove(&l[2]);
 | 
						spa_hook_remove(&l[2]);
 | 
				
			||||||
	spa_hook_remove(&l[3]);
 | 
						spa_hook_remove(&l[3]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						this->add_listener = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						emit_node_info(this, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_hook_list_join(&this->hooks, &save);
 | 
						spa_hook_list_join(&this->hooks, &save);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue