mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	resample-native: substract num of skipped samples after processing input
Takes into account the number of skipped samples when deciding whether we should copy the remaining samples in the history or not. Fixes dropping audio issue when resampling from high frequencies such as 48KHz to low requencies such as 8KHz.
This commit is contained in:
		
							parent
							
								
									7bd7476426
								
							
						
					
					
						commit
						03bc36a502
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
					@ -258,13 +258,13 @@ static void impl_native_process(struct resample *r,
 | 
				
			||||||
		int skip = in - hist;
 | 
							int skip = in - hist;
 | 
				
			||||||
		/* we are past the history and can now work on the new
 | 
							/* we are past the history and can now work on the new
 | 
				
			||||||
		 * input data */
 | 
							 * input data */
 | 
				
			||||||
		in = *in_len - skip;
 | 
							in = *in_len;
 | 
				
			||||||
		data->func(r, src, skip, &in, dst, out, out_len);
 | 
							data->func(r, src, skip, &in, dst, out, out_len);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		spa_log_trace_fp(r->log, "native %p: in:%d/%d out %d/%d",
 | 
							spa_log_trace_fp(r->log, "native %p: in:%d/%d out %d/%d",
 | 
				
			||||||
				r, *in_len, in, *out_len, out);
 | 
									r, *in_len, in, *out_len, out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		remain = *in_len - in;
 | 
							remain = *in_len - skip - in;
 | 
				
			||||||
		if (remain > 0 && remain < n_taps) {
 | 
							if (remain > 0 && remain < n_taps) {
 | 
				
			||||||
			/* not enough input data remaining for more output,
 | 
								/* not enough input data remaining for more output,
 | 
				
			||||||
			 * copy to history */
 | 
								 * copy to history */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue