Skip to content

Commit

Permalink
Unit Tests: Test no sample rate conversion in TestStreamFrameProcessed (
Browse files Browse the repository at this point in the history
  • Loading branch information
robertwu1 authored Jul 24, 2024
1 parent 7f9b882 commit 907c35a
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions tests/testStreamFramesProcessed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class FramesProcessedCallback : public AudioStreamDataCallback {
}
};

using StreamFramesProcessedParams = std::tuple<Direction, int32_t>;
using StreamFramesProcessedParams = std::tuple<Direction, int32_t, bool>;

class StreamFramesProcessed : public ::testing::Test,
public ::testing::WithParamInterface<StreamFramesProcessedParams> {
Expand All @@ -51,12 +51,16 @@ void StreamFramesProcessed::TearDown() {
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(SampleRateConversionQuality::Medium)
->setSampleRateConversionQuality(srcQuality)
->setPerformanceMode(PerformanceMode::LowLatency)
->setSharingMode(SharingMode::Exclusive)
->setDataCallback(callback);
Expand All @@ -79,11 +83,17 @@ INSTANTIATE_TEST_CASE_P(
StreamFramesProcessedTest,
StreamFramesProcessed,
::testing::Values(
StreamFramesProcessedParams({Direction::Output, 8000}),
StreamFramesProcessedParams({Direction::Output, 44100}),
StreamFramesProcessedParams({Direction::Output, 96000}),
StreamFramesProcessedParams({Direction::Input, 8000}),
StreamFramesProcessedParams({Direction::Input, 44100}),
StreamFramesProcessedParams({Direction::Input, 96000})
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})
)
);

0 comments on commit 907c35a

Please sign in to comment.