aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Burk <philburk@mobileer.com>2020-11-24 10:39:24 -0800
committerPhil Burk <philburk@mobileer.com>2020-11-24 11:02:51 -0800
commit32d36e3dd10d7ff4c3e39fcc0fd6b6c03e556322 (patch)
tree7e86130c687f9735a0bce6f79d87a654391ce2c9
parent736c08a68b68c651a4abedb0239e572cd7df8930 (diff)
downloadoboe-32d36e3dd10d7ff4c3e39fcc0fd6b6c03e556322.tar.gz
oboe: workaround disconnect bug in RQ1A
Coerce the ErrorTimeout to ErrorDisconnected if R. This is to fix b/173928197 This can prevent apps that were looking specifically for the ErrorDisconnected from failing to restart their streams.
-rw-r--r--src/aaudio/AudioStreamAAudio.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/aaudio/AudioStreamAAudio.cpp b/src/aaudio/AudioStreamAAudio.cpp
index 58b8bc8f..cb817623 100644
--- a/src/aaudio/AudioStreamAAudio.cpp
+++ b/src/aaudio/AudioStreamAAudio.cpp
@@ -113,6 +113,16 @@ void AudioStreamAAudio::internalErrorCallback(
aaudio_result_t error) {
oboe::Result oboeResult = static_cast<Result>(error);
AudioStreamAAudio *oboeStream = reinterpret_cast<AudioStreamAAudio*>(userData);
+
+ // Coerce the error code if needed to workaround a regression in RQ1A that caused
+ // the wrong code to be passed when headsets plugged in. See b/173928197.
+ if (OboeGlobals::areWorkaroundsEnabled()
+ && getSdkVersion() == __ANDROID_API_R__
+ && oboeResult == oboe::Result::ErrorTimeout) {
+ oboeResult = oboe::Result::ErrorDisconnected;
+ LOGD("%s() ErrorTimeout changed to ErrorDisconnected to fix b/173928197", __func__);
+ }
+
oboeStream->mErrorCallbackResult = oboeResult;
// Prevents deletion of the stream if the app is using AudioStreamBuilder::openStream(shared_ptr)