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

Commit a3d48477 authored by Shraddha Basantwani's avatar Shraddha Basantwani
Browse files

Audio Effect : Add checks to validate the channel count

Bug: 302036943
Test: atest audioeffect_analysis
Change-Id: Ic64394e646fa23e02e499c2f01ef3bd4490450d2
parent 5df990f7
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -46,6 +46,14 @@ class EffectContext {
        LOG_ALWAYS_FATAL_IF(output.base.format.pcm !=
                                    aidl::android::media::audio::common::PcmType::FLOAT_32_BIT,
                            "outputFormatNotFloat");

        size_t inputChannelCount =
                ::aidl::android::hardware::audio::common::getChannelCount(input.base.channelMask);
        LOG_ALWAYS_FATAL_IF(inputChannelCount == 0, "inputChannelCountNotValid");
        size_t outputChannelCount =
                ::aidl::android::hardware::audio::common::getChannelCount(output.base.channelMask);
        LOG_ALWAYS_FATAL_IF(outputChannelCount == 0, "outputChannelCountNotValid");

        mInputFrameSize = ::aidl::android::hardware::audio::common::getFrameSizeInBytes(
                input.base.format, input.base.channelMask);
        mOutputFrameSize = ::aidl::android::hardware::audio::common::getFrameSizeInBytes(