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

Commit bcf7dcb8 authored by Mikhail Naganov's avatar Mikhail Naganov Committed by Cherrypicker Worker
Browse files

libaudiohal@aidl: Follow up for callbacks handling

After receiving an async callback, retrieve the state
unconditionally.

Bug: 331300943
Test: mp3 and ogg offloaded playback (bug repro steps)
(cherry picked from https://android-review.googlesource.com/q/commit:4282cca6af7e1644042362515b045d790c4a59a9)
Merged-In: Ice9cf31b4f15f9af7c4c17c211f955f635d53b82
Change-Id: Ice9cf31b4f15f9af7c4c17c211f955f635d53b82
parent 0ca09403
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -424,8 +424,10 @@ status_t StreamHalAidl::exit() {

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());
    }
@@ -433,8 +435,10 @@ void StreamHalAidl::onAsyncTransferReady() {

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());
    }