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

Commit 3e3a1a8f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "AAudio: Avoid scaling capacity with sample rate" into main

parents cf85dd5d 9b70ca24
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -134,7 +134,12 @@ aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) {
    request.getConfiguration().setInputPreset(getInputPreset());
    request.getConfiguration().setPrivacySensitive(isPrivacySensitive());

    request.getConfiguration().setBufferCapacity(builder.getBufferCapacity());
    // When sample rate conversion is needed, we use the device sample rate instead of the
    // requested sample rate to scale the capacity in configureDataInformation().
    // Thus, we should scale the capacity here to cancel out the (sampleRate / deviceSampleRate)
    // scaling there.
    request.getConfiguration().setBufferCapacity(builder.getBufferCapacity()
            * 48000 / getSampleRate());

    mServiceStreamHandleInfo = mServiceInterface.openStream(request, configurationOutput);
    if (getServiceHandle() < 0