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

Commit a94c4981 authored by Jeff Tinker's avatar Jeff Tinker
Browse files

Fix alternative signaling for native handles

bug: 27371660
Change-Id: Icbf64c99cad524c080859c1b4ee031af97880568
parent 1deb248c
Loading
Loading
Loading
Loading
+26 −24
Original line number Diff line number Diff line
@@ -468,11 +468,7 @@ status_t OMXNodeInstance::enableNativeBuffers(
    OMX_INDEXTYPE index;
    OMX_ERRORTYPE err = OMX_GetExtensionIndex(mHandle, name, &index);

    if (err != OMX_ErrorNone) {
        CLOG_ERROR_IF(enable, getExtensionIndex, err, "%s", name);
        return StatusFromOMXError(err);
    }

    if (err == OMX_ErrorNone) {
        EnableAndroidNativeBuffersParams params;
        InitOMXParams(&params);
        params.nPortIndex = portIndex;
@@ -482,24 +478,30 @@ status_t OMXNodeInstance::enableNativeBuffers(
        CLOG_IF_ERROR(setParameter, err, "%s(%#x): %s:%u en=%d", name, index,
                      portString(portIndex), portIndex, enable);
        if (!graphic) {
        if (err == OK) {
            if (err == OMX_ErrorNone) {
                mSecureBufferType[portIndex] =
                    enable ? kSecureBufferTypeNativeHandle : kSecureBufferTypeOpaque;
            } else if (mSecureBufferType[portIndex] == kSecureBufferTypeUnknown) {

            // BEGIN ALTERNATE SIGNALING FOR USING NATIVE HANDLES
                mSecureBufferType[portIndex] = kSecureBufferTypeOpaque;
            }
        }
    } else {
        CLOG_ERROR_IF(enable, getExtensionIndex, err, "%s", name);
        if (!graphic) {
            // Extension not supported, check for manual override with system property
            // This is a temporary workaround until partners support the OMX extension
            char value[PROPERTY_VALUE_MAX];
            if (property_get("media.mediadrmservice.enable", value, NULL)
                && (!strcmp("1", value) || !strcasecmp("true", value))) {
                CLOG_CONFIG(enableNativeBuffers, "system property override: using native-handles");
                mSecureBufferType[portIndex] = kSecureBufferTypeNativeHandle;
                return OK;
            }
            // END ALTERNATE SIGNALING FOR USING NATIVE HANDLES

            } else if (mSecureBufferType[portIndex] == kSecureBufferTypeUnknown) {
                mSecureBufferType[portIndex] = kSecureBufferTypeOpaque;
            }
            err = OMX_ErrorNone;
        }
    }

    return StatusFromOMXError(err);
}