diff options
author | Lajos Molnar <lajos@google.com> | 2014-11-26 12:02:51 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-26 12:02:51 +0000 |
commit | d1ad284db3a84fe9f3dc027149b5f2433e3a8589 (patch) | |
tree | 32363b35a19a8fed5f3df6502c2d749bffc1a434 /media/libstagefright | |
parent | e0f440094345e1e7c3836fe29d3fa34d84e43aee (diff) | |
parent | 20918be9309eda037074388f046c84e187a259c8 (diff) | |
download | frameworks_av-d1ad284db3a84fe9f3dc027149b5f2433e3a8589.zip frameworks_av-d1ad284db3a84fe9f3dc027149b5f2433e3a8589.tar.gz frameworks_av-d1ad284db3a84fe9f3dc027149b5f2433e3a8589.tar.bz2 |
am 20918be9: am b2cf160f: Merge "stagefright: add graceful handling when setting port definition" into lmp-mr1-dev
* commit '20918be9309eda037074388f046c84e187a259c8':
stagefright: add graceful handling when setting port definition
Diffstat (limited to 'media/libstagefright')
-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; } |