Merge "Audio Effect : Add checks to validate the channel count" into main am: a10d3c536f am: 7f56477a4e

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2902252

Change-Id: I70d23ef5000db3fbdd6e335541e11c60118bd738
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2024-01-10 02:19:46 +00:00
committed by Automerger Merge Worker

View File

@@ -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(