Merge "Fix alternative signaling for native handles" into nyc-dev am: 4e82dc4004
am: 9fc2cb5937
* commit '9fc2cb5937728373375950255a00f0b6e91fa86b':
Fix alternative signaling for native handles
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index a5c7503..82d5ba3 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -445,38 +445,40 @@
OMX_INDEXTYPE index;
OMX_ERRORTYPE err = OMX_GetExtensionIndex(mHandle, name, &index);
- if (err != OMX_ErrorNone) {
+ if (err == OMX_ErrorNone) {
+ EnableAndroidNativeBuffersParams params;
+ InitOMXParams(¶ms);
+ params.nPortIndex = portIndex;
+ params.enable = enable;
+
+ err = OMX_SetParameter(mHandle, index, ¶ms);
+ CLOG_IF_ERROR(setParameter, err, "%s(%#x): %s:%u en=%d", name, index,
+ portString(portIndex), portIndex, enable);
+ if (!graphic) {
+ if (err == OMX_ErrorNone) {
+ mSecureBufferType[portIndex] =
+ enable ? kSecureBufferTypeNativeHandle : kSecureBufferTypeOpaque;
+ } else if (mSecureBufferType[portIndex] == kSecureBufferTypeUnknown) {
+ mSecureBufferType[portIndex] = kSecureBufferTypeOpaque;
+ }
+ }
+ } else {
CLOG_ERROR_IF(enable, getExtensionIndex, err, "%s", name);
- return StatusFromOMXError(err);
- }
-
- EnableAndroidNativeBuffersParams params;
- InitOMXParams(¶ms);
- params.nPortIndex = portIndex;
- params.enable = enable;
-
- err = OMX_SetParameter(mHandle, index, ¶ms);
- CLOG_IF_ERROR(setParameter, err, "%s(%#x): %s:%u en=%d", name, index,
- portString(portIndex), portIndex, enable);
- if (!graphic) {
- if (err == OK) {
- mSecureBufferType[portIndex] =
- enable ? kSecureBufferTypeNativeHandle : kSecureBufferTypeOpaque;
- } else if (mSecureBufferType[portIndex] == kSecureBufferTypeUnknown) {
-
- // BEGIN ALTERNATE SIGNALING FOR USING NATIVE HANDLES
+ 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))) {
+ && (!strcmp("1", value) || !strcasecmp("true", value))) {
CLOG_CONFIG(enableNativeBuffers, "system property override: using native-handles");
mSecureBufferType[portIndex] = kSecureBufferTypeNativeHandle;
- return OK;
+ } else if (mSecureBufferType[portIndex] == kSecureBufferTypeUnknown) {
+ mSecureBufferType[portIndex] = kSecureBufferTypeOpaque;
}
- // END ALTERNATE SIGNALING FOR USING NATIVE HANDLES
-
- mSecureBufferType[portIndex] = kSecureBufferTypeOpaque;
+ err = OMX_ErrorNone;
}
}
+
return StatusFromOMXError(err);
}