aaudio: disconnect when onTearDown() called
It will be called, for example, when switching from speaker to Bluetooth.
Bug: 62883778
Test: run a long app and switch to or from Bluetooth
Change-Id: Iafb9b52d85c30fee71de46abfb99a27a1daabf59
diff --git a/services/oboeservice/AAudioServiceStreamShared.cpp b/services/oboeservice/AAudioServiceStreamShared.cpp
index 7475692..1978ddd 100644
--- a/services/oboeservice/AAudioServiceStreamShared.cpp
+++ b/services/oboeservice/AAudioServiceStreamShared.cpp
@@ -202,7 +202,7 @@
aaudio_result_t result = endpoint->startStream(this);
if (result != AAUDIO_OK) {
ALOGE("AAudioServiceStreamShared::start() mServiceEndpoint returned %d", result);
- processFatalError();
+ disconnect();
} else {
result = AAudioServiceStreamBase::start();
}
@@ -222,7 +222,7 @@
aaudio_result_t result = endpoint->stopStream(this);
if (result != AAUDIO_OK) {
ALOGE("AAudioServiceStreamShared::pause() mServiceEndpoint returned %d", result);
- processFatalError();
+ disconnect(); // TODO should we return or pause Base first?
}
return AAudioServiceStreamBase::pause();
}
@@ -235,7 +235,7 @@
aaudio_result_t result = endpoint->stopStream(this);
if (result != AAUDIO_OK) {
ALOGE("AAudioServiceStreamShared::stop() mServiceEndpoint returned %d", result);
- processFatalError();
+ disconnect();
}
return AAudioServiceStreamBase::stop();
}
@@ -293,10 +293,6 @@
void AAudioServiceStreamShared::onStop() {
}
-void AAudioServiceStreamShared::onDisconnect() {
- processFatalError();
-}
-
void AAudioServiceStreamShared::markTransferTime(int64_t nanoseconds) {
mMarkedPosition = mAudioDataQueue->getFifoBuffer()->getReadCounter();
mMarkedTime = nanoseconds;