aaudio: do not assert if deleting an unopened stream
Bug: 63440754
Test: write_sine.cpp, see bug for repro case
Change-Id: I1f7ed1bd97d4cfcd54d27d41d708c6c03d3d88ac
diff --git a/services/oboeservice/AAudioServiceStreamBase.cpp b/services/oboeservice/AAudioServiceStreamBase.cpp
index 2e20287..52b1801 100644
--- a/services/oboeservice/AAudioServiceStreamBase.cpp
+++ b/services/oboeservice/AAudioServiceStreamBase.cpp
@@ -42,10 +42,11 @@
AAudioServiceStreamBase::~AAudioServiceStreamBase() {
ALOGD("AAudioServiceStreamBase::~AAudioServiceStreamBase() destroying %p", this);
- // If the stream is deleted without closing then audio resources will leak.
- // Not being closed here would indicate an internal error. So we want to find this ASAP.
- LOG_ALWAYS_FATAL_IF(mState != AAUDIO_STREAM_STATE_CLOSED,
- "service stream not closed, state = %d", mState);
+ // If the stream is deleted when OPEN or in use then audio resources will leak.
+ // This would indicate an internal error. So we want to find this ASAP.
+ LOG_ALWAYS_FATAL_IF(!(mState == AAUDIO_STREAM_STATE_CLOSED
+ || mState == AAUDIO_STREAM_STATE_UNINITIALIZED),
+ "service stream still open, state = %d", mState);
}
std::string AAudioServiceStreamBase::dump() const {