aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cubeb_mixer.cpp
diff options
context:
space:
mode:
authorChun-Min Chang <[email protected]>2017-05-05 15:25:08 +0800
committerMatthew Gregan <[email protected]>2017-05-05 19:29:05 +1200
commit26a50b08889a16d3f1e7fe05845cc107c7553f70 (patch)
tree92a8bcc5b60f8885c009669430e7270a3633d469 /src/cubeb_mixer.cpp
parent45c7ffca19f0bd43ee03e84a6d641a1b2a410793 (diff)
downloadcubeb-26a50b08889a16d3f1e7fe05845cc107c7553f70.tar.gz
cubeb-26a50b08889a16d3f1e7fe05845cc107c7553f70.zip
Do not mix audio when no frames come
Diffstat (limited to 'src/cubeb_mixer.cpp')
-rw-r--r--src/cubeb_mixer.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/cubeb_mixer.cpp b/src/cubeb_mixer.cpp
index 1e64071..573c194 100644
--- a/src/cubeb_mixer.cpp
+++ b/src/cubeb_mixer.cpp
@@ -359,7 +359,8 @@ cubeb_downmix(T const * const in, long inframes, T * out,
cubeb_stream_params const * stream_params,
cubeb_stream_params const * mixer_params)
{
- assert(in && out && inframes);
+ assert(in && out);
+ assert(inframes);
assert(stream_params->channels >= mixer_params->channels &&
mixer_params->channels > 0);
assert(stream_params->layout != CUBEB_LAYOUT_UNDEFINED);
@@ -407,8 +408,9 @@ cubeb_upmix(T const * in, long inframes, T * out,
cubeb_stream_params const * stream_params,
cubeb_stream_params const * mixer_params)
{
- assert(in && out && inframes &&
- mixer_params->channels >= stream_params->channels &&
+ assert(in && out);
+ assert(inframes);
+ assert(mixer_params->channels >= stream_params->channels &&
stream_params->channels > 0);
unsigned int in_channels = stream_params->channels;
@@ -486,6 +488,10 @@ struct cubeb_mixer_impl : public cubeb_mixer {
cubeb_stream_params const * stream_params,
cubeb_stream_params const * mixer_params)
{
+ if (frames <= 0) {
+ return;
+ }
+
T * in = static_cast<T*>(input_buffer);
T * out = static_cast<T*>(output_buffer);