diff options
author | Xin Wang <xin1.wang@intel.com> | 2016-04-27 19:35:56 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-04-27 19:35:56 +0000 |
commit | fb566e419ec31cd9d310bec2d3b94b2df4f1fea9 (patch) | |
tree | 3be576abe64593ebd7157d2e30842ed961bfcc8a | |
parent | 94ed394da200f817c039aaf9ed4492a80b32e8fd (diff) | |
parent | 08049b06ffadb903c643858d53236ce7f068765f (diff) | |
download | utils-fb566e419ec31cd9d310bec2d3b94b2df4f1fea9.tar.gz |
Fix video jump when bluetooth pairing video plays am: 70189ce am: 1d67423
am: 08049b0
* commit '08049b06ffadb903c643858d53236ce7f068765f':
Fix video jump when bluetooth pairing video plays
Change-Id: Ia96b0b8594200332bf88d3e94a711bbb52731509
-rw-r--r-- | ISV/base/isv_processor.cpp | 19 | ||||
-rw-r--r-- | ISV/omx/isv_omxcomponent.cpp | 9 |
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)); |