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

Commit 9898f37e authored by Jiabin Huang's avatar Jiabin Huang Committed by Android (Google) Code Review
Browse files

Merge "Count channel mapping number from the back." into sc-dev

parents 33b849c0 5f82f49d
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -66,13 +66,13 @@ status_t CoreUtils::microphoneInfoFromHal(
    CONVERT_CHECKED(
            deviceAddressFromHal(halMicInfo.device, halMicInfo.address, &micInfo->deviceAddress),
            result);
    size_t chCount;
    for (chCount = 0; chCount < AUDIO_CHANNEL_COUNT_MAX; ++chCount) {
        if (halMicInfo.channel_mapping[chCount] == AUDIO_MICROPHONE_CHANNEL_MAPPING_UNUSED) {
    int chCount;
    for (chCount = AUDIO_CHANNEL_COUNT_MAX - 1; chCount >= 0; --chCount) {
        if (halMicInfo.channel_mapping[chCount] != AUDIO_MICROPHONE_CHANNEL_MAPPING_UNUSED) {
            break;
        }
    }
    micInfo->channelMapping.resize(chCount);
    micInfo->channelMapping.resize(chCount + 1);
    for (size_t ch = 0; ch < micInfo->channelMapping.size(); ch++) {
        micInfo->channelMapping[ch] = AudioMicrophoneChannelMapping(halMicInfo.channel_mapping[ch]);
    }