From 15019fc4fb84fef2c50274c6d10907e3a6dd14aa Mon Sep 17 00:00:00 2001 From: Dhananjay Kumar Date: Wed, 8 Jul 2015 21:36:24 +0530 Subject: 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 --- media/libeffects/downmix/EffectDownmix.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'media/libeffects') 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 = -- cgit v1.1