mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: tweak some parameters to get lower latency
This commit is contained in:
		
							parent
							
								
									ecc975d089
								
							
						
					
					
						commit
						745b7ee900
					
				
					 2 changed files with 5 additions and 5 deletions
				
			
		| 
						 | 
					@ -42,7 +42,7 @@
 | 
				
			||||||
#define MIN_BUFFERS     8u
 | 
					#define MIN_BUFFERS     8u
 | 
				
			||||||
#define MAX_BUFFERS     64u
 | 
					#define MAX_BUFFERS     64u
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MIN_SAMPLES	24u
 | 
					#define MIN_SAMPLES	16u
 | 
				
			||||||
#define MIN_USEC	(MIN_SAMPLES * SPA_USEC_PER_SEC / 48000u)
 | 
					#define MIN_USEC	(MIN_SAMPLES * SPA_USEC_PER_SEC / 48000u)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAXLENGTH		(4*1024*1024) /* 4MB */
 | 
					#define MAXLENGTH		(4*1024*1024) /* 4MB */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -954,6 +954,7 @@ static void fix_playback_buffer_attr(struct stream *s, struct buffer_attr *attr)
 | 
				
			||||||
	uint32_t frame_size, max_prebuf, minreq;
 | 
						uint32_t frame_size, max_prebuf, minreq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	frame_size = s->frame_size;
 | 
						frame_size = s->frame_size;
 | 
				
			||||||
 | 
						minreq = usec_to_bytes_round_up(MIN_USEC, &s->ss);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (attr->maxlength == (uint32_t) -1 || attr->maxlength > MAXLENGTH)
 | 
						if (attr->maxlength == (uint32_t) -1 || attr->maxlength > MAXLENGTH)
 | 
				
			||||||
		attr->maxlength = MAXLENGTH;
 | 
							attr->maxlength = MAXLENGTH;
 | 
				
			||||||
| 
						 | 
					@ -966,8 +967,7 @@ static void fix_playback_buffer_attr(struct stream *s, struct buffer_attr *attr)
 | 
				
			||||||
		attr->tlength = attr->maxlength;
 | 
							attr->tlength = attr->maxlength;
 | 
				
			||||||
	attr->tlength -= attr->tlength % frame_size;
 | 
						attr->tlength -= attr->tlength % frame_size;
 | 
				
			||||||
	attr->tlength = SPA_MAX(attr->tlength, frame_size);
 | 
						attr->tlength = SPA_MAX(attr->tlength, frame_size);
 | 
				
			||||||
 | 
						attr->tlength = SPA_MAX(attr->tlength, minreq);
 | 
				
			||||||
	s->missing = attr->tlength;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (attr->minreq == (uint32_t) -1) {
 | 
						if (attr->minreq == (uint32_t) -1) {
 | 
				
			||||||
		uint32_t process = usec_to_bytes_round_up(DEFAULT_PROCESS_MSEC*1000, &s->ss);
 | 
							uint32_t process = usec_to_bytes_round_up(DEFAULT_PROCESS_MSEC*1000, &s->ss);
 | 
				
			||||||
| 
						 | 
					@ -977,7 +977,6 @@ static void fix_playback_buffer_attr(struct stream *s, struct buffer_attr *attr)
 | 
				
			||||||
		m -= m % frame_size;
 | 
							m -= m % frame_size;
 | 
				
			||||||
		attr->minreq = SPA_MIN(process, m);
 | 
							attr->minreq = SPA_MIN(process, m);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	minreq = usec_to_bytes_round_up(MIN_USEC, &s->ss);
 | 
					 | 
				
			||||||
	attr->minreq = SPA_MAX(attr->minreq, minreq);
 | 
						attr->minreq = SPA_MAX(attr->minreq, minreq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (attr->tlength < attr->minreq+frame_size)
 | 
						if (attr->tlength < attr->minreq+frame_size)
 | 
				
			||||||
| 
						 | 
					@ -996,6 +995,7 @@ static void fix_playback_buffer_attr(struct stream *s, struct buffer_attr *attr)
 | 
				
			||||||
		attr->prebuf = max_prebuf;
 | 
							attr->prebuf = max_prebuf;
 | 
				
			||||||
	attr->prebuf -= attr->prebuf % frame_size;
 | 
						attr->prebuf -= attr->prebuf % frame_size;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						s->missing = attr->tlength;
 | 
				
			||||||
	attr->fragsize = 0;
 | 
						attr->fragsize = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_info(NAME" %p: [%s] maxlength:%u tlength:%u minreq:%u prebuf:%u", s,
 | 
						pw_log_info(NAME" %p: [%s] maxlength:%u tlength:%u minreq:%u prebuf:%u", s,
 | 
				
			||||||
| 
						 | 
					@ -1248,7 +1248,7 @@ static const struct spa_pod *get_buffers_param(struct stream *s,
 | 
				
			||||||
	stride = s->frame_size;
 | 
						stride = s->frame_size;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (s->direction == PW_DIRECTION_OUTPUT) {
 | 
						if (s->direction == PW_DIRECTION_OUTPUT) {
 | 
				
			||||||
		maxsize = attr->tlength * 2;
 | 
							maxsize = attr->tlength * 4;
 | 
				
			||||||
		size = attr->minreq * 2;
 | 
							size = attr->minreq * 2;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		size = attr->fragsize;
 | 
							size = attr->fragsize;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue