Loading media/libstagefright/ACodec.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -4864,6 +4864,12 @@ void ACodec::BaseState::onInputBufferFilled(const sp<AMessage> &msg) { case RESUBMIT_BUFFERS: { if (buffer != NULL && !mCodec->mPortEOS[kPortIndexInput]) { // Do not send empty input buffer w/o EOS to the component. if (buffer->size() == 0 && !eos) { postFillThisBuffer(info); break; } int64_t timeUs; CHECK(buffer->meta()->findInt64("timeUs", &timeUs)); Loading media/libstagefright/codecs/avcdec/SoftAVCDec.cpp +14 −2 Original line number Diff line number Diff line Loading @@ -641,6 +641,11 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) { if (!inQueue.empty()) { inInfo = *inQueue.begin(); inHeader = inInfo->mHeader; if (inHeader == NULL) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; continue; } } else { break; } Loading @@ -652,14 +657,21 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) { outHeader->nTimeStamp = 0; outHeader->nOffset = 0; if (inHeader != NULL && (inHeader->nFlags & OMX_BUFFERFLAG_EOS)) { mReceivedEOS = true; if (inHeader != NULL) { if (inHeader->nFilledLen == 0) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; notifyEmptyBufferDone(inHeader); if (!(inHeader->nFlags & OMX_BUFFERFLAG_EOS)) { continue; } mReceivedEOS = true; inHeader = NULL; setFlushMode(); } else if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) { mReceivedEOS = true; } } Loading media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp +20 −13 Original line number Diff line number Diff line Loading @@ -103,19 +103,25 @@ void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { while (!inQueue.empty() && outQueue.size() == kNumOutputBuffers) { BufferInfo *inInfo = *inQueue.begin(); OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader; if (inHeader == NULL) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; continue; } PortInfo *port = editPortInfo(1); OMX_BUFFERHEADERTYPE *outHeader = port->mBuffers.editItemAt(mNumSamplesOutput & 1).mHeader; if ((inHeader->nFlags & OMX_BUFFERFLAG_EOS) && inHeader->nFilledLen == 0) { if (inHeader->nFilledLen == 0) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; notifyEmptyBufferDone(inHeader); ++mInputBufferCount; if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) { outHeader->nFilledLen = 0; outHeader->nFlags = OMX_BUFFERFLAG_EOS; Loading @@ -131,6 +137,7 @@ void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { notifyFillBufferDone(outHeader); outHeader = NULL; } return; } Loading media/libstagefright/omx/SimpleSoftOMXComponent.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -505,7 +505,15 @@ void SimpleSoftOMXComponent::onPortFlush( CHECK_LT(portIndex, mPorts.size()); PortInfo *port = &mPorts.editItemAt(portIndex); CHECK_EQ((int)port->mTransition, (int)PortInfo::NONE); // Ideally, the port should not in transitioning state when flushing. // However, in error handling case, e.g., the client can't allocate buffers // when it tries to re-enable the port, the port will be stuck in ENABLING. // The client will then transition the component from Executing to Idle, // which leads to flushing ports. At this time, it should be ok to notify // the client of the error and still clear all buffers on the port. if (port->mTransition != PortInfo::NONE) { notify(OMX_EventError, OMX_ErrorUndefined, 0, 0); } for (size_t i = 0; i < port->mBuffers.size(); ++i) { BufferInfo *buffer = &port->mBuffers.editItemAt(i); Loading Loading
media/libstagefright/ACodec.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -4864,6 +4864,12 @@ void ACodec::BaseState::onInputBufferFilled(const sp<AMessage> &msg) { case RESUBMIT_BUFFERS: { if (buffer != NULL && !mCodec->mPortEOS[kPortIndexInput]) { // Do not send empty input buffer w/o EOS to the component. if (buffer->size() == 0 && !eos) { postFillThisBuffer(info); break; } int64_t timeUs; CHECK(buffer->meta()->findInt64("timeUs", &timeUs)); Loading
media/libstagefright/codecs/avcdec/SoftAVCDec.cpp +14 −2 Original line number Diff line number Diff line Loading @@ -641,6 +641,11 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) { if (!inQueue.empty()) { inInfo = *inQueue.begin(); inHeader = inInfo->mHeader; if (inHeader == NULL) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; continue; } } else { break; } Loading @@ -652,14 +657,21 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) { outHeader->nTimeStamp = 0; outHeader->nOffset = 0; if (inHeader != NULL && (inHeader->nFlags & OMX_BUFFERFLAG_EOS)) { mReceivedEOS = true; if (inHeader != NULL) { if (inHeader->nFilledLen == 0) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; notifyEmptyBufferDone(inHeader); if (!(inHeader->nFlags & OMX_BUFFERFLAG_EOS)) { continue; } mReceivedEOS = true; inHeader = NULL; setFlushMode(); } else if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) { mReceivedEOS = true; } } Loading
media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp +20 −13 Original line number Diff line number Diff line Loading @@ -103,19 +103,25 @@ void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { while (!inQueue.empty() && outQueue.size() == kNumOutputBuffers) { BufferInfo *inInfo = *inQueue.begin(); OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader; if (inHeader == NULL) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; continue; } PortInfo *port = editPortInfo(1); OMX_BUFFERHEADERTYPE *outHeader = port->mBuffers.editItemAt(mNumSamplesOutput & 1).mHeader; if ((inHeader->nFlags & OMX_BUFFERFLAG_EOS) && inHeader->nFilledLen == 0) { if (inHeader->nFilledLen == 0) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; notifyEmptyBufferDone(inHeader); ++mInputBufferCount; if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) { outHeader->nFilledLen = 0; outHeader->nFlags = OMX_BUFFERFLAG_EOS; Loading @@ -131,6 +137,7 @@ void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { notifyFillBufferDone(outHeader); outHeader = NULL; } return; } Loading
media/libstagefright/omx/SimpleSoftOMXComponent.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -505,7 +505,15 @@ void SimpleSoftOMXComponent::onPortFlush( CHECK_LT(portIndex, mPorts.size()); PortInfo *port = &mPorts.editItemAt(portIndex); CHECK_EQ((int)port->mTransition, (int)PortInfo::NONE); // Ideally, the port should not in transitioning state when flushing. // However, in error handling case, e.g., the client can't allocate buffers // when it tries to re-enable the port, the port will be stuck in ENABLING. // The client will then transition the component from Executing to Idle, // which leads to flushing ports. At this time, it should be ok to notify // the client of the error and still clear all buffers on the port. if (port->mTransition != PortInfo::NONE) { notify(OMX_EventError, OMX_ErrorUndefined, 0, 0); } for (size_t i = 0; i < port->mBuffers.size(); ++i) { BufferInfo *buffer = &port->mBuffers.editItemAt(i); Loading