Fix video jump when bluetooth pairing video plays
Make all frames show in order by change the flush mode
Bug: 26818454
Change-Id: Ic18cad1301e3746690da5dbc26646072d92a13af
Signed-off-by: Xin Wang <xin1.wang@intel.com>
diff --git a/ISV/base/isv_processor.cpp b/ISV/base/isv_processor.cpp
index 67f9158..623f077 100644
--- a/ISV/base/isv_processor.cpp
+++ b/ISV/base/isv_processor.cpp
@@ -518,15 +518,17 @@
}
if (input->nFlags & OMX_BUFFERFLAG_EOS) {
- mpOwner->releaseBuffer(kPortIndexInput, input, true);
+ //the last buffer is the last to release
notifyFlush();
+ mpOwner->releaseBuffer(kPortIndexInput, input, true);
return;
}
status_t ret = configFilters(input);
if (ret == NOT_ENOUGH_DATA) {
// release this buffer if frc is not ready.
- mpOwner->releaseBuffer(kPortIndexInput, input, false);
+ // send the buffer to framework
+ mpOwner->releaseBuffer(kPortIndexOutput, input, false);
ALOGD_IF(ISV_THREAD_DEBUG,
"%s: frc rate is not ready, release this buffer %" PRIuPTR
", fps %d", __func__, reinterpret_cast<uintptr_t>(input),
@@ -606,6 +608,17 @@
}
Mutex::Autolock autoLock(mLock);
+ //make sure the useful buffer will be sended to framework first
+ OMX_BUFFERHEADERTYPE* pBuffer = NULL;
+ {
+ Mutex::Autolock autoLock(mInputLock);
+ while (!mInputBuffers.empty()) {
+ pBuffer = mInputBuffers.itemAt(0);
+ mpOwner->releaseBuffer(kPortIndexInput, pBuffer, true);
+ ALOGD_IF(ISV_THREAD_DEBUG,"%s: Flush the pBuffer %" PRIuPTR " in input buffer queue.",__func__, reinterpret_cast<uintptr_t>(pBuffer));
+ mInputBuffers.removeAt(0);
+ }
+ }
mbFlush = true;
mRunCond.signal();
ALOGD_IF(ISV_THREAD_DEBUG, "wake up proc thread");
@@ -643,7 +656,7 @@
pBuffer = mOutputBuffers.itemAt(0);
mpOwner->releaseBuffer(kPortIndexOutput, pBuffer, true);
ALOGD_IF(
- ISV_THREAD_DEBUG,
+ ISV_THREAD_DEBUG,
"%s: Flush the pBuffer %" PRIuPTR " in output buffer queue.",
__func__, reinterpret_cast<uintptr_t>(pBuffer));
mOutputBuffers.removeAt(0);
diff --git a/ISV/omx/isv_omxcomponent.cpp b/ISV/omx/isv_omxcomponent.cpp
index 8be096e..7b2c755 100644
--- a/ISV/omx/isv_omxcomponent.cpp
+++ b/ISV/omx/isv_omxcomponent.cpp
@@ -895,8 +895,12 @@
OMX_ERRORTYPE err = OMX_ErrorNone;
if (bFLush) {
- pBuffer->nFilledLen = 0;
- pBuffer->nOffset = 0;
+ if(index == kPortIndexOutput) {
+ pBuffer->nFilledLen = 0;
+ pBuffer->nOffset = 0;
+ pBuffer->nTimeStamp = 0;
+ pBuffer->nFlags = 0;
+ }
err = mpCallBacks->FillBufferDone(&mBaseComponent, mBaseComponent->pApplicationPrivate, pBuffer);
ALOGD_IF(ISV_COMPONENT_DEBUG, "%s: flush pBuffer %p", __func__, pBuffer);
return err;
@@ -906,6 +910,7 @@
pBuffer->nFilledLen = 0;
pBuffer->nOffset = 0;
pBuffer->nFlags = 0;
+ pBuffer->nTimeStamp = 0;
if (mISVBufferManager != NULL) {
ISVBuffer* isvBuffer = mISVBufferManager->mapBuffer(reinterpret_cast<unsigned long>(pBuffer->pBuffer));