mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: calculate missing bytes differently
Based on patch from Barnabás Pőcze <pobrn@protonmail.com> Instead of trying to keep track of the missing bytes ourselves, use the simple tlength - avail - requested formula to request more bytes from the client. Fixes #1981
This commit is contained in:
		
							parent
							
								
									7b1c5cd6dd
								
							
						
					
					
						commit
						982758ffed
					
				
					 4 changed files with 11 additions and 30 deletions
				
			
		| 
						 | 
				
			
			@ -167,7 +167,6 @@ static int handle_memblock(struct client *client, struct message *msg)
 | 
			
		|||
	index += diff;
 | 
			
		||||
	filled += diff;
 | 
			
		||||
	stream->write_index += diff;
 | 
			
		||||
	stream->missing -= diff;
 | 
			
		||||
 | 
			
		||||
	if (filled < 0) {
 | 
			
		||||
		/* underrun, reported on reader side */
 | 
			
		||||
| 
						 | 
				
			
			@ -188,13 +187,7 @@ static int handle_memblock(struct client *client, struct message *msg)
 | 
			
		|||
	spa_ringbuffer_write_update(&stream->ring, index);
 | 
			
		||||
	stream->requested -= SPA_MIN(msg->length, stream->requested);
 | 
			
		||||
 | 
			
		||||
	if (diff < 0) {
 | 
			
		||||
		/* when we seek backwards, ask for the additional missing data
 | 
			
		||||
		 * immediately so that we don't underrun in the next process */
 | 
			
		||||
		pw_log_info("client %p [%s]: backwards seek of: %" PRIi64,
 | 
			
		||||
			    client, client->name, diff);
 | 
			
		||||
		stream_send_request(stream);
 | 
			
		||||
	}
 | 
			
		||||
	stream_send_request(stream);
 | 
			
		||||
 | 
			
		||||
finish:
 | 
			
		||||
	message_free(impl, msg, false, false);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue