mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	stream: check requested before use
It can be 0 and so we should fill the complete buffer. Fixes #3683
This commit is contained in:
		
							parent
							
								
									0a7f8128a3
								
							
						
					
					
						commit
						94f898ddc5
					
				
					 2 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -73,7 +73,9 @@ static void on_process(void *userdata)
 | 
			
		|||
		return;
 | 
			
		||||
 | 
			
		||||
	stride = sizeof(float) * DEFAULT_CHANNELS;
 | 
			
		||||
	n_frames = SPA_MIN(b->requested, buf->datas[0].maxsize / stride);
 | 
			
		||||
	n_frames = buf->datas[0].maxsize / stride;
 | 
			
		||||
	if (b->requested)
 | 
			
		||||
		n_frames = SPA_MIN((int)b->requested, n_frames);
 | 
			
		||||
 | 
			
		||||
	fill_f32(data, p, n_frames);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -845,7 +845,8 @@ static void on_process(void *userdata)
 | 
			
		|||
		bool null_frame = false;
 | 
			
		||||
 | 
			
		||||
		n_frames = d->maxsize / data->stride;
 | 
			
		||||
		n_frames = SPA_MIN(n_frames, (int)b->requested);
 | 
			
		||||
		if (b->requested)
 | 
			
		||||
			n_frames = SPA_MIN(n_frames, (int)b->requested);
 | 
			
		||||
 | 
			
		||||
		/* Note that when playing encoded audio, the encoded_playback_fill()
 | 
			
		||||
		 * fill callback actually returns number of bytes, not frames, since
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue