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

Commit 766c91db authored by Dongwon Kang's avatar Dongwon Kang
Browse files

Track graphic buffer mode in OMXNodeInstance

Test: cts-tradefed run cts -p android.media & YT & Play Movies & Cast
Bug: 62948670
Merged-In: Icbd9b767f1aef005819e680f77f4a05041988f34
Change-Id: Icbd9b767f1aef005819e680f77f4a05041988f34
parent aafbda5a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -157,8 +157,9 @@ private:
    KeyedVector<OMX::buffer_id, OMX_BUFFERHEADERTYPE *> mBufferIDToBufferHeader;
    KeyedVector<OMX_BUFFERHEADERTYPE *, OMX::buffer_id> mBufferHeaderToBufferID;

    // metadata mode tracking
    // metadata and graphic buffer mode tracking
    bool mUsingMetadata[2];
    bool mGraphicBufferEnabled[2];

    ~OMXNodeInstance();

+18 −2
Original line number Diff line number Diff line
@@ -127,6 +127,8 @@ OMXNodeInstance::OMXNodeInstance(
{
    mUsingMetadata[0] = false;
    mUsingMetadata[1] = false;
    mGraphicBufferEnabled[0] = false;
    mGraphicBufferEnabled[1] = false;
    mIsSecure = AString(name).endsWith(".secure");
}

@@ -441,10 +443,12 @@ status_t OMXNodeInstance::enableGraphicBuffers(
    if (err != OMX_ErrorNone) {
        ALOGE("OMX_EnableAndroidNativeBuffers failed with error %d (0x%08x)",
                err, err);

        if (enable) {
            mGraphicBufferEnabled[portIndex] = false;
        }
        return UNKNOWN_ERROR;
    }

    mGraphicBufferEnabled[portIndex] = enable;
    return OK;
}

@@ -657,6 +661,12 @@ status_t OMXNodeInstance::useBuffer(
        return BAD_VALUE;
    }

    if (!mUsingMetadata[portIndex] && mGraphicBufferEnabled[portIndex]) {
        ALOGE("b/62948670");
        android_errorWriteLog(0x534e4554, "62948670");
        return INVALID_OPERATION;
    }

    // metadata buffers are not connected cross process
    BufferMeta *buffer_meta;
    bool isMeta = mUsingMetadata[portIndex];
@@ -766,6 +776,12 @@ status_t OMXNodeInstance::useGraphicBuffer(
        OMX_U32 portIndex, const sp<GraphicBuffer>& graphicBuffer,
        OMX::buffer_id *buffer) {
    Mutex::Autolock autoLock(mLock);
    if (!mGraphicBufferEnabled[portIndex] || mUsingMetadata[portIndex]) {
        // Report error if this is not in graphic buffer mode.
        ALOGE("b/62948670");
        android_errorWriteLog(0x534e4554, "62948670");
        return INVALID_OPERATION;
    }

    // See if the newer version of the extension is present.
    OMX_INDEXTYPE index;