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

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

aaudio: use natural burst size for recording

This is similar to ag/12420089
but is for input streams.

BUG: 165675305
Test: see bug for detailed repro steps
Test: atest CtsNativeMediaAAudioTestCases
Change-Id: I9b6dfb4d4e9c22d8aac51f86149d7c3bf29cb990
parent f3a626fa
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -118,6 +118,7 @@ aaudio_result_t AudioStreamRecord::open(const AudioStreamBuilder& builder)
        setDeviceFormat(getFormat());
    }

    // To avoid glitching, let AudioFlinger pick the optimal burst size.
    uint32_t notificationFrames = 0;

    // Setup the callback if there is one.
@@ -128,7 +129,6 @@ aaudio_result_t AudioStreamRecord::open(const AudioStreamBuilder& builder)
        streamTransferType = AudioRecord::transfer_type::TRANSFER_CALLBACK;
        callback = getLegacyCallback();
        callbackData = this;
        notificationFrames = builder.getFramesPerDataCallback();
    }
    mCallbackBufferSize = builder.getFramesPerDataCallback();

+1 −3
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder)

    size_t frameCount = (size_t)builder.getBufferCapacity();

    // To avoid glitching, let AudioFlinger pick the optimal burst size.
    int32_t notificationFrames = 0;

    const audio_format_t format = (getFormat() == AUDIO_FORMAT_DEFAULT)
@@ -118,9 +119,6 @@ aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder)
            // Take advantage of a special trick that allows us to create a buffer
            // that is some multiple of the burst size.
            notificationFrames = 0 - DEFAULT_BURSTS_PER_BUFFER_CAPACITY;
        } else {
            // To avoid glitching, let AudioFlinger pick the optimal burst size.
            notificationFrames = 0;
        }
    }
    mCallbackBufferSize = builder.getFramesPerDataCallback();