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

Commit 878a952b authored by Golden Hsu's avatar Golden Hsu Committed by Emilian Peev
Browse files

[ALPS09070588] Camera splitter bug fix

[Description]
1. Solution from Google bug id: 355537202
2. mLock is temporarily removed during attachBuffer call, need to check
if graphic producer is invalid to avoid putting the stream in abandoned
state

[Test]
1. pdas, ATE+

Flag: EXEMPT bugfix
Bug: 355537202
Bug: 377421083
CR-Id: ALPS09070588
Feature: [Android Default] Camera Application Basic Functions

Change-Id: I0eebecac622d9796d104be50a88a93d9e9896dcf
Merged-In: I0eebecac622d9796d104be50a88a93d9e9896dcf
parent 59839fae
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -473,6 +473,12 @@ status_t Camera3StreamSplitter::attachBufferToOutputs(ANativeWindowBuffer* anb,
        mMutex.unlock();
        res = gbp->attachBuffer(&slot, gb);
        mMutex.lock();
        //During buffer attach 'mMutex' is not held which makes the removal of
        //"gbp" possible. Check whether this is the case and continue.
        if (gbp.get() == nullptr) {
            res = OK;
            continue;
        }
        if (res != OK) {
            SP_LOGE("%s: Cannot attachBuffer from GraphicBufferProducer %p: %s (%d)",
                    __FUNCTION__, gbp.get(), strerror(-res), res);
+6 −5
Original line number Diff line number Diff line
@@ -459,6 +459,12 @@ status_t DeprecatedCamera3StreamSplitter::attachBufferToOutputs(
        mMutex.unlock();
        res = gbp->attachBuffer(&slot, gb);
        mMutex.lock();
        // During buffer attach 'mMutex' is not held which makes the removal of
        //"gbp" possible. Check whether this is the case and continue.
        if (gbp.get() == nullptr) {
            res = OK;
            continue;
        }
        if (res != OK) {
            SP_LOGE("%s: Cannot attachBuffer from GraphicBufferProducer %p: %s (%d)", __FUNCTION__,
                    gbp.get(), strerror(-res), res);
@@ -470,11 +476,6 @@ status_t DeprecatedCamera3StreamSplitter::attachBufferToOutputs(
                    __FUNCTION__, slot, BufferQueue::NUM_BUFFER_SLOTS);
            return BAD_VALUE;
        }
        // During buffer attach 'mMutex' is not held which makes the removal of
        //"gbp" possible. Check whether this is the case and continue.
        if (mOutputSlots[gbp] == nullptr) {
            continue;
        }
        auto& outputSlots = *mOutputSlots[gbp];
        if (static_cast<size_t>(slot + 1) > outputSlots.size()) {
            outputSlots.resize(slot + 1);