aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cubeb_resampler.cpp
diff options
context:
space:
mode:
authorPaul Adenot <[email protected]>2016-03-07 15:17:51 +0100
committerPaul Adenot <[email protected]>2016-03-07 15:17:51 +0100
commit414888142db2865b43d4150ce2ffd76258c34055 (patch)
tree3cd606fd33eebbe2c29681fe8980ae003bad076b /src/cubeb_resampler.cpp
parent9c2765f645bc1b419c61b50a751effc786dfea6f (diff)
downloadcubeb-414888142db2865b43d4150ce2ffd76258c34055.tar.gz
cubeb-414888142db2865b43d4150ce2ffd76258c34055.zip
Make the noop_resampler work in output-only mode, by null-checking the pointers.
Diffstat (limited to 'src/cubeb_resampler.cpp')
-rw-r--r--src/cubeb_resampler.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cubeb_resampler.cpp b/src/cubeb_resampler.cpp
index c683422..6e0c78a 100644
--- a/src/cubeb_resampler.cpp
+++ b/src/cubeb_resampler.cpp
@@ -59,10 +59,14 @@ long noop_resampler::fill(void * input_buffer, long * input_frames_count,
{
assert(input_buffer && output_buffer &&
*input_frames_count >= output_frames ||
- !input_buffer && input_frames_count == 0 ||
- !output_buffer && output_frames== 0);
+ !input_buffer && !input_frames_count ||
+ !output_buffer && output_frames == 0);
- if (*input_frames_count != output_frames) {
+ if (output_buffer == nullptr) {
+ output_frames = *input_frames_count;
+ }
+
+ if (input_buffer && *input_frames_count != output_frames) {
assert(*input_frames_count > output_frames);
*input_frames_count = output_frames;
}