mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	resample: fix start position of new samples
When we finished processing the history it might be possible that we need to skip some samples from the input. Implement this by adding a start offset for the samples in the buffer.
This commit is contained in:
		
							parent
							
								
									0a26c478f7
								
							
						
					
					
						commit
						761119f640
					
				
					 2 changed files with 19 additions and 17 deletions
				
			
		| 
						 | 
				
			
			@ -184,7 +184,7 @@ static void impl_native_process(struct resample *r,
 | 
			
		|||
		 * and we try to process it */
 | 
			
		||||
		in = hist + refill;
 | 
			
		||||
		out = *out_len;
 | 
			
		||||
		data->func(r, (const void**)history, &in, dst, 0, &out);
 | 
			
		||||
		data->func(r, (const void**)history, 0, &in, dst, 0, &out);
 | 
			
		||||
		spa_log_trace_fp(r->log, "native %p: in:%d/%d out %d/%d hist:%d",
 | 
			
		||||
				r, hist + refill, in, *out_len, out, hist);
 | 
			
		||||
	} else {
 | 
			
		||||
| 
						 | 
				
			
			@ -192,10 +192,11 @@ static void impl_native_process(struct resample *r,
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	if (in >= hist) {
 | 
			
		||||
		int skip = in - hist;
 | 
			
		||||
		/* we are past the history and can now work on the new
 | 
			
		||||
		 * input data */
 | 
			
		||||
		in = *in_len;
 | 
			
		||||
		data->func(r, src, &in, dst, out, out_len);
 | 
			
		||||
		in = *in_len - skip;
 | 
			
		||||
		data->func(r, src, skip, &in, dst, out, out_len);
 | 
			
		||||
		spa_log_trace_fp(r->log, "native %p: in:%d/%d out %d/%d",
 | 
			
		||||
				r, *in_len, in, *out_len, out);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue