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

Commit e3247bf8 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Update channel fields at same place in AudioTrack and AudioRecord

Change-Id: I4b649feeef47e7968a9fa3a460217017ca9b05fe
parent 11cb1750
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -293,6 +293,9 @@ status_t AudioTrack::set(
        ALOGE("Invalid channel mask %#x", channelMask);
        return BAD_VALUE;
    }
    mChannelMask = channelMask;
    uint32_t channelCount = popcount(channelMask);
    mChannelCount = channelCount;

    // AudioFlinger does not currently support 8-bit data in shared memory
    if (format == AUDIO_FORMAT_PCM_8_BIT && sharedBuffer != 0) {
@@ -316,10 +319,6 @@ status_t AudioTrack::set(
        flags = (audio_output_flags_t)(flags &~AUDIO_OUTPUT_FLAG_DEEP_BUFFER);
    }

    mChannelMask = channelMask;
    uint32_t channelCount = popcount(channelMask);
    mChannelCount = channelCount;

    if (audio_is_linear_pcm(format)) {
        mFrameSize = channelCount * audio_bytes_per_sample(format);
        mFrameSizeAF = channelCount * sizeof(int16_t);