aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cubeb_resampler.cpp
diff options
context:
space:
mode:
authorRyan Hileman <[email protected]>2021-06-16 05:33:22 -0700
committerMatthew Gregan <[email protected]>2021-07-06 17:32:01 +1200
commitcf7636f17c1847937f1c35be890bab45188d6eaa (patch)
treed71215b620828e26a4fd93bfb4b48b5cb400ba58 /src/cubeb_resampler.cpp
parent275de804d1abea9136d6e86eda54344293c08c09 (diff)
downloadcubeb-cf7636f17c1847937f1c35be890bab45188d6eaa.tar.gz
cubeb-cf7636f17c1847937f1c35be890bab45188d6eaa.zip
don't run resampler unless we have enough frames
(fixes #647)
Diffstat (limited to 'src/cubeb_resampler.cpp')
-rw-r--r--src/cubeb_resampler.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cubeb_resampler.cpp b/src/cubeb_resampler.cpp
index 29ad736..b7bddfe 100644
--- a/src/cubeb_resampler.cpp
+++ b/src/cubeb_resampler.cpp
@@ -222,6 +222,12 @@ cubeb_resampler_speex<T, InputProcessor, OutputProcessor>
* callback. */
input_processor->input(input_buffer, *input_frames_count);
+ /* resampled_frame_count == 0 happens if the resampler
+ * doesn't have enough input frames buffered to produce 1 resampled frame. */
+ if (resampled_frame_count == 0) {
+ return *input_frames_count;
+ }
+
size_t frames_resampled = 0;
resampled_input = input_processor->output(resampled_frame_count, &frames_resampled);
*input_frames_count = frames_resampled;