summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXigui Wang <xigui.wang@intel.com>2016-06-02 20:55:39 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-06-02 20:55:39 +0000
commit6e173b8a749a71564124d0b4678dfe7ea794eaeb (patch)
treef25da12ecdb6881f5bb6f940e2819a9db55a0323
parent6e977a0338dc1d2214251965590cea82969c3dc3 (diff)
parent25c9cb7998406865db459b33fa7cd87f28098fc5 (diff)
downloadutils-6e173b8a749a71564124d0b4678dfe7ea794eaeb.tar.gz
Flush decoder output intead of ISV output to framework am: 89be4f7c8a am: 473164dbc4
am: 25c9cb7998 * commit '25c9cb7998406865db459b33fa7cd87f28098fc5': Flush decoder output intead of ISV output to framework Change-Id: I78b76b20c1efc119768d79a7f1c3d24a09346f98
-rw-r--r--ISV/include/isv_omxcomponent.h6
-rw-r--r--ISV/omx/isv_omxcomponent.cpp21
2 files changed, 27 insertions, 0 deletions
diff --git a/ISV/include/isv_omxcomponent.h b/ISV/include/isv_omxcomponent.h
index 1e8d13e..bba2a32 100644
--- a/ISV/include/isv_omxcomponent.h
+++ b/ISV/include/isv_omxcomponent.h
@@ -274,6 +274,11 @@ private:
int32_t mNumISVBuffers;
int32_t mNumDecoderBuffers;
int32_t mNumDecoderBuffersBak;
+ /* To speed up the start up output decoder buffer directly
+ * for certain frames. ISV worker pipeline set up is hide by (in parallel with)
+ * display these output frames.
+ */
+ int32_t mOutputDecoderBufferNum;
uint32_t mWidth;
uint32_t mHeight;
uint32_t mUseAndroidNativeBufferIndex;
@@ -297,6 +302,7 @@ private:
// protect create mProcThread instance
bool mOwnProcessor;
static pthread_mutex_t ProcThreadInstanceLock;
+ Mutex mDecoderBufLock;
};
#endif // #define ISV_OMXCOMPONENT_H_
diff --git a/ISV/omx/isv_omxcomponent.cpp b/ISV/omx/isv_omxcomponent.cpp
index 6d84b52..1f87deb 100644
--- a/ISV/omx/isv_omxcomponent.cpp
+++ b/ISV/omx/isv_omxcomponent.cpp
@@ -30,6 +30,9 @@
#undef LOG_TAG
#define LOG_TAG "isv-omxil"
+#define OUTPUT_STARTUP_DEC_BUF_NUM (38)
+#define FLUSH_WIDTH 352
+#define FLUSH_HEIGHT 288
using namespace android;
@@ -66,6 +69,7 @@ ISVComponent::ISVComponent(
mNumISVBuffers(MIN_ISV_BUFFER_NUM),
mNumDecoderBuffers(0),
mNumDecoderBuffersBak(0),
+ mOutputDecoderBufferNum(0),
mWidth(0),
mHeight(0),
mUseAndroidNativeBufferIndex(0),
@@ -343,6 +347,7 @@ OMX_ERRORTYPE ISVComponent::ISV_SetParameter(
if (def->nPortIndex == kPortIndexOutput) {
//set the buffer count we should fill to decoder before feed buffer to VPP
mNumDecoderBuffersBak = mNumDecoderBuffers = def->nBufferCountActual - MIN_OUTPUT_NUM - UNDEQUEUED_NUM;
+ mOutputDecoderBufferNum = 0;
OMX_VIDEO_PORTDEFINITIONTYPE *video_def = &def->format.video;
//FIXME: init itself here
@@ -663,6 +668,7 @@ OMX_ERRORTYPE ISVComponent::ISV_FillThisBuffer(
}
if (mNumDecoderBuffers > 0) {
+ Mutex::Autolock autoLock(mDecoderBufLock);
mNumDecoderBuffers--;
ALOGD_IF(ISV_COMPONENT_DEBUG, "%s: fill pBuffer %p to the decoder, decoder still need extra %d buffers", __func__,
pBuffer, mNumDecoderBuffers);
@@ -716,6 +722,17 @@ OMX_ERRORTYPE ISVComponent::ISV_FillBufferDone(
mOutputCropChanged = false;
}
+ if ((mWidth > FLUSH_WIDTH) && (mHeight > FLUSH_HEIGHT) &&
+ (pBuffer->nFilledLen != 0) && (mOutputDecoderBufferNum < OUTPUT_STARTUP_DEC_BUF_NUM)) {
+ Mutex::Autolock autoLock(mDecoderBufLock);
+ // take one buffer from decoder loop here. Fill one buffer to the loop by mNumDecoderBuffers++
+ mNumDecoderBuffers++;
+ mOutputDecoderBufferNum++;
+ ALOGD_IF(ISV_COMPONENT_DEBUG, "%s: return %d decoder output Buffer, mNumDecoderBuffers get %d input buffer",
+ __func__, mOutputDecoderBufferNum, mNumDecoderBuffers);
+ return mpCallBacks->FillBufferDone(&mBaseComponent, pAppData, pBuffer);
+ }
+
mProcThread->addInput(pBuffer);
return OMX_ErrorNone;
@@ -766,6 +783,7 @@ OMX_ERRORTYPE ISVComponent::ISV_EventHandler(
mProcThread->waitFlushFinished();
mVPPFlushing = false;
mNumDecoderBuffers = mNumDecoderBuffersBak;
+ mOutputDecoderBufferNum = 0;
}
break;
}
@@ -784,6 +802,9 @@ OMX_ERRORTYPE ISVComponent::ISV_EventHandler(
ALOGD_IF(ISV_COMPONENT_DEBUG, "%s: output crop changed", __func__);
mOutputCropChanged = true;
return OMX_ErrorNone;
+ } else if (nData1 == kPortIndexOutput && nData2 == OMX_IndexParamPortDefinition) {
+ ALOGI("%s: output format changed. ISV flush buffers", __func__);
+ mProcThread->notifyFlush();
}
break;
}