aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVitor Kiguchi <[email protected]>2020-10-14 15:22:23 -0300
committerPaul Adenot <[email protected]>2020-10-20 14:23:23 +0100
commit2575d731d29a55cddd3cc044779c5906a4ed4c3c (patch)
tree69c71e567c1cab103fdde57872845b24d3865f8c
parentc0adf049c22d995e4692bbbe573dfffbfbbdaf69 (diff)
downloadcubeb-2575d731d29a55cddd3cc044779c5906a4ed4c3c.tar.gz
cubeb-2575d731d29a55cddd3cc044779c5906a4ed4c3c.zip
Revert "Don't account for unresampled data when computing how much input is needed."
This reverts commit d0127cdb668fe7908397ba4eaca2dc1e8600fc09. From testing this caused the audio to get out of sync(delayed) in Citra.
-rw-r--r--src/cubeb_resampler_internal.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cubeb_resampler_internal.h b/src/cubeb_resampler_internal.h
index 3e8b097..876d09b 100644
--- a/src/cubeb_resampler_internal.h
+++ b/src/cubeb_resampler_internal.h
@@ -307,9 +307,11 @@ 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 * resampling_ratio - resampled_frames_left;
+ float input_frames_needed =
+ (output_frame_count - unresampled_frames_left) * resampling_ratio
+ - resampled_frames_left;
if (input_frames_needed < 0) {
return 0;
}