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

Commit a5247769 authored by Phil Burk's avatar Phil Burk
Browse files

aaudio: return channelCount in legacy stream

Bug: 63336407
Test: Use input_monitor.cpp and set requested channel count to zero
Change-Id: Ibe7688bb94e0142ee0779c74ddec62c9552efb79
parent d51329ec
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ aaudio_result_t AudioStreamRecord::open(const AudioStreamBuilder& builder)

    // Try to create an AudioRecord

    // TODO Support UNSPECIFIED in AudioTrack. For now, use stereo if unspecified.
    // TODO Support UNSPECIFIED in AudioRecord. For now, use stereo if unspecified.
    int32_t samplesPerFrame = (getSamplesPerFrame() == AAUDIO_UNSPECIFIED)
                              ? 2 : getSamplesPerFrame();
    audio_channel_mask_t channelMask = audio_channel_in_mask_from_count(samplesPerFrame);
@@ -130,8 +130,8 @@ aaudio_result_t AudioStreamRecord::open(const AudioStreamBuilder& builder)
        return AAudioConvert_androidToAAudioResult(status);
    }

    // Get the actual rate.
    setSampleRate(mAudioRecord->getSampleRate());
    // Get the actual values from the AudioRecord.
    setSamplesPerFrame(mAudioRecord->channelCount());
    setFormat(AAudioConvert_androidToAAudioDataFormat(mAudioRecord->format()));

    int32_t actualSampleRate = mAudioRecord->getSampleRate();