mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-10-29 05:40:27 -04:00 
			
		
		
		
	bluez5: media-source: add option to control the target latency of the decode-buffer
On production systems, having a constant high latency is favored over dynamically adjusting it in order to optimize for low latency, because every time a dynamic adjustment happens, there's a glitch. This adds an option to let the user specify the exact amount of latency they want.
This commit is contained in:
		
							parent
							
								
									5af8340183
								
							
						
					
					
						commit
						e9b78f1c31
					
				
					 2 changed files with 12 additions and 0 deletions
				
			
		|  | @ -1196,6 +1196,11 @@ this instance. Available values: | ||||||
|   - input: appear as source node. |   - input: appear as source node. | ||||||
| \endparblock | \endparblock | ||||||
| 
 | 
 | ||||||
|  | @PAR@ node-prop  bluez5.decode-buffer.latency   # integer | ||||||
|  | Applies on media source nodes and defines the target amount | ||||||
|  | of samples to be buffered on the output of the decoder. | ||||||
|  | Default: 0, which means it is automatically determined. | ||||||
|  | 
 | ||||||
| @PAR@ node-prop  node.latency-offset-msec   # string | @PAR@ node-prop  node.latency-offset-msec   # string | ||||||
| Applies only for BLE MIDI nodes. | Applies only for BLE MIDI nodes. | ||||||
| Latency adjustment to apply on the node. Larger values add a | Latency adjustment to apply on the node. Larger values add a | ||||||
|  |  | ||||||
|  | @ -141,6 +141,8 @@ struct impl { | ||||||
| 	unsigned int is_duplex:1; | 	unsigned int is_duplex:1; | ||||||
| 	unsigned int is_internal:1; | 	unsigned int is_internal:1; | ||||||
| 
 | 
 | ||||||
|  | 	unsigned int decode_buffer_target; | ||||||
|  | 
 | ||||||
| 	unsigned int node_latency; | 	unsigned int node_latency; | ||||||
| 
 | 
 | ||||||
| 	int fd; | 	int fd; | ||||||
|  | @ -885,6 +887,8 @@ static int transport_start(struct impl *this) | ||||||
| 			this->quantum_limit, this->quantum_limit)) < 0) | 			this->quantum_limit, this->quantum_limit)) < 0) | ||||||
| 		return res; | 		return res; | ||||||
| 
 | 
 | ||||||
|  | 	spa_bt_decode_buffer_set_target_latency(&port->buffer, (int32_t) this->decode_buffer_target); | ||||||
|  | 
 | ||||||
| 	if (this->codec->kind == MEDIA_CODEC_HFP) { | 	if (this->codec->kind == MEDIA_CODEC_HFP) { | ||||||
| 		/* 40 ms max buffer (on top of duration) */ | 		/* 40 ms max buffer (on top of duration) */ | ||||||
| 		spa_bt_decode_buffer_set_max_extra_latency(&port->buffer, | 		spa_bt_decode_buffer_set_max_extra_latency(&port->buffer, | ||||||
|  | @ -2057,6 +2061,9 @@ impl_init(const struct spa_handle_factory *factory, | ||||||
| 			this->is_duplex = spa_atob(str); | 			this->is_duplex = spa_atob(str); | ||||||
| 		if ((str = spa_dict_lookup(info, "api.bluez5.internal")) != NULL) | 		if ((str = spa_dict_lookup(info, "api.bluez5.internal")) != NULL) | ||||||
| 			this->is_internal = spa_atob(str); | 			this->is_internal = spa_atob(str); | ||||||
|  | 		if ((str = spa_dict_lookup(info, "bluez5.decode-buffer.latency")) != NULL) { | ||||||
|  | 			spa_atou32(str, &this->decode_buffer_target, 0); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (this->is_duplex) { | 	if (this->is_duplex) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 George Kiagiadakis
						George Kiagiadakis