aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cubeb_resampler_internal.h
diff options
context:
space:
mode:
authorPaul Adenot <[email protected]>2020-08-04 15:33:50 +0200
committerPaul Adenot <[email protected]>2020-09-09 14:30:03 +0200
commit51f413eac684a89780cfde6a0f44a4c687a433dd (patch)
treec9d94f45aafd4dbcd040905fed4c0733450082df /src/cubeb_resampler_internal.h
parent7b1782b3ea354ea3911b1e45f17380b70ab650f9 (diff)
downloadcubeb-51f413eac684a89780cfde6a0f44a4c687a433dd.tar.gz
cubeb-51f413eac684a89780cfde6a0f44a4c687a433dd.zip
Don't account for unresampled data when computing how much input is needed.
Diffstat (limited to 'src/cubeb_resampler_internal.h')
-rw-r--r--src/cubeb_resampler_internal.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/cubeb_resampler_internal.h b/src/cubeb_resampler_internal.h
index 4ccd9e3..a81811b 100644
--- a/src/cubeb_resampler_internal.h
+++ b/src/cubeb_resampler_internal.h
@@ -309,11 +309,9 @@ public:
uint32_t input_needed_for_output(int32_t output_frame_count) const
{
assert(output_frame_count >= 0); // Check overflow
- int32_t unresampled_frames_left = samples_to_frames(resampling_in_buffer.length());
int32_t resampled_frames_left = samples_to_frames(resampling_out_buffer.length());
- float input_frames_needed =
- (output_frame_count - unresampled_frames_left) * resampling_ratio
- - resampled_frames_left;
+ float input_frames_needed =
+ output_frame_count * resampling_ratio - resampled_frames_left;
if (input_frames_needed < 0) {
return 0;
}