Merge "libaudiohal@aidl: Follow up for callbacks handling" into main am: fdc86e2a5c am: 8d8629854d
Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/3037682
Change-Id: I2d5ff1e4cadc011fe0f78a0e9b3583f4b8ffc2cc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/media/libaudiohal/impl/StreamHalAidl.cpp b/media/libaudiohal/impl/StreamHalAidl.cpp
index 3fd0911..fed2919 100644
--- a/media/libaudiohal/impl/StreamHalAidl.cpp
+++ b/media/libaudiohal/impl/StreamHalAidl.cpp
@@ -415,8 +415,10 @@
void StreamHalAidl::onAsyncTransferReady() {
if (auto state = getState(); state == StreamDescriptor::State::TRANSFERRING) {
- // Retrieve the current state together with position counters.
- updateCountersIfNeeded();
+ // Retrieve the current state together with position counters unconditionally
+ // to ensure that the state on our side gets updated.
+ sendCommand(makeHalCommand<HalCommand::Tag::getStatus>(),
+ nullptr, true /*safeFromNonWorkerThread */);
} else {
ALOGW("%s: unexpected onTransferReady in the state %s", __func__, toString(state).c_str());
}
@@ -424,8 +426,10 @@
void StreamHalAidl::onAsyncDrainReady() {
if (auto state = getState(); state == StreamDescriptor::State::DRAINING) {
- // Retrieve the current state together with position counters.
- updateCountersIfNeeded();
+ // Retrieve the current state together with position counters unconditionally
+ // to ensure that the state on our side gets updated.
+ sendCommand(makeHalCommand<HalCommand::Tag::getStatus>(),
+ nullptr, true /*safeFromNonWorkerThread */);
} else {
ALOGW("%s: unexpected onDrainReady in the state %s", __func__, toString(state).c_str());
}