OboeTester: count short reads when locked
Increment glitch count.
diff --git a/apps/OboeTester/app/src/main/cpp/FullDuplexAnalyzer.cpp b/apps/OboeTester/app/src/main/cpp/FullDuplexAnalyzer.cpp
index 7b865a4..e7a91c1 100644
--- a/apps/OboeTester/app/src/main/cpp/FullDuplexAnalyzer.cpp
+++ b/apps/OboeTester/app/src/main/cpp/FullDuplexAnalyzer.cpp
@@ -37,7 +37,7 @@
if (numInputFrames < numOutputFrames) {
LOGD("numInputFrames (%4d) < numOutputFrames (%4d) so reset analyzer",
numInputFrames, numOutputFrames);
- getLoopbackProcessor()->reset();
+ getLoopbackProcessor()->onInsufficientRead();
} else {
float *inputFloat = (float *) inputData;
float *outputFloat = (float *) outputData;
diff --git a/apps/OboeTester/app/src/main/cpp/LatencyAnalyzer.h b/apps/OboeTester/app/src/main/cpp/LatencyAnalyzer.h
index d59da0b..12cd06b 100644
--- a/apps/OboeTester/app/src/main/cpp/LatencyAnalyzer.h
+++ b/apps/OboeTester/app/src/main/cpp/LatencyAnalyzer.h
@@ -405,6 +405,12 @@
return mResetCount;
}
+ /** Called when not enough input frames could be read after synchronization.
+ */
+ virtual void onInsufficientRead() {
+ reset();
+ }
+
protected:
int32_t mResetCount = 0;
@@ -1012,6 +1018,13 @@
resetAccumulator();
}
+ void onInsufficientRead() override {
+ if (mState == STATE_LOCKED) {
+ mGlitchCount++;
+ }
+ LoopbackProcessor::onInsufficientRead();
+ }
+
// reset the sine wave detector
void resetAccumulator() {
mFramesAccumulated = 0;
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/GlitchActivity.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/GlitchActivity.java
index f85a1c1..bb8a8bf 100644
--- a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/GlitchActivity.java
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/GlitchActivity.java
@@ -134,7 +134,7 @@
int lockedFrames = getStateFrameCount(STATE_LOCKED);
int glitchFrames = getStateFrameCount(STATE_GLITCHING);
- if (glitchFrames > mLastGlitchFrames) {
+ if (glitchFrames > mLastGlitchFrames || glitchCount > mLastGlitchCount) {
mTimeOfLastGlitch = now;
mSecondsWithoutGlitches = 0.0;
} else if (lockedFrames > mLastLockedFrames) {
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/ManualGlitchActivity.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/ManualGlitchActivity.java
index b702916..936ea5d 100644
--- a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/ManualGlitchActivity.java
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/ManualGlitchActivity.java
@@ -132,9 +132,7 @@
configureStreamsFromBundle(mBundleFromIntent);
int durationSeconds = mBundleFromIntent.getInt("duration", 10);
-
int numBursts = mBundleFromIntent.getInt("buffer_bursts", 2);
-
mBundleFromIntent = null;
onStartAudioTest(null);