From 4c2852e297aa488fb5f941d011251bdb265b1c9c Mon Sep 17 00:00:00 2001 From: Robert Wu <85952307+robertwu1@users.noreply.github.com> Date: Mon, 1 Aug 2022 08:58:51 -0700 Subject: [PATCH] Fix getBufferSizeInFrames --- src/opensles/AudioStreamBuffered.cpp | 2 ++ tests/testStreamOpen.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/opensles/AudioStreamBuffered.cpp b/src/opensles/AudioStreamBuffered.cpp index bf37fedd8..e55e9bd2b 100644 --- a/src/opensles/AudioStreamBuffered.cpp +++ b/src/opensles/AudioStreamBuffered.cpp @@ -18,6 +18,7 @@ #include "oboe/Oboe.h" +#include "common/OboeDebug.h" #include "opensles/AudioStreamBuffered.h" #include "common/AudioClock.h" @@ -57,6 +58,7 @@ void AudioStreamBuffered::allocateFifo() { mFifoBuffer = std::make_unique(getBytesPerFrame(), capacityFrames); mBufferCapacityInFrames = capacityFrames; + mBufferSizeInFrames = mBufferCapacityInFrames; } } diff --git a/tests/testStreamOpen.cpp b/tests/testStreamOpen.cpp index 95c65c79e..185fbfeed 100644 --- a/tests/testStreamOpen.cpp +++ b/tests/testStreamOpen.cpp @@ -432,3 +432,11 @@ TEST_F(StreamOpenInput, AAudioInputSetAttributionTag){ ASSERT_TRUE(closeStream()); } } + +TEST_F(StreamOpenOutput, OutputForOpenSLESPerformanceModeNoneGetBufferSizeInFrames){ + mBuilder.setPerformanceMode(PerformanceMode::None); + mBuilder.setAudioApi(AudioApi::OpenSLES); + ASSERT_TRUE(openStream()); + EXPECT_GT(mStream->getBufferSizeInFrames(), 0); + ASSERT_TRUE(closeStream()); +}