aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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));