summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Wang <xin1.wang@intel.com>2016-04-27 19:26:40 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-04-27 19:26:40 +0000
commit1d67423418e4d919bd04aa84591798a0302dd309 (patch)
tree3be576abe64593ebd7157d2e30842ed961bfcc8a
parent6adbebc9eb1beeda42591324a2128991a6b2c8cc (diff)
parent70189cec16271d7360bf098b3e0b629ad0fcee6b (diff)
downloadutils-1d67423418e4d919bd04aa84591798a0302dd309.tar.gz
Fix video jump when bluetooth pairing video plays
am: 70189ce * commit '70189cec16271d7360bf098b3e0b629ad0fcee6b': Fix video jump when bluetooth pairing video plays Change-Id: Ia8b8bfd1117f0ec6b7b69967735b2667d10a9cf2
-rw-r--r--ISV/base/isv_processor.cpp19
-rw-r--r--ISV/omx/isv_omxcomponent.cpp9
2 files changed, 23 insertions, 5 deletions
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 @@ void ISVProcessor::addInput(OMX_BUFFERHEADERTYPE* input)
}
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 @@ void ISVProcessor::notifyFlush()
}
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 @@ void ISVProcessor::flush()
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 ISVProcThreadObserver::releaseBuffer(PORT_INDEX index, OMX_BUFFERH
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 @@ OMX_ERRORTYPE ISVProcThreadObserver::releaseBuffer(PORT_INDEX index, OMX_BUFFERH
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));