diff options
| author | crueter <crueter@eden-emu.dev> | 2025-08-04 04:50:14 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2025-08-04 04:50:14 +0200 |
| commit | 51b170b470ed587f99a7c2a773e4464687f0d07a (patch) | |
| tree | 4c03c510cfb17a5f5d6233df490d78f06dcfa7f7 /externals/oboe/tests/testStreamFramesProcessed.cpp | |
| parent | 04e5e6453875ffa5c79cdb421a29bc19985b1049 (diff) | |
[cmake] refactor: Use CPM over submodules (#143)
Transfers the majority of submodules and large externals to CPM, using source archives rather than full Git clones. Not only does this save massive amounts of clone and configure time, but dependencies are grabbed on-demand rather than being required by default. Additionally, CPM will (generally) automatically search for system dependencies, though certain dependencies have options to control this.
Testing shows gains ranging from 5x to 10x in terms of overall clone/configure time.
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/143
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Diffstat (limited to 'externals/oboe/tests/testStreamFramesProcessed.cpp')
| -rw-r--r-- | externals/oboe/tests/testStreamFramesProcessed.cpp | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/externals/oboe/tests/testStreamFramesProcessed.cpp b/externals/oboe/tests/testStreamFramesProcessed.cpp deleted file mode 100644 index 083db6a064..0000000000 --- a/externals/oboe/tests/testStreamFramesProcessed.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <gtest/gtest.h> -#include <oboe/Oboe.h> - -#include <tuple> - -using namespace oboe; - -class FramesProcessedCallback : public AudioStreamDataCallback { -public: - DataCallbackResult onAudioReady(AudioStream *oboeStream, void *audioData, int32_t numFrames) override { - return DataCallbackResult::Continue; - } -}; - -using StreamFramesProcessedParams = std::tuple<Direction, int32_t, bool>; - -class StreamFramesProcessed : public ::testing::Test, - public ::testing::WithParamInterface<StreamFramesProcessedParams> { - -protected: - void TearDown() override; - - static constexpr int PROCESS_TIME_SECONDS = 5; - - AudioStreamBuilder mBuilder; - std::shared_ptr<AudioStream> mStream; -}; - -void StreamFramesProcessed::TearDown() { - if (mStream) { - mStream->close(); - } -} - -TEST_P(StreamFramesProcessed, VerifyFramesProcessed) { - const Direction direction = std::get<0>(GetParam()); - const int32_t sampleRate = std::get<1>(GetParam()); - const bool useOboeSampleRateConversion = std::get<2>(GetParam()); - - SampleRateConversionQuality srcQuality = useOboeSampleRateConversion ? - SampleRateConversionQuality::Medium : SampleRateConversionQuality::None; - - AudioStreamDataCallback *callback = new FramesProcessedCallback(); - mBuilder.setDirection(direction) - ->setFormat(AudioFormat::I16) - ->setSampleRate(sampleRate) - ->setSampleRateConversionQuality(srcQuality) - ->setPerformanceMode(PerformanceMode::LowLatency) - ->setSharingMode(SharingMode::Exclusive) - ->setDataCallback(callback); - Result r = mBuilder.openStream(mStream); - ASSERT_EQ(r, Result::OK) << "Failed to open stream." << convertToText(r); - - r = mStream->start(); - ASSERT_EQ(r, Result::OK) << "Failed to start stream." << convertToText(r); - sleep(PROCESS_TIME_SECONDS); - - // The frames written should be close to sampleRate * PROCESS_TIME_SECONDS - const int kDeltaFramesWindowInFrames = 30000; - const int64_t framesWritten = mStream->getFramesWritten(); - const int64_t framesRead = mStream->getFramesRead(); - EXPECT_NEAR(framesWritten, sampleRate * PROCESS_TIME_SECONDS, kDeltaFramesWindowInFrames); - EXPECT_NEAR(framesRead, sampleRate * PROCESS_TIME_SECONDS, kDeltaFramesWindowInFrames); -} - -INSTANTIATE_TEST_CASE_P( - StreamFramesProcessedTest, - StreamFramesProcessed, - ::testing::Values( - StreamFramesProcessedParams({Direction::Output, 8000, true}), - StreamFramesProcessedParams({Direction::Output, 44100, true}), - StreamFramesProcessedParams({Direction::Output, 96000, true}), - StreamFramesProcessedParams({Direction::Input, 8000, true}), - StreamFramesProcessedParams({Direction::Input, 44100, true}), - StreamFramesProcessedParams({Direction::Input, 96000, true}), - StreamFramesProcessedParams({Direction::Output, 8000, false}), - StreamFramesProcessedParams({Direction::Output, 44100, false}), - StreamFramesProcessedParams({Direction::Output, 96000, false}), - StreamFramesProcessedParams({Direction::Input, 8000, false}), - StreamFramesProcessedParams({Direction::Input, 44100, false}), - StreamFramesProcessedParams({Direction::Input, 96000, false}) - ) - ); |
