mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: keep separate counter for missing bytes
And only increment when consumed from ringbuffer. In underrun we play silence and don't ask for the missing bytes. Fixes #616
This commit is contained in:
		
							parent
							
								
									09f423922d
								
							
						
					
					
						commit
						f8d57d03ca
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
					@ -1423,6 +1423,7 @@ struct process_data {
 | 
				
			||||||
	uint32_t write_index;
 | 
						uint32_t write_index;
 | 
				
			||||||
	uint32_t underrun_for;
 | 
						uint32_t underrun_for;
 | 
				
			||||||
	uint32_t playing_for;
 | 
						uint32_t playing_for;
 | 
				
			||||||
 | 
						uint32_t missing;
 | 
				
			||||||
	unsigned int underrun:1;
 | 
						unsigned int underrun:1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1460,7 +1461,7 @@ do_process_done(struct spa_loop *loop,
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
				send_stream_started(stream);
 | 
									send_stream_started(stream);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		stream->missing += pd->playing_for;
 | 
							stream->missing += pd->missing;
 | 
				
			||||||
		stream->missing = SPA_MIN(stream->missing, stream->attr.tlength);
 | 
							stream->missing = SPA_MIN(stream->missing, stream->attr.tlength);
 | 
				
			||||||
		stream->playing_for += pd->playing_for;
 | 
							stream->playing_for += pd->playing_for;
 | 
				
			||||||
		if (stream->underrun_for != (uint64_t)-1)
 | 
							if (stream->underrun_for != (uint64_t)-1)
 | 
				
			||||||
| 
						 | 
					@ -1580,6 +1581,7 @@ static void stream_process(void *data)
 | 
				
			||||||
			spa_ringbuffer_read_update(&stream->ring, pd.read_index);
 | 
								spa_ringbuffer_read_update(&stream->ring, pd.read_index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			pd.playing_for = size;
 | 
								pd.playing_for = size;
 | 
				
			||||||
 | 
								pd.missing = size;
 | 
				
			||||||
			pd.underrun = false;
 | 
								pd.underrun = false;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	        buf->datas[0].chunk->offset = 0;
 | 
						        buf->datas[0].chunk->offset = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue