summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhananjay Kumar <dhakumar@codeaurora.org>2015-07-08 21:36:24 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:24:32 -0600
commit15019fc4fb84fef2c50274c6d10907e3a6dd14aa (patch)
tree7973666ee3fee7719b113f92e315685e5745e82a
parent0fe8e5c7968a472bb69c4d5c81c20294a02435a8 (diff)
downloadframeworks_av-15019fc4fb84fef2c50274c6d10907e3a6dd14aa.zip
frameworks_av-15019fc4fb84fef2c50274c6d10907e3a6dd14aa.tar.gz
frameworks_av-15019fc4fb84fef2c50274c6d10907e3a6dd14aa.tar.bz2
libeffects: validate channel mask in downmixer configure
Validate channel mask in downmixer configure, this returns early warning to calling module which can fallback to another downmixing module or return error instead of playing improper data. CRs-Fixed: 862105 Change-Id: Ic19c4913608468d5c5197f65bb5d6a640c9d2d74
-rw-r--r--media/libeffects/downmix/EffectDownmix.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/media/libeffects/downmix/EffectDownmix.c b/media/libeffects/downmix/EffectDownmix.c
index 4a41037..18059b2 100644
--- a/media/libeffects/downmix/EffectDownmix.c
+++ b/media/libeffects/downmix/EffectDownmix.c
@@ -624,9 +624,12 @@ int Downmix_Configure(downmix_module_t *pDwmModule, effect_config_t *pConfig, bo
pDownmixer->apply_volume_correction = false;
pDownmixer->input_channel_count = 8; // matches default input of AUDIO_CHANNEL_OUT_7POINT1
} else {
- // when configuring the effect, do not allow a blank channel mask
- if (pConfig->inputCfg.channels == 0) {
- ALOGE("Downmix_Configure error: input channel mask can't be 0");
+ // when configuring the effect, do not allow a blank or unsupported channel mask
+ if ((pConfig->inputCfg.channels == 0) ||
+ (Downmix_foldGeneric(pConfig->inputCfg.channels,
+ NULL, NULL, 0, false) == false)) {
+ ALOGE("Downmix_Configure error: input channel mask(0x%x) not supported",
+ pConfig->inputCfg.channels);
return -EINVAL;
}
pDownmixer->input_channel_count =