mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: always send at least fragsize data
Make sure to never send less than the negotiated fragsize to a client. Also make sure we don't send too much data in one go. This is more in line with what pulseaudio does. Fixes capture from multiple tabs in chrome. Fixes #2418
This commit is contained in:
		
							parent
							
								
									1245309a7b
								
							
						
					
					
						commit
						0d51f3b74e
					
				
					 1 changed files with 6 additions and 5 deletions
				
			
		| 
						 | 
					@ -87,6 +87,9 @@
 | 
				
			||||||
#define DEFAULT_POSITION	"[ FL FR ]"
 | 
					#define DEFAULT_POSITION	"[ FL FR ]"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAX_FORMATS	32
 | 
					#define MAX_FORMATS	32
 | 
				
			||||||
 | 
					/* The max amount of data we send in one block when capturing. In PulseAudio this
 | 
				
			||||||
 | 
					 * size is derived from the mempool PA_MEMPOOL_SLOT_SIZE */
 | 
				
			||||||
 | 
					#define MAX_FRAGSIZE	(64*1024)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TEMPORARY_MOVE_TIMEOUT	(SPA_NSEC_PER_SEC)
 | 
					#define TEMPORARY_MOVE_TIMEOUT	(SPA_NSEC_PER_SEC)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1284,7 +1287,7 @@ do_process_done(struct spa_loop *loop,
 | 
				
			||||||
			pw_log_warn("%p: [%s] underrun read:%u avail:%d",
 | 
								pw_log_warn("%p: [%s] underrun read:%u avail:%d",
 | 
				
			||||||
					stream, client->name, index, avail);
 | 
										stream, client->name, index, avail);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			if (avail > (int32_t)stream->attr.maxlength) {
 | 
								if ((uint32_t)avail > stream->attr.maxlength) {
 | 
				
			||||||
				uint32_t skip = avail - stream->attr.fragsize;
 | 
									uint32_t skip = avail - stream->attr.fragsize;
 | 
				
			||||||
				/* overrun, catch up to latest fragment and send it */
 | 
									/* overrun, catch up to latest fragment and send it */
 | 
				
			||||||
				pw_log_warn("%p: [%s] overrun recover read:%u avail:%d max:%u skip:%u",
 | 
									pw_log_warn("%p: [%s] overrun recover read:%u avail:%d max:%u skip:%u",
 | 
				
			||||||
| 
						 | 
					@ -1294,10 +1297,8 @@ do_process_done(struct spa_loop *loop,
 | 
				
			||||||
				avail = stream->attr.fragsize;
 | 
									avail = stream->attr.fragsize;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			while (avail > 0) {
 | 
								while ((uint32_t)avail >= stream->attr.fragsize) {
 | 
				
			||||||
				towrite = avail;
 | 
									towrite = SPA_MIN(avail, MAX_FRAGSIZE);
 | 
				
			||||||
				if (towrite > stream->attr.fragsize)
 | 
					 | 
				
			||||||
					towrite = stream->attr.fragsize;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
				msg = message_alloc(impl, stream->channel, towrite);
 | 
									msg = message_alloc(impl, stream->channel, towrite);
 | 
				
			||||||
				if (msg == NULL)
 | 
									if (msg == NULL)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue