Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c773ab20 authored by Dhananjay Kumar's avatar Dhananjay Kumar Committed by Steve Kondik
Browse files

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
parent 4b484872
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -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 =