Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2050f929 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "libaudiohal@aidl: Resolve async callbacks concurrency" into main am:...

Merge "libaudiohal@aidl: Resolve async callbacks concurrency" into main am: 3a66794d am: f9fe06fa

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/3310115



Change-Id: I2e217d56889d1cae7412e2053a6b8b43fa5b0397
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents d5090892 f9fe06fa
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -544,7 +544,14 @@ status_t StreamHalAidl::exit() {
}

void StreamHalAidl::onAsyncTransferReady() {
    if (auto state = getState(); state == StreamDescriptor::State::TRANSFERRING) {
    StreamDescriptor::State state;
    {
        // Use 'mCommandReplyLock' to ensure that 'sendCommand' has finished updating the state
        // after the reply from the 'burst' command.
        std::lock_guard l(mCommandReplyLock);
        state = getState();
    }
    if (state == StreamDescriptor::State::TRANSFERRING) {
        // Retrieve the current state together with position counters unconditionally
        // to ensure that the state on our side gets updated.
        sendCommand(makeHalCommand<HalCommand::Tag::getStatus>(),
@@ -555,7 +562,14 @@ void StreamHalAidl::onAsyncTransferReady() {
}

void StreamHalAidl::onAsyncDrainReady() {
    if (auto state = getState(); state == StreamDescriptor::State::DRAINING) {
    StreamDescriptor::State state;
    {
        // Use 'mCommandReplyLock' to ensure that 'sendCommand' has finished updating the state
        // after the reply from the 'drain' command.
        std::lock_guard l(mCommandReplyLock);
        state = getState();
    }
    if (state == StreamDescriptor::State::DRAINING) {
        // 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,