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

Coerce positive error from open() to negative code #1711

Merged
merged 2 commits into from
Feb 21, 2023
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
4 changes: 2 additions & 2 deletions apps/OboeTester/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId = "com.mobileer.oboetester"
minSdkVersion 23
targetSdkVersion 33
versionCode 65
versionName "2.3.6"
versionCode 66
versionName "2.3.7"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
Expand Down
2 changes: 1 addition & 1 deletion include/oboe/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#define OBOE_VERSION_MINOR 7

// Type: 16-bit unsigned int. Min value: 0 Max value: 65535. See below for description.
#define OBOE_VERSION_PATCH 1
#define OBOE_VERSION_PATCH 2

#define OBOE_STRINGIFY(x) #x
#define OBOE_TOSTRING(x) OBOE_STRINGIFY(x)
Expand Down
14 changes: 12 additions & 2 deletions src/aaudio/AudioStreamAAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,18 @@ Result AudioStreamAAudio::open() {

error2:
mLibLoader->builder_delete(aaudioBuilder);
LOGD("AudioStreamAAudio.open: AAudioStream_Open() returned %s",
mLibLoader->convertResultToText(static_cast<aaudio_result_t>(result)));
if (static_cast<int>(result) > 0) {
// Possibly due to b/267531411
LOGW("AudioStreamAAudio.open: AAudioStream_Open() returned positive error = %d",
static_cast<int>(result));
if (OboeGlobals::areWorkaroundsEnabled()) {
result = Result::ErrorInternal; // Coerce to negative error.
}
} else {
LOGD("AudioStreamAAudio.open: AAudioStream_Open() returned %s = %d",
mLibLoader->convertResultToText(static_cast<aaudio_result_t>(result)),
static_cast<int>(result));
}
return result;
}

Expand Down