mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: use at least MIN_SAMPLES of samples per buffer
This commit is contained in:
		
							parent
							
								
									d01586bfa5
								
							
						
					
					
						commit
						fde36ac6c2
					
				
					 2 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
					@ -42,6 +42,8 @@
 | 
				
			||||||
#define MIN_BUFFERS     8u
 | 
					#define MIN_BUFFERS     8u
 | 
				
			||||||
#define MAX_BUFFERS     64u
 | 
					#define MAX_BUFFERS     64u
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define MIN_SAMPLES	24u
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAXLENGTH		(4*1024*1024) /* 4MB */
 | 
					#define MAXLENGTH		(4*1024*1024) /* 4MB */
 | 
				
			||||||
#define DEFAULT_TLENGTH_MSEC	2000 /* 2s */
 | 
					#define DEFAULT_TLENGTH_MSEC	2000 /* 2s */
 | 
				
			||||||
#define DEFAULT_PROCESS_MSEC	20   /* 20ms */
 | 
					#define DEFAULT_PROCESS_MSEC	20   /* 20ms */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -905,6 +905,7 @@ 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);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						attr->minreq = SPA_MAX(attr->minreq, MIN_SAMPLES * frame_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (attr->tlength < attr->minreq+frame_size)
 | 
						if (attr->tlength < attr->minreq+frame_size)
 | 
				
			||||||
		attr->tlength = attr->minreq + frame_size;
 | 
							attr->tlength = attr->minreq + frame_size;
 | 
				
			||||||
| 
						 | 
					@ -1146,6 +1147,8 @@ static void fix_record_buffer_attr(struct stream *s, struct buffer_attr *attr)
 | 
				
			||||||
		attr->fragsize = usec_to_bytes_round_up(DEFAULT_FRAGSIZE_MSEC*1000, &s->ss);
 | 
							attr->fragsize = usec_to_bytes_round_up(DEFAULT_FRAGSIZE_MSEC*1000, &s->ss);
 | 
				
			||||||
	attr->fragsize -= attr->fragsize % frame_size;
 | 
						attr->fragsize -= attr->fragsize % frame_size;
 | 
				
			||||||
	attr->fragsize = SPA_MAX(attr->fragsize, frame_size);
 | 
						attr->fragsize = SPA_MAX(attr->fragsize, frame_size);
 | 
				
			||||||
 | 
						attr->fragsize = SPA_MAX(attr->fragsize, MIN_SAMPLES * frame_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (attr->fragsize > attr->maxlength)
 | 
						if (attr->fragsize > attr->maxlength)
 | 
				
			||||||
		attr->fragsize = attr->maxlength;
 | 
							attr->fragsize = attr->maxlength;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue