mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	audioconvert: improve latency handling
When setting the Latency parameter on one side of the converter, set it also on the other size. We should actually implement propagating the latency through all the elements of the converter later. Implement latency handling on fmtconvert. merger and splitter change latency on all ports when on port changes. All this makes the configured and exposed latencies visible on all ports from adapter.
This commit is contained in:
		
							parent
							
								
									22fe0b293a
								
							
						
					
					
						commit
						48e6e41d95
					
				
					 4 changed files with 91 additions and 45 deletions
				
			
		| 
						 | 
				
			
			@ -572,8 +572,8 @@ impl_node_port_enum_params(void *object, int seq,
 | 
			
		|||
		break;
 | 
			
		||||
	case SPA_PARAM_Latency:
 | 
			
		||||
		switch (result.index) {
 | 
			
		||||
		case 0:
 | 
			
		||||
			param = spa_latency_build(&b, id, &this->latency[direction]);
 | 
			
		||||
		case 0: case 1:
 | 
			
		||||
			param = spa_latency_build(&b, id, &this->latency[result.index]);
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			return 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -705,19 +705,16 @@ static int port_set_latency(void *object,
 | 
			
		|||
			return -EINVAL;
 | 
			
		||||
		this->latency[other] = info;
 | 
			
		||||
	}
 | 
			
		||||
	if (direction == SPA_DIRECTION_INPUT) {
 | 
			
		||||
		for (i = 0; i < this->port_count; i++) {
 | 
			
		||||
			port = GET_OUT_PORT(this, i);
 | 
			
		||||
			port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
 | 
			
		||||
			port->params[IDX_Latency].flags ^= SPA_PARAM_INFO_SERIAL;
 | 
			
		||||
			emit_port_info(this, port, false);
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		port = GET_IN_PORT(this, 0);
 | 
			
		||||
	for (i = 0; i < this->port_count; i++) {
 | 
			
		||||
		port = GET_OUT_PORT(this, i);
 | 
			
		||||
		port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
 | 
			
		||||
		port->params[IDX_Latency].flags ^= SPA_PARAM_INFO_SERIAL;
 | 
			
		||||
		emit_port_info(this, port, false);
 | 
			
		||||
	}
 | 
			
		||||
	port = GET_IN_PORT(this, 0);
 | 
			
		||||
	port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
 | 
			
		||||
	port->params[IDX_Latency].flags ^= SPA_PARAM_INFO_SERIAL;
 | 
			
		||||
	emit_port_info(this, port, false);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -793,7 +790,6 @@ static int port_set_format(void *object,
 | 
			
		|||
	if (port->have_format) {
 | 
			
		||||
		port->params[IDX_Format] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_READWRITE);
 | 
			
		||||
		port->params[IDX_Buffers] = SPA_PARAM_INFO(SPA_PARAM_Buffers, SPA_PARAM_INFO_READ);
 | 
			
		||||
		port->params[IDX_Latency].flags ^= SPA_PARAM_INFO_SERIAL;
 | 
			
		||||
	} else {
 | 
			
		||||
		port->params[IDX_Format] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_WRITE);
 | 
			
		||||
		port->params[IDX_Buffers] = SPA_PARAM_INFO(SPA_PARAM_Buffers, 0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue