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

Commit ff51b47d authored by Eino-Ville Talvala's avatar Eino-Ville Talvala
Browse files

Camera3Device: Correctly shut down abandoned streams

If a stream was abandoned (consumer died), the stream teardown would
terminate early. Update teardown conditions to complete even for the
abandoned state.

One consequence of this is that the buffer manager never received an
unregister call for the stream, leading it to error out when trying to
remove buffers from it.

Also switch to STATE_ABANDONED in case of an error detaching a buffer,
instead of the error state.

Bug: 29778464
Change-Id: I44de69773e8bbf9ebe83207498d6ee0674ed91bf
parent 6e706147
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ status_t Camera3IOStreamBase::disconnectLocked() {
    switch (mState) {
        case STATE_IN_RECONFIG:
        case STATE_CONFIGURED:
        case STATE_ABANDONED:
            // OK
            break;
        default:
+2 −2
Original line number Diff line number Diff line
@@ -605,9 +605,9 @@ status_t Camera3OutputStream::detachBuffer(sp<GraphicBuffer>* buffer, int* fence
        *buffer = 0;
        ALOGW("%s: the released buffer has already been freed by the buffer queue!", __FUNCTION__);
    } else if (res != OK) {
        // Other errors are fatal.
        // Treat other errors as abandonment
        ALOGE("%s: detach next buffer failed: %s (%d).", __FUNCTION__, strerror(-res), res);
        mState = STATE_ERROR;
        mState = STATE_ABANDONED;
        return res;
    }