mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	bluez5: media-sink: keep one more buffer free
We delay the audio a bit to keep packet intervals equal, which keeps some data in buffers. In theory the calculation keeps one buffer free, but it doesn't explicitly keep "extra" buffer space so in theory might flush too late and next process() might not have free buffers. However, as we encode next packet right away this shouldn't really occur... Try to keep one extra spare buffer free so that the flush time is certainly early enough.
This commit is contained in:
		
							parent
							
								
									513495eaaa
								
							
						
					
					
						commit
						2335657343
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -53,7 +53,7 @@ struct props {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
#define FILL_FRAMES 4
 | 
			
		||||
#define MIN_BUFFERS 2
 | 
			
		||||
#define MIN_BUFFERS 3
 | 
			
		||||
#define MAX_BUFFERS 32
 | 
			
		||||
#define BUFFER_SIZE	(8192*8)
 | 
			
		||||
#define RATE_CTL_DIFF_MAX 0.005
 | 
			
		||||
| 
						 | 
				
			
			@ -888,7 +888,7 @@ again:
 | 
			
		|||
			 */
 | 
			
		||||
#if 1
 | 
			
		||||
			this->next_flush_time += SPA_MIN(packet_time,
 | 
			
		||||
					duration_ns * (port->n_buffers - 1));
 | 
			
		||||
					duration_ns * (SPA_MAX(port->n_buffers, 2u) - 2));
 | 
			
		||||
#endif
 | 
			
		||||
		} else {
 | 
			
		||||
			if (this->next_flush_time == 0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue