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;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	stride = sizeof(float) * DEFAULT_CHANNELS;
 | 
						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);
 | 
						fill_f32(data, p, n_frames);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -845,6 +845,7 @@ static void on_process(void *userdata)
 | 
				
			||||||
		bool null_frame = false;
 | 
							bool null_frame = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		n_frames = d->maxsize / data->stride;
 | 
							n_frames = d->maxsize / data->stride;
 | 
				
			||||||
 | 
							if (b->requested)
 | 
				
			||||||
			n_frames = SPA_MIN(n_frames, (int)b->requested);
 | 
								n_frames = SPA_MIN(n_frames, (int)b->requested);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Note that when playing encoded audio, the encoded_playback_fill()
 | 
							/* Note that when playing encoded audio, the encoded_playback_fill()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue