mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	audioconvert: don't use range
Use the spa_io_position->size to decide how many samples to output from the resampler.
This commit is contained in:
		
							parent
							
								
									4ae771ccc1
								
							
						
					
					
						commit
						3cb400bb61
					
				
					 3 changed files with 83 additions and 49 deletions
				
			
		| 
						 | 
				
			
			@ -104,7 +104,6 @@ struct impl {
 | 
			
		|||
	struct pw_port_mix client_port_mix;
 | 
			
		||||
 | 
			
		||||
	struct spa_io_buffers *io;
 | 
			
		||||
	struct spa_io_range range;
 | 
			
		||||
 | 
			
		||||
	struct spa_buffer **buffers;
 | 
			
		||||
	uint32_t n_buffers;
 | 
			
		||||
| 
						 | 
				
			
			@ -267,12 +266,20 @@ static int impl_node_set_io(struct spa_node *node, uint32_t id, void *data, size
 | 
			
		|||
{
 | 
			
		||||
	struct node *this;
 | 
			
		||||
	struct impl *impl;
 | 
			
		||||
	int res = 0;
 | 
			
		||||
 | 
			
		||||
	spa_return_val_if_fail(node != NULL, -EINVAL);
 | 
			
		||||
 | 
			
		||||
	this = SPA_CONTAINER_OF(node, struct node, node);
 | 
			
		||||
	impl = this->impl;
 | 
			
		||||
 | 
			
		||||
	return spa_node_set_io(impl->cnode, id, data, size);
 | 
			
		||||
	if (impl->adapter)
 | 
			
		||||
		res = spa_node_set_io(impl->adapter, id, data, size);
 | 
			
		||||
 | 
			
		||||
	if (impl->cnode && impl->adapter != impl->cnode) {
 | 
			
		||||
		res = spa_node_set_io(impl->cnode, id, data, size);
 | 
			
		||||
	}
 | 
			
		||||
	return res;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int impl_node_send_command(struct spa_node *node, const struct spa_command *command)
 | 
			
		||||
| 
						 | 
				
			
			@ -415,13 +422,6 @@ impl_node_add_port(struct spa_node *node, enum spa_direction direction, uint32_t
 | 
			
		|||
	if ((res = spa_node_add_port(impl->adapter_mix, direction, port_id, props)) < 0)
 | 
			
		||||
		return res;
 | 
			
		||||
 | 
			
		||||
	if ((res = spa_node_port_set_io(impl->adapter_mix,
 | 
			
		||||
					direction, port_id,
 | 
			
		||||
					SPA_IO_Range,
 | 
			
		||||
					&impl->range,
 | 
			
		||||
					sizeof(&impl->range))) < 0)
 | 
			
		||||
			return res;
 | 
			
		||||
 | 
			
		||||
	return res;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -853,9 +853,7 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
	if (!impl->active)
 | 
			
		||||
		return SPA_STATUS_HAVE_BUFFER;
 | 
			
		||||
 | 
			
		||||
	impl->range.min_size = impl->range.max_size = q->size * sizeof(float);
 | 
			
		||||
 | 
			
		||||
	spa_log_trace_fp(this->log, "%p: process %d", this, impl->range.max_size);
 | 
			
		||||
	spa_log_trace_fp(this->log, "%p: process %zd", this, q->size * sizeof(float));
 | 
			
		||||
 | 
			
		||||
	if (impl->use_converter) {
 | 
			
		||||
		status = spa_node_process(impl->adapter);
 | 
			
		||||
| 
						 | 
				
			
			@ -1096,12 +1094,6 @@ static void client_node_initialized(void *data)
 | 
			
		|||
					impl->client_port_mix.io,
 | 
			
		||||
					sizeof(impl->client_port_mix.io))) < 0)
 | 
			
		||||
			return;
 | 
			
		||||
		if ((res = spa_node_port_set_io(impl->adapter_mix,
 | 
			
		||||
					impl->direction, 0,
 | 
			
		||||
					SPA_IO_Range,
 | 
			
		||||
					&impl->range,
 | 
			
		||||
					sizeof(&impl->range))) < 0)
 | 
			
		||||
			return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	switch (media_type) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue