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

Unverified Commit a7597605 authored by Lajos Molnar's avatar Lajos Molnar Committed by Adrian DC
Browse files

IOMX: restrict conversion of ANWB to gralloc source in emptyBuffer

This is only allowed in-process (if backup and codec buffers are
connected.)

RM-290

Bug: 29422020
Bug: 31412859
Change-Id: If48e3e0b6f1af99a459fdc3f6f03744bbf0dc375
(cherry picked from commit 087ff384)
parent 02200516
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -170,6 +170,10 @@ struct BufferMeta {
        return buf;
        return buf;
    }
    }


    bool copyToOmx() const {
        return mCopyToOmx;
    }

    void setGraphicBuffer(const sp<GraphicBuffer> &graphicBuffer) {
    void setGraphicBuffer(const sp<GraphicBuffer> &graphicBuffer) {
        mGraphicBuffer = graphicBuffer;
        mGraphicBuffer = graphicBuffer;
    }
    }
@@ -792,7 +796,7 @@ status_t OMXNodeInstance::useBuffer(
                params, portIndex, false /* copyToOmx */, false /* copyFromOmx */, data);
                params, portIndex, false /* copyToOmx */, false /* copyFromOmx */, data);
    } else {
    } else {
        buffer_meta = new BufferMeta(
        buffer_meta = new BufferMeta(
                params, portIndex, false /* copyFromOmx */, false /* copyToOmx */, NULL);
                params, portIndex, false /* copyToOmx */, false /* copyFromOmx */, NULL);
    }
    }


    OMX_BUFFERHEADERTYPE *header;
    OMX_BUFFERHEADERTYPE *header;
@@ -1281,7 +1285,8 @@ status_t OMXNodeInstance::emptyBuffer(


    // convert incoming ANW meta buffers if component is configured for gralloc metadata mode
    // convert incoming ANW meta buffers if component is configured for gralloc metadata mode
    // ignore rangeOffset in this case
    // ignore rangeOffset in this case
    if (mMetadataType[kPortIndexInput] == kMetadataBufferTypeGrallocSource
    if (buffer_meta->copyToOmx()
            && mMetadataType[kPortIndexInput] == kMetadataBufferTypeGrallocSource
            && backup->capacity() >= sizeof(VideoNativeMetadata)
            && backup->capacity() >= sizeof(VideoNativeMetadata)
            && codec->capacity() >= sizeof(VideoGrallocMetadata)
            && codec->capacity() >= sizeof(VideoGrallocMetadata)
            && ((VideoNativeMetadata *)backup->base())->eType
            && ((VideoNativeMetadata *)backup->base())->eType