Loading media/codec2/sfplugin/CCodecBufferChannel.cpp +29 −16 Original line number Diff line number Diff line Loading @@ -220,7 +220,6 @@ CCodecBufferChannel::CCodecBufferChannel( const std::shared_ptr<CCodecCallback> &callback) : mHeapSeqNum(-1), mCCodecCallback(callback), mDelay(0), mFrameIndex(0u), mFirstValidFrameIndex(0u), mMetaMode(MODE_NONE), Loading Loading @@ -814,7 +813,6 @@ status_t CCodecBufferChannel::start( size_t numInputSlots = inputDelayValue + pipelineDelayValue + kSmoothnessFactor; size_t numOutputSlots = outputDelayValue + kSmoothnessFactor; mDelay = inputDelayValue + pipelineDelayValue + outputDelayValue; // TODO: get this from input format bool secure = mComponent->getName().find(".secure") != std::string::npos; Loading Loading @@ -1377,9 +1375,11 @@ bool CCodecBufferChannel::handleWork( (void)mPipelineWatcher.lock()->outputDelay(outputDelay.value); bool outputBuffersChanged = false; size_t numOutputSlots = 0; { Mutexed<Output>::Locked output(mOutput); output->outputDelay = outputDelay.value; size_t numOutputSlots = outputDelay.value + kSmoothnessFactor; numOutputSlots = outputDelay.value + kSmoothnessFactor; if (output->numSlots < numOutputSlots) { output->numSlots = numOutputSlots; if (output->buffers->isArrayMode()) { Loading @@ -1391,11 +1391,19 @@ bool CCodecBufferChannel::handleWork( outputBuffersChanged = true; } } output.unlock(); numOutputSlots = output->numSlots; } if (outputBuffersChanged) { mCCodecCallback->onOutputBuffersChanged(); } uint32_t depth = mReorderStash.lock()->depth(); Mutexed<OutputSurface>::Locked output(mOutputSurface); output->maxDequeueBuffers = numOutputSlots + depth + kRenderingDepth; if (output->surface) { output->surface->setMaxDequeuedBufferCount(output->maxDequeueBuffers); } } } break; Loading Loading @@ -1620,7 +1628,12 @@ PipelineWatcher::Clock::duration CCodecBufferChannel::elapsed() { // When client pushed EOS, we want all the work to be done quickly. // Otherwise, component may have stalled work due to input starvation up to // the sum of the delay in the pipeline. size_t n = mInputMetEos ? 0 : mDelay; size_t n = 0; if (!mInputMetEos) { size_t outputDelay = mOutput.lock()->outputDelay; Mutexed<Input>::Locked input(mInput); n = input->inputDelay + input->pipelineDelay + outputDelay; } return mPipelineWatcher.lock()->elapsed(PipelineWatcher::Clock::now(), n); } Loading media/codec2/sfplugin/CCodecBufferChannel.h +1 −2 Original line number Diff line number Diff line Loading @@ -228,8 +228,6 @@ private: QueueSync mQueueSync; std::vector<std::unique_ptr<C2Param>> mParamsToBeSet; size_t mDelay; struct Input { Input(); Loading Loading @@ -306,6 +304,7 @@ private: const C2WorkOrdinalStruct &ordinal); void defer(const Entry &entry); bool hasPending() const; uint32_t depth() const { return mDepth; } private: std::list<Entry> mPending; Loading Loading
media/codec2/sfplugin/CCodecBufferChannel.cpp +29 −16 Original line number Diff line number Diff line Loading @@ -220,7 +220,6 @@ CCodecBufferChannel::CCodecBufferChannel( const std::shared_ptr<CCodecCallback> &callback) : mHeapSeqNum(-1), mCCodecCallback(callback), mDelay(0), mFrameIndex(0u), mFirstValidFrameIndex(0u), mMetaMode(MODE_NONE), Loading Loading @@ -814,7 +813,6 @@ status_t CCodecBufferChannel::start( size_t numInputSlots = inputDelayValue + pipelineDelayValue + kSmoothnessFactor; size_t numOutputSlots = outputDelayValue + kSmoothnessFactor; mDelay = inputDelayValue + pipelineDelayValue + outputDelayValue; // TODO: get this from input format bool secure = mComponent->getName().find(".secure") != std::string::npos; Loading Loading @@ -1377,9 +1375,11 @@ bool CCodecBufferChannel::handleWork( (void)mPipelineWatcher.lock()->outputDelay(outputDelay.value); bool outputBuffersChanged = false; size_t numOutputSlots = 0; { Mutexed<Output>::Locked output(mOutput); output->outputDelay = outputDelay.value; size_t numOutputSlots = outputDelay.value + kSmoothnessFactor; numOutputSlots = outputDelay.value + kSmoothnessFactor; if (output->numSlots < numOutputSlots) { output->numSlots = numOutputSlots; if (output->buffers->isArrayMode()) { Loading @@ -1391,11 +1391,19 @@ bool CCodecBufferChannel::handleWork( outputBuffersChanged = true; } } output.unlock(); numOutputSlots = output->numSlots; } if (outputBuffersChanged) { mCCodecCallback->onOutputBuffersChanged(); } uint32_t depth = mReorderStash.lock()->depth(); Mutexed<OutputSurface>::Locked output(mOutputSurface); output->maxDequeueBuffers = numOutputSlots + depth + kRenderingDepth; if (output->surface) { output->surface->setMaxDequeuedBufferCount(output->maxDequeueBuffers); } } } break; Loading Loading @@ -1620,7 +1628,12 @@ PipelineWatcher::Clock::duration CCodecBufferChannel::elapsed() { // When client pushed EOS, we want all the work to be done quickly. // Otherwise, component may have stalled work due to input starvation up to // the sum of the delay in the pipeline. size_t n = mInputMetEos ? 0 : mDelay; size_t n = 0; if (!mInputMetEos) { size_t outputDelay = mOutput.lock()->outputDelay; Mutexed<Input>::Locked input(mInput); n = input->inputDelay + input->pipelineDelay + outputDelay; } return mPipelineWatcher.lock()->elapsed(PipelineWatcher::Clock::now(), n); } Loading
media/codec2/sfplugin/CCodecBufferChannel.h +1 −2 Original line number Diff line number Diff line Loading @@ -228,8 +228,6 @@ private: QueueSync mQueueSync; std::vector<std::unique_ptr<C2Param>> mParamsToBeSet; size_t mDelay; struct Input { Input(); Loading Loading @@ -306,6 +304,7 @@ private: const C2WorkOrdinalStruct &ordinal); void defer(const Entry &entry); bool hasPending() const; uint32_t depth() const { return mDepth; } private: std::list<Entry> mPending; Loading