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

Commit 75c125c0 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

parents 48b42162 361be945
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -800,6 +800,14 @@ status_t StreamOutHalAidl::supportsDrain(bool *supportsDrain) {
}
}


status_t StreamOutHalAidl::drain(bool earlyNotify) {
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);
    return StreamHalAidl::drain(earlyNotify);
}
}


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


    ~StreamHalAidl() override;
    ~StreamHalAidl() override;


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

    status_t getLatency(uint32_t *latency);
    status_t getLatency(uint32_t *latency);


    // Always returns non-negative values.
    // Always returns non-negative values.
@@ -268,10 +273,6 @@ class StreamHalAidl : public virtual StreamHalInterface, public ConversionHelper
        result.format = config.format;
        result.format = config.format;
        return result;
        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
    // Note: Since `sendCommand` takes mLock while holding mCommandReplyLock, never call
    // it with `mLock` being held.
    // it with `mLock` being held.
    status_t sendCommand(
    status_t sendCommand(