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

Commit a9938d66 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/28089685',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/28089685', 'googleplex-android-review.googlesource.com/28152518'] into 24Q3-release.

Change-Id: Ic98b0d97858900bd4d74001769144483ff092f34
parents fc6067c1 323b15a7
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -497,9 +497,10 @@ c2_status_t MultiAccessUnitHelper::gather(
                    // This is to take care of the last bytes and to decide to send with
                    // FLAG_INCOMPLETE or not.
                    if ((frame->mWview
                            && (frame->mWview->offset() > frame->mLargeFrameTuning.thresholdSize))
                            && (frame->mWview->offset() >= frame->mLargeFrameTuning.thresholdSize))
                            || frame->mComponentFrameIds.empty()) {
                        if (frame->mLargeWork) {
                            frame->mLargeWork->result = C2_OK;
                            finalizeWork(*frame);
                            addOutWork(frame->mLargeWork);
                            frame->reset();
@@ -558,12 +559,15 @@ c2_status_t MultiAccessUnitHelper::processWorklets(MultiAccessUnitInfo &frame,
        c2_status_t ret = C2_OK;
        if (frame.mLargeWork == nullptr) {
            frame.mLargeWork.reset(new C2Work);
            frame.mLargeWork->result = C2_OK;
            frame.mLargeWork->input.flags = (C2FrameData::flags_t)0;
            frame.mLargeWork->input.ordinal = frame.inOrdinal;
            frame.mLargeWork->input.ordinal.frameIndex = frame.inOrdinal.frameIndex;
        }
        if (allocateWorket) {
            if (frame.mLargeWork->worklets.size() == 0) {
                frame.mLargeWork->worklets.emplace_back(new C2Worklet);
                frame.mLargeWork->worklets.back()->output.flags = (C2FrameData::flags_t)0;
            }
        }
        if (allocateBuffer) {
@@ -611,6 +615,9 @@ c2_status_t MultiAccessUnitHelper::processWorklets(MultiAccessUnitInfo &frame,
        if (c2ret != C2_OK) {
            return c2ret;
        }
        uint32_t flags = work->input.flags;
        flags |= frame.mLargeWork->input.flags;
        frame.mLargeWork->input.flags = (C2FrameData::flags_t)flags;
        C2FrameData& outputFramedata = frame.mLargeWork->worklets.front()->output;
        if (!(*worklet)->output.configUpdate.empty()) {
            for (auto& configUpdate : (*worklet)->output.configUpdate) {
@@ -678,6 +685,9 @@ c2_status_t MultiAccessUnitHelper::processWorklets(MultiAccessUnitInfo &frame,
                        }
                    }
                    allocateWork(frame, true, true);
                    uint32_t flags = work->input.flags;
                    flags |= frame.mLargeWork->input.flags;
                    frame.mLargeWork->input.flags = (C2FrameData::flags_t)flags;
                    C2ReadView rView = blocks.front().map().get();
                    if (rView.error()) {
                        LOG(ERROR) << "Buffer read view error";
@@ -744,7 +754,8 @@ c2_status_t MultiAccessUnitHelper::finalizeWork(
    }
    LOG(DEBUG) << "Finalizing work with input Idx "
            << frame.mLargeWork->input.ordinal.frameIndex.peekull()
            << " timestamp " << timeStampUs;
            << " timestamp " << timeStampUs
            << " inFlags " << inFlags;
    uint32_t finalFlags = 0;
    if ((!forceComplete)
            && (frame.mLargeWork->result == C2_OK)
+11 −3
Original line number Diff line number Diff line
@@ -617,10 +617,11 @@ EffectModule::~EffectModule()

}

// return true if any effect started or stopped
bool EffectModule::updateState_l() {
    audio_utils::lock_guard _l(mutex());

    bool started = false;
    bool startedOrStopped = false;
    switch (mState) {
    case RESTART:
        reset_l();
@@ -635,7 +636,7 @@ bool EffectModule::updateState_l() {
        }
        if (start_ll() == NO_ERROR) {
            mState = ACTIVE;
            started = true;
            startedOrStopped = true;
        } else {
            mState = IDLE;
        }
@@ -655,6 +656,7 @@ bool EffectModule::updateState_l() {
        // turn off sequence.
        if (--mDisableWaitCnt == 0) {
            reset_l();
            startedOrStopped = true;
            mState = IDLE;
        }
        break;
@@ -669,7 +671,7 @@ bool EffectModule::updateState_l() {
        break;
    }

    return started;
    return startedOrStopped;
}

void EffectModule::process()
@@ -2310,6 +2312,9 @@ void EffectChain::process_l() {
    }
    bool doResetVolume = false;
    for (size_t i = 0; i < size; i++) {
        // reset volume when any effect just started or stopped.
        // resetVolume_l will check if the volume controller effect in the chain needs update and
        // apply the correct volume
        doResetVolume = mEffects[i]->updateState_l() || doResetVolume;
    }
    if (doResetVolume) {
@@ -2663,6 +2668,9 @@ bool EffectChain::setVolume_l(uint32_t* left, uint32_t* right, bool force) {
                                       true /* effect chain volume controller */);
        mNewLeftVolume = newLeft;
        mNewRightVolume = newRight;
        ALOGD("%s sessionId %d volume controller effect %s set (%d, %d), ret (%d, %d)", __func__,
              mSessionId, mEffects[ctrlIdx]->desc().name, mLeftVolume, mRightVolume, newLeft,
              newRight);
    }
    // then indicate volume to all other effects in chain.
    // Pass altered volume to effects before volume controller
+4 −2
Original line number Diff line number Diff line
@@ -189,11 +189,13 @@ public:
    virtual status_t sendMetadata_ll(const std::vector<playback_track_metadata_v7_t>& metadata)
            REQUIRES(audio_utils::ThreadBase_Mutex,
                     audio_utils::EffectChain_Mutex) EXCLUDES_EffectBase_Mutex = 0;
    // return true if there was a state change from STARTING to ACTIVE, or STOPPED to IDLE, effect
    // chain will do a volume reset in these two cases
    virtual bool updateState_l()
            REQUIRES(audio_utils::EffectChain_Mutex) EXCLUDES_EffectBase_Mutex = 0;

private:
    virtual void process() = 0;
    virtual bool updateState_l()
            REQUIRES(audio_utils::EffectChain_Mutex) EXCLUDES_EffectBase_Mutex = 0;
    virtual void reset_l() REQUIRES(audio_utils::EffectChain_Mutex) = 0;
    virtual status_t configure_l() REQUIRES(audio_utils::EffectChain_Mutex) = 0;
    virtual status_t init_l()