aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhil Burk <philburk@mobileer.com>2020-08-24 17:44:02 -0700
committerPhil Burk <philburk@mobileer.com>2020-08-25 09:18:14 -0700
commit69ae87088dfa21a6883a8f4d7e42029a9dd0abb9 (patch)
tree0dabf74b103528bab06e0f9cee5119ce090bdf44 /src
parent2e42f5be523e1a27a23543e15940250dd7df2c78 (diff)
downloadoboe-69ae87088dfa21a6883a8f4d7e42029a9dd0abb9.tar.gz
Use a close delay in all versions of Android
Enable using the Workarounds flag.
Diffstat (limited to 'src')
-rw-r--r--src/aaudio/AudioStreamAAudio.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/aaudio/AudioStreamAAudio.cpp b/src/aaudio/AudioStreamAAudio.cpp
index 83e5da8d..96f0c392 100644
--- a/src/aaudio/AudioStreamAAudio.cpp
+++ b/src/aaudio/AudioStreamAAudio.cpp
@@ -301,8 +301,8 @@ Result AudioStreamAAudio::close() {
// even after a close. If the stream has been closed then the callback
// can access memory that has been freed. That causes a crash.
// Two milliseconds may be enough but 10 msec is even safer.
- // This seems to be less likely in Q but we have seen some reports.
- if (getSdkVersion() <= __ANDROID_API_Q__) {
+ // This seems to be more likely in P or earlier. But it can also occur in later versions.
+ if (OboeGlobals::areWorkaroundsEnabled()) {
usleep(kDelayBeforeCloseMillis * 1000);
}
return static_cast<Result>(mLibLoader->stream_close(stream));