Skip to content

Commit

Permalink
Cleaned up Data Paths
Browse files Browse the repository at this point in the history
Addressed comments.
  • Loading branch information
philburk committed Feb 23, 2024
1 parent 8143831 commit b67d11e
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 204 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public void run() {
mFailCount = 0;
try {
mActivity.runTest();
log("Tests finished without exception.");
log("Tests finished.");
} catch(Exception e) {
log("EXCEPTION: " + e.getMessage());
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import android.media.AudioManager;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.io.IOException;
Expand Down Expand Up @@ -307,7 +306,7 @@ protected TestResult testCurrentConfigurations() throws InterruptedException {
);

// The test will only be worth running if we got the configuration we requested on input or output.
String skipReason = shouldTestBeSkipped();
String skipReason = whyShouldTestBeSkipped();
boolean skipped = skipReason.length() > 0;
boolean valid = !openFailed && !skipped;
boolean startFailed = false;
Expand Down Expand Up @@ -413,16 +412,23 @@ protected AudioDeviceInfo getDeviceInfoByType(int deviceType, int flags) {
return null;
}

protected boolean isDeviceTypeMixed(int type) {
/**
* Are outputs mixed in the air or by a loopback plug?
* @param type device type, eg AudioDeviceInfo.TYPE_BUILTIN_SPEAKER
* @return true if stereo output channels get mixed to mono input
*/
protected boolean isDeviceTypeMixedForLoopback(int type) {
switch(type) {
// Mixed in the air.
case AudioDeviceInfo.TYPE_BUILTIN_SPEAKER:
case AudioDeviceInfo.TYPE_BUILTIN_SPEAKER_SAFE:
// Mixed in the loopback fun-plug.
case AudioDeviceInfo.TYPE_WIRED_HEADSET:
case AudioDeviceInfo.TYPE_USB_HEADSET:
return true;
case AudioDeviceInfo.TYPE_USB_DEVICE:
default:
return false;
return false; // channels are discrete
}
}

Expand Down Expand Up @@ -468,7 +474,12 @@ protected boolean isFinishedEarly() {
return false;
}

protected String shouldTestBeSkipped() {
/**
* Figure out if a test should be skipped and return the reason.
*
* @return reason for skipping or an empty string
*/
protected String whyShouldTestBeSkipped() {
String why = "";
StreamConfiguration requestedInConfig = mAudioInputTester.requestedConfiguration;
StreamConfiguration requestedOutConfig = mAudioOutTester.requestedConfiguration;
Expand Down
Loading

0 comments on commit b67d11e

Please sign in to comment.