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

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

Merge "AAudio: Add min number of bursts for SRC" into main

parents 1ce43472 6688049d
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -64,6 +64,9 @@ using namespace aaudio;

#define LOG_TIMESTAMPS            0

// Minimum number of bursts to use when sample rate conversion is used.
#define MIN_SAMPLE_RATE_CONVERSION_NUM_BURSTS    3

AudioStreamInternal::AudioStreamInternal(AAudioServiceInterface  &serviceInterface, bool inService)
        : AudioStream()
        , mClockModel()
@@ -910,6 +913,12 @@ aaudio_result_t AudioStreamInternal::setBufferSize(int32_t requestedFrames) {
        numBursts = 1;
    }

    // Set a minimum number of bursts if sample rate conversion is used.
    if ((getSampleRate() != getDeviceSampleRate()) &&
            (numBursts < MIN_SAMPLE_RATE_CONVERSION_NUM_BURSTS)) {
        numBursts = MIN_SAMPLE_RATE_CONVERSION_NUM_BURSTS;
    }

    if (mAudioEndpoint) {
        // Clip against the actual size from the endpoint.
        int32_t actualFramesDevice = 0;