diff options
author | wfeng6 <wei.feng@intel.com> | 2012-11-19 22:26:17 +0800 |
---|---|---|
committer | Patrick Tjin <pattjin@google.com> | 2014-07-21 22:03:40 -0700 |
commit | c3e26983a72fa51f0dff98bc66234b73f74adc17 (patch) | |
tree | ff99a1987f15160017a3abf866dcab5746942e52 | |
parent | 013907bbe7ffb1c1e19b172dbbef39dceb6573ad (diff) | |
download | wrs_omxil_core-c3e26983a72fa51f0dff98bc66234b73f74adc17.tar.gz |
[PORT FROM MAIN] Report errors when failing to set the input port size
BZ: 68835
The patch allows to set the input port size according to the size
required by OMXCodec. When the required size is larger than the
threshold, a OMX_ErrorBadParameter error will be reported to
OMXCodec.
Change-Id: I648a580e35d0c023b14f3313b48a08a1b4dc60cd
Signed-off-by: wfeng6 <wei.feng@intel.com>
Reviewed-on: http://android.intel.com:8080/76393
Tested-by: Tong, BoX <box.tong@intel.com>
Reviewed-by: Tong, BoX <box.tong@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Tested-by: cactus <cactus@intel.com>
-rw-r--r-- | base/inc/portbase.h | 6 | ||||
-rw-r--r-- | base/src/componentbase.cpp | 5 | ||||
-rw-r--r-- | base/src/portbase.cpp | 9 |
3 files changed, 19 insertions, 1 deletions
diff --git a/base/inc/portbase.h b/base/inc/portbase.h index 97cff14..03527ef 100644 --- a/base/inc/portbase.h +++ b/base/inc/portbase.h @@ -187,6 +187,12 @@ private: /* wrs component handle */ class ComponentBase *cbase; + + /* Input port size limit. The limit is set to be the size of a 1080P 4:4:4 raw image size, + which is 1920x1080x3. */ + enum { + MAX_INPUT_PORT_SIZE = 6220800 + }; }; /* end of PortBase */ diff --git a/base/src/componentbase.cpp b/base/src/componentbase.cpp index 3fa7eca..c37392e 100644 --- a/base/src/componentbase.cpp +++ b/base/src/componentbase.cpp @@ -572,7 +572,10 @@ OMX_ERRORTYPE ComponentBase::CBaseSetParameter( return OMX_ErrorIncorrectStateOperation; } - port->SetPortDefinition(p, false); + ret = port->SetPortDefinition(p, false); + if (ret != OMX_ErrorNone) { + return ret; + } break; } case OMX_IndexParamCompBufferSupplier: diff --git a/base/src/portbase.cpp b/base/src/portbase.cpp index a25b79c..636ce1e 100644 --- a/base/src/portbase.cpp +++ b/base/src/portbase.cpp @@ -199,6 +199,15 @@ OMX_ERRORTYPE PortBase::SetPortDefinition( return OMX_ErrorBadParameter; temp.nBufferCountActual = p->nBufferCountActual; } + if ((p->nBufferSize > temp.nBufferSize) && (temp.eDir == OMX_DirInput)) { + if (p->nBufferSize <= MAX_INPUT_PORT_SIZE) { + LOGW("Input port size has been changed!"); + temp.nBufferSize = p->nBufferSize; + } else { + LOGE("Invalid input port size!"); + return OMX_ErrorBadParameter; + } + } } else { temp.nPortIndex = p->nPortIndex; |