mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: express latency in samples in all cases
This commit is contained in:
		
							parent
							
								
									b44cb0a897
								
							
						
					
					
						commit
						96d98c7955
					
				
					 1 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -1091,18 +1091,19 @@ static int reply_create_playback_stream(struct stream *stream)
 | 
			
		|||
	spa_ringbuffer_init(&stream->ring);
 | 
			
		||||
 | 
			
		||||
	if (stream->early_requests) {
 | 
			
		||||
		lat.num = stream->attr.minreq / stream->frame_size;
 | 
			
		||||
		lat.num = stream->attr.minreq;
 | 
			
		||||
	} else if (stream->adjust_latency) {
 | 
			
		||||
		if (stream->attr.tlength > stream->attr.minreq * 2)
 | 
			
		||||
			lat.num = (stream->attr.tlength - stream->attr.minreq * 2) / 2 / stream->frame_size;
 | 
			
		||||
			lat.num = (stream->attr.tlength - stream->attr.minreq * 2) / 2;
 | 
			
		||||
		else
 | 
			
		||||
			lat.num = stream->attr.minreq;
 | 
			
		||||
	} else {
 | 
			
		||||
		if (stream->attr.tlength > stream->attr.minreq * 2)
 | 
			
		||||
			lat.num = (stream->attr.tlength - stream->attr.minreq * 2) / stream->frame_size;
 | 
			
		||||
			lat.num = stream->attr.tlength - stream->attr.minreq * 2;
 | 
			
		||||
		else
 | 
			
		||||
			lat.num = stream->attr.minreq;
 | 
			
		||||
	}
 | 
			
		||||
	lat.num /= stream->frame_size;
 | 
			
		||||
	lat.denom = stream->ss.rate;
 | 
			
		||||
	lat_usec = lat.num * SPA_USEC_PER_SEC / lat.denom;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue