mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	client-node: clear buffers when mixer is removed
This commit is contained in:
		
							parent
							
								
									60ec372212
								
							
						
					
					
						commit
						899e67eb61
					
				
					 1 changed files with 17 additions and 5 deletions
				
			
		| 
						 | 
					@ -98,6 +98,7 @@ struct io {
 | 
				
			||||||
struct mix {
 | 
					struct mix {
 | 
				
			||||||
	bool valid;
 | 
						bool valid;
 | 
				
			||||||
	bool active;
 | 
						bool active;
 | 
				
			||||||
 | 
						uint32_t id;
 | 
				
			||||||
	struct port *port;
 | 
						struct port *port;
 | 
				
			||||||
	uint32_t n_buffers;
 | 
						uint32_t n_buffers;
 | 
				
			||||||
	struct buffer buffers[MAX_BUFFERS];
 | 
						struct buffer buffers[MAX_BUFFERS];
 | 
				
			||||||
| 
						 | 
					@ -179,6 +180,13 @@ struct impl {
 | 
				
			||||||
	uint64_t start;
 | 
						uint64_t start;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int
 | 
				
			||||||
 | 
					do_port_use_buffers(struct impl *impl,
 | 
				
			||||||
 | 
							    enum spa_direction direction,
 | 
				
			||||||
 | 
							    uint32_t port_id,
 | 
				
			||||||
 | 
							    uint32_t mix_id,
 | 
				
			||||||
 | 
							    struct spa_buffer **buffers,
 | 
				
			||||||
 | 
							    uint32_t n_buffers);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** \endcond */
 | 
					/** \endcond */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -229,10 +237,11 @@ static struct mix *find_mix(struct port *p, uint32_t mix_id)
 | 
				
			||||||
	return mix;
 | 
						return mix;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void mix_init(struct mix *mix, struct port *p)
 | 
					static void mix_init(struct mix *mix, struct port *p, uint32_t id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	mix->valid = true;
 | 
						mix->valid = true;
 | 
				
			||||||
 | 
						mix->id = id;
 | 
				
			||||||
	mix->port = p;
 | 
						mix->port = p;
 | 
				
			||||||
	mix->active = false;
 | 
						mix->active = false;
 | 
				
			||||||
	mix->n_buffers = 0;
 | 
						mix->n_buffers = 0;
 | 
				
			||||||
| 
						 | 
					@ -249,7 +258,7 @@ static struct mix *ensure_mix(struct impl *impl, struct port *p, uint32_t mix_id
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	if (mix->valid)
 | 
						if (mix->valid)
 | 
				
			||||||
		return mix;
 | 
							return mix;
 | 
				
			||||||
	mix_init(mix, p);
 | 
						mix_init(mix, p, mix_id);
 | 
				
			||||||
	return mix;
 | 
						return mix;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -337,11 +346,14 @@ static int clear_buffers(struct node *this, struct mix *mix)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void mix_clear(struct node *this, struct mix *mix)
 | 
					static void mix_clear(struct node *this, struct mix *mix)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct port *port = mix->port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!mix->valid)
 | 
						if (!mix->valid)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	mix->valid = false;
 | 
						do_port_use_buffers(this->impl, port->direction, port->id,
 | 
				
			||||||
	clear_buffers(this, mix);
 | 
								mix->id, NULL, 0);
 | 
				
			||||||
	clear_ios(this, mix);
 | 
						clear_ios(this, mix);
 | 
				
			||||||
 | 
						mix->valid = false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int impl_node_enum_params(struct spa_node *node,
 | 
					static int impl_node_enum_params(struct spa_node *node,
 | 
				
			||||||
| 
						 | 
					@ -1509,7 +1521,7 @@ static void node_port_init(void *data, struct pw_port *port)
 | 
				
			||||||
	p->id = port->port_id;
 | 
						p->id = port->port_id;
 | 
				
			||||||
	p->impl = impl;
 | 
						p->impl = impl;
 | 
				
			||||||
	p->mix_node = impl_port_mix;
 | 
						p->mix_node = impl_port_mix;
 | 
				
			||||||
	mix_init(&p->mix[MAX_MIX], p);
 | 
						mix_init(&p->mix[MAX_MIX], p, SPA_ID_INVALID);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (p->direction == SPA_DIRECTION_INPUT)
 | 
						if (p->direction == SPA_DIRECTION_INPUT)
 | 
				
			||||||
		this->in_ports[p->id] = p;
 | 
							this->in_ports[p->id] = p;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue