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

Commit 0078c7cc authored by Eric Laurent's avatar Eric Laurent
Browse files

AudioSystem JNI: fix audio gain channel count

Use audio utility function instead of popcount
to get channel count from channel mask

Bug: 14815883.
Change-Id: Ia9a898c9f7f03d22caeefb418be1e33f65f7b7bb
parent e205192c
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -613,8 +613,12 @@ static jint convertAudioPortConfigFromNative(JNIEnv *env,
                goto exit;
            }
        }
        //TODO: replace popcount by audio utils function mask to count
        int numValues = popcount(nAudioPortConfig->gain.channel_mask);
        int numValues;
        if (useInMask) {
            numValues = audio_channel_count_from_in_mask(nAudioPortConfig->gain.channel_mask);
        } else {
            numValues = audio_channel_count_from_out_mask(nAudioPortConfig->gain.channel_mask);
        }
        jGainValues = env->NewIntArray(numValues);
        if (jGainValues == NULL) {
            ALOGV("convertAudioPortConfigFromNative could not create gain values %d", numValues);