Merge "aaudio: fix command thread busy loop."
diff --git a/services/oboeservice/AAudioServiceStreamBase.cpp b/services/oboeservice/AAudioServiceStreamBase.cpp
index 9f48f80..f4ee84f 100644
--- a/services/oboeservice/AAudioServiceStreamBase.cpp
+++ b/services/oboeservice/AAudioServiceStreamBase.cpp
@@ -435,7 +435,15 @@
}
}
if (isIdle_l() && AudioClock::getNanoseconds() >= standbyTime) {
- standby_l();
+ aaudio_result_t result = standby_l();
+ if (result != AAUDIO_OK) {
+ // If standby failed because of the function is not implemented, there is no
+ // need to retry. Otherwise, retry standby later.
+ ALOGW("Failed to enter standby, error=%d", result);
+ standbyTime = result == AAUDIO_ERROR_UNIMPLEMENTED
+ ? std::numeric_limits<int64_t>::max()
+ : AudioClock::getNanoseconds() + IDLE_TIMEOUT_NANOS;
+ }
}
if (command != nullptr) {
diff --git a/services/oboeservice/AAudioServiceStreamBase.h b/services/oboeservice/AAudioServiceStreamBase.h
index b2ba725..b5f8b90 100644
--- a/services/oboeservice/AAudioServiceStreamBase.h
+++ b/services/oboeservice/AAudioServiceStreamBase.h
@@ -320,7 +320,7 @@
}
virtual aaudio_result_t standby_l() REQUIRES(mLock) {
- return AAUDIO_ERROR_UNAVAILABLE;
+ return AAUDIO_ERROR_UNIMPLEMENTED;
}
class ExitStandbyParam : public AAudioCommandParam {
public: