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

OboeTester: DataPaths input margin increased from 1 to 3 #2047

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions apps/OboeTester/app/src/main/cpp/FullDuplexAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ oboe::DataCallbackResult FullDuplexAnalyzer::onBothStreamsReadyFloat(
mRecording->write(buffer, 1);
}
// Handle mismatch in numFrames.
buffer[0] = 0.0f; // gap in output
const float gapMarker = -0.9f; // Recognizable value so we can tell underruns from DSP gaps.
buffer[0] = gapMarker; // gap in output
for (int i = numBoth; i < numInputFrames; i++) {
buffer[1] = *inputFloat;
inputFloat += inputStride;
mRecording->write(buffer, 1);
}
buffer[1] = 0.0f; // gap in input
buffer[1] = gapMarker; // gap in input
for (int i = numBoth; i < numOutputFrames; i++) {
buffer[0] = *outputFloat;
outputFloat += outputStride;
Expand Down
5 changes: 4 additions & 1 deletion apps/OboeTester/app/src/main/cpp/FullDuplexAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ class FullDuplexAnalyzer : public FullDuplexStreamWithConversion {
public:
FullDuplexAnalyzer(LoopbackProcessor *processor)
: mLoopbackProcessor(processor) {
setNumInputBurstsCushion(1);
// If we are measuring glitches then we should set this >1 to avoid input underruns.
// Underruns are more common when doing sample rate conversion because of the variable
// callback sizes.
setNumInputBurstsCushion(3);
}

/**
Expand Down