Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit Tests: Test no sample rate conversion in TestStreamFrameProcessed #2079

Merged
merged 3 commits into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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})
)
);