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

Unverified Commit 8392952e authored by LuK1337's avatar LuK1337 Committed by Michael Bestas
Browse files

OMXNodeInstance: Fix legacy HAL1 after merge of android-7.1.0_r7

Change-Id: I53985a966b891b902437f71d4ebccbd68138329e
parent d37f738b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -50,6 +50,12 @@ LOCAL_CFLAGS += -DQTI_FLAC_DECODER
endif
endif

ifneq ($(TARGET_USES_MEDIA_EXTENSIONS),true)
ifeq ($(TARGET_HAS_LEGACY_CAMERA_HAL1),true)
LOCAL_CFLAGS += -DCAMCORDER_GRALLOC_SOURCE
endif
endif

LOCAL_MODULE:= libstagefright_omx
LOCAL_CFLAGS += -Werror -Wall
# DOLBY_START
+24 −0
Original line number Diff line number Diff line
@@ -1290,7 +1290,11 @@ status_t OMXNodeInstance::allocateBufferWithBackup(
    }

    // metadata buffers are not connected cross process; only copy if not meta
#ifdef CAMCORDER_GRALLOC_SOURCE
    bool copy = true;
#else
    bool copy = mMetadataType[portIndex] == kMetadataBufferTypeInvalid;
#endif

    BufferMeta *buffer_meta = new BufferMeta(
            params, portIndex,
@@ -1408,10 +1412,30 @@ status_t OMXNodeInstance::emptyBuffer(
    BufferMeta *buffer_meta =
        static_cast<BufferMeta *>(header->pAppPrivate);

#ifndef CAMCORDER_GRALLOC_SOURCE
    // set up proper filled length if component is configured for gralloc metadata mode
    // ignore rangeOffset in this case (as client may be assuming ANW meta buffers).
    if (mMetadataType[kPortIndexInput] == kMetadataBufferTypeGrallocSource) {
        header->nFilledLen = rangeLength ? sizeof(VideoGrallocMetadata) : 0;
#else
    sp<ABuffer> backup = buffer_meta->getBuffer(header, true /* backup */, false /* limit */);
    sp<ABuffer> codec = buffer_meta->getBuffer(header, false /* backup */, false /* limit */);

    // convert incoming ANW meta buffers if component is configured for gralloc metadata mode
    // ignore rangeOffset in this case
    if (mMetadataType[kPortIndexInput] == kMetadataBufferTypeGrallocSource
            && backup->capacity() >= sizeof(VideoNativeMetadata)
            && codec->capacity() >= sizeof(VideoGrallocMetadata)
            && ((VideoNativeMetadata *)backup->base())->eType
                    == kMetadataBufferTypeANWBuffer) {
        VideoNativeMetadata &backupMeta = *(VideoNativeMetadata *)backup->base();
        VideoGrallocMetadata &codecMeta = *(VideoGrallocMetadata *)codec->base();
        CLOG_BUFFER(emptyBuffer, "converting ANWB %p to handle %p",
                backupMeta.pBuffer, backupMeta.pBuffer->handle);
        codecMeta.pHandle = backupMeta.pBuffer != NULL ? backupMeta.pBuffer->handle : NULL;
        codecMeta.eType = kMetadataBufferTypeGrallocSource;
        header->nFilledLen = rangeLength ? sizeof(codecMeta) : 0;
#endif
        header->nOffset = 0;
    } else {
        // rangeLength and rangeOffset must be a subset of the allocated data in the buffer.