diff options
author | Lajos Molnar <lajos@google.com> | 2014-11-25 22:09:12 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-11-25 22:09:13 +0000 |
commit | b2cf160fef5071183d52ad85b49892e23b790e8a (patch) | |
tree | 723a175e9db9c00feee5b576cc4245f210bdd5af /media | |
parent | 0f78eabb733e1413d7febd00c0bad0f0add02314 (diff) | |
parent | 643319f60e72a86c180ee839b25c086554e5bd47 (diff) | |
download | frameworks_av-b2cf160fef5071183d52ad85b49892e23b790e8a.zip frameworks_av-b2cf160fef5071183d52ad85b49892e23b790e8a.tar.gz frameworks_av-b2cf160fef5071183d52ad85b49892e23b790e8a.tar.bz2 |
Merge "stagefright: add graceful handling when setting port definition" into lmp-mr1-dev
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/omx/SimpleSoftOMXComponent.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp index 4999663..7f99dcd 100644 --- a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp +++ b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp @@ -152,28 +152,28 @@ OMX_ERRORTYPE SimpleSoftOMXComponent::internalSetParameter( OMX_PARAM_PORTDEFINITIONTYPE *defParams = (OMX_PARAM_PORTDEFINITIONTYPE *)params; - if (defParams->nPortIndex >= mPorts.size() - || defParams->nSize - != sizeof(OMX_PARAM_PORTDEFINITIONTYPE)) { - return OMX_ErrorUndefined; + if (defParams->nPortIndex >= mPorts.size()) { + return OMX_ErrorBadPortIndex; + } + if (defParams->nSize != sizeof(OMX_PARAM_PORTDEFINITIONTYPE)) { + return OMX_ErrorUnsupportedSetting; } PortInfo *port = &mPorts.editItemAt(defParams->nPortIndex); - if (defParams->nBufferSize != port->mDef.nBufferSize) { - CHECK_GE(defParams->nBufferSize, port->mDef.nBufferSize); + // default behavior is that we only allow buffer size to increase + if (defParams->nBufferSize > port->mDef.nBufferSize) { port->mDef.nBufferSize = defParams->nBufferSize; } - if (defParams->nBufferCountActual - != port->mDef.nBufferCountActual) { - CHECK_GE(defParams->nBufferCountActual, - port->mDef.nBufferCountMin); - - port->mDef.nBufferCountActual = defParams->nBufferCountActual; + if (defParams->nBufferCountActual < port->mDef.nBufferCountMin) { + ALOGW("component requires at least %u buffers (%u requested)", + port->mDef.nBufferCountMin, defParams->nBufferCountActual); + return OMX_ErrorUnsupportedSetting; } + port->mDef.nBufferCountActual = defParams->nBufferCountActual; return OMX_ErrorNone; } |