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

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

Merge "libaudiohal@aidl: fix drain as per HIDL" into main am: 361be945 am: 75c125c0

parents 37042c79 75c125c0
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -800,6 +800,14 @@ status_t StreamOutHalAidl::supportsDrain(bool *supportsDrain) {
}

status_t StreamOutHalAidl::drain(bool earlyNotify) {
    if (!mStream) return NO_INIT;

    if(const auto state = getState(); state == StreamDescriptor::State::IDLE) {
        ALOGD("%p %s stream already in IDLE state", this, __func__);
        if(mContext.isAsynchronous()) onDrainReady();
        return OK;
    }

    return StreamHalAidl::drain(earlyNotify);
}

+5 −4
Original line number Diff line number Diff line
@@ -215,6 +215,11 @@ class StreamHalAidl : public virtual StreamHalInterface, public ConversionHelper

    ~StreamHalAidl() override;

    ::aidl::android::hardware::audio::core::StreamDescriptor::State getState() {
        std::lock_guard l(mLock);
        return mLastReply.state;
    }

    status_t getLatency(uint32_t *latency);

    // Always returns non-negative values.
@@ -268,10 +273,6 @@ class StreamHalAidl : public virtual StreamHalInterface, public ConversionHelper
        result.format = config.format;
        return result;
    }
    ::aidl::android::hardware::audio::core::StreamDescriptor::State getState() {
        std::lock_guard l(mLock);
        return mLastReply.state;
    }
    // Note: Since `sendCommand` takes mLock while holding mCommandReplyLock, never call
    // it with `mLock` being held.
    status_t sendCommand(