Loading media/codec2/sfplugin/CCodecBufferChannel.cpp +19 −34 Original line number Diff line number Diff line Loading @@ -1066,9 +1066,6 @@ status_t CCodecBufferChannel::start( Mutexed<OutputSurface>::Locked output(mOutputSurface); output->maxDequeueBuffers = numOutputSlots + reorderDepth.value + kRenderingDepth; if (!secure) { output->maxDequeueBuffers += numInputSlots; } outputSurface = output->surface ? output->surface->getIGraphicBufferProducer() : nullptr; if (outputSurface) { Loading Loading @@ -1529,6 +1526,7 @@ bool CCodecBufferChannel::handleWork( } std::optional<uint32_t> newInputDelay, newPipelineDelay; bool needMaxDequeueBufferCountUpdate = false; while (!worklet->output.configUpdate.empty()) { std::unique_ptr<C2Param> param; worklet->output.configUpdate.back().swap(param); Loading @@ -1537,24 +1535,10 @@ bool CCodecBufferChannel::handleWork( case C2PortReorderBufferDepthTuning::CORE_INDEX: { C2PortReorderBufferDepthTuning::output reorderDepth; if (reorderDepth.updateFrom(*param)) { bool secure = mComponent->getName().find(".secure") != std::string::npos; mOutput.lock()->buffers->setReorderDepth( reorderDepth.value); ALOGV("[%s] onWorkDone: updated reorder depth to %u", mName, reorderDepth.value); size_t numOutputSlots = mOutput.lock()->numSlots; size_t numInputSlots = mInput.lock()->numSlots; Mutexed<OutputSurface>::Locked output(mOutputSurface); output->maxDequeueBuffers = numOutputSlots + reorderDepth.value + kRenderingDepth; if (!secure) { output->maxDequeueBuffers += numInputSlots; } if (output->surface) { output->surface->setMaxDequeuedBufferCount( output->maxDequeueBuffers); } mOutput.lock()->buffers->setReorderDepth(reorderDepth.value); needMaxDequeueBufferCountUpdate = true; } else { ALOGD("[%s] onWorkDone: failed to read reorder depth", mName); Loading Loading @@ -1598,14 +1582,11 @@ bool CCodecBufferChannel::handleWork( if (outputDelay.updateFrom(*param)) { ALOGV("[%s] onWorkDone: updating output delay %u", mName, outputDelay.value); bool secure = mComponent->getName().find(".secure") != std::string::npos; (void)mPipelineWatcher.lock()->outputDelay( outputDelay.value); (void)mPipelineWatcher.lock()->outputDelay(outputDelay.value); needMaxDequeueBufferCountUpdate = true; bool outputBuffersChanged = false; size_t numOutputSlots = 0; size_t numInputSlots = mInput.lock()->numSlots; { Mutexed<Output>::Locked output(mOutput); if (!output->buffers) { Loading @@ -1631,16 +1612,6 @@ bool CCodecBufferChannel::handleWork( if (outputBuffersChanged) { mCCodecCallback->onOutputBuffersChanged(); } uint32_t depth = mOutput.lock()->buffers->getReorderDepth(); Mutexed<OutputSurface>::Locked output(mOutputSurface); output->maxDequeueBuffers = numOutputSlots + depth + kRenderingDepth; if (!secure) { output->maxDequeueBuffers += numInputSlots; } if (output->surface) { output->surface->setMaxDequeuedBufferCount(output->maxDequeueBuffers); } } } break; Loading Loading @@ -1669,6 +1640,20 @@ bool CCodecBufferChannel::handleWork( input->numSlots = newNumSlots; } } if (needMaxDequeueBufferCountUpdate) { size_t numOutputSlots = 0; uint32_t reorderDepth = 0; { Mutexed<Output>::Locked output(mOutput); numOutputSlots = output->numSlots; reorderDepth = output->buffers->getReorderDepth(); } Mutexed<OutputSurface>::Locked output(mOutputSurface); output->maxDequeueBuffers = numOutputSlots + reorderDepth + kRenderingDepth; if (output->surface) { output->surface->setMaxDequeuedBufferCount(output->maxDequeueBuffers); } } int32_t flags = 0; if (worklet->output.flags & C2FrameData::FLAG_END_OF_STREAM) { Loading Loading
media/codec2/sfplugin/CCodecBufferChannel.cpp +19 −34 Original line number Diff line number Diff line Loading @@ -1066,9 +1066,6 @@ status_t CCodecBufferChannel::start( Mutexed<OutputSurface>::Locked output(mOutputSurface); output->maxDequeueBuffers = numOutputSlots + reorderDepth.value + kRenderingDepth; if (!secure) { output->maxDequeueBuffers += numInputSlots; } outputSurface = output->surface ? output->surface->getIGraphicBufferProducer() : nullptr; if (outputSurface) { Loading Loading @@ -1529,6 +1526,7 @@ bool CCodecBufferChannel::handleWork( } std::optional<uint32_t> newInputDelay, newPipelineDelay; bool needMaxDequeueBufferCountUpdate = false; while (!worklet->output.configUpdate.empty()) { std::unique_ptr<C2Param> param; worklet->output.configUpdate.back().swap(param); Loading @@ -1537,24 +1535,10 @@ bool CCodecBufferChannel::handleWork( case C2PortReorderBufferDepthTuning::CORE_INDEX: { C2PortReorderBufferDepthTuning::output reorderDepth; if (reorderDepth.updateFrom(*param)) { bool secure = mComponent->getName().find(".secure") != std::string::npos; mOutput.lock()->buffers->setReorderDepth( reorderDepth.value); ALOGV("[%s] onWorkDone: updated reorder depth to %u", mName, reorderDepth.value); size_t numOutputSlots = mOutput.lock()->numSlots; size_t numInputSlots = mInput.lock()->numSlots; Mutexed<OutputSurface>::Locked output(mOutputSurface); output->maxDequeueBuffers = numOutputSlots + reorderDepth.value + kRenderingDepth; if (!secure) { output->maxDequeueBuffers += numInputSlots; } if (output->surface) { output->surface->setMaxDequeuedBufferCount( output->maxDequeueBuffers); } mOutput.lock()->buffers->setReorderDepth(reorderDepth.value); needMaxDequeueBufferCountUpdate = true; } else { ALOGD("[%s] onWorkDone: failed to read reorder depth", mName); Loading Loading @@ -1598,14 +1582,11 @@ bool CCodecBufferChannel::handleWork( if (outputDelay.updateFrom(*param)) { ALOGV("[%s] onWorkDone: updating output delay %u", mName, outputDelay.value); bool secure = mComponent->getName().find(".secure") != std::string::npos; (void)mPipelineWatcher.lock()->outputDelay( outputDelay.value); (void)mPipelineWatcher.lock()->outputDelay(outputDelay.value); needMaxDequeueBufferCountUpdate = true; bool outputBuffersChanged = false; size_t numOutputSlots = 0; size_t numInputSlots = mInput.lock()->numSlots; { Mutexed<Output>::Locked output(mOutput); if (!output->buffers) { Loading @@ -1631,16 +1612,6 @@ bool CCodecBufferChannel::handleWork( if (outputBuffersChanged) { mCCodecCallback->onOutputBuffersChanged(); } uint32_t depth = mOutput.lock()->buffers->getReorderDepth(); Mutexed<OutputSurface>::Locked output(mOutputSurface); output->maxDequeueBuffers = numOutputSlots + depth + kRenderingDepth; if (!secure) { output->maxDequeueBuffers += numInputSlots; } if (output->surface) { output->surface->setMaxDequeuedBufferCount(output->maxDequeueBuffers); } } } break; Loading Loading @@ -1669,6 +1640,20 @@ bool CCodecBufferChannel::handleWork( input->numSlots = newNumSlots; } } if (needMaxDequeueBufferCountUpdate) { size_t numOutputSlots = 0; uint32_t reorderDepth = 0; { Mutexed<Output>::Locked output(mOutput); numOutputSlots = output->numSlots; reorderDepth = output->buffers->getReorderDepth(); } Mutexed<OutputSurface>::Locked output(mOutputSurface); output->maxDequeueBuffers = numOutputSlots + reorderDepth + kRenderingDepth; if (output->surface) { output->surface->setMaxDequeuedBufferCount(output->maxDequeueBuffers); } } int32_t flags = 0; if (worklet->output.flags & C2FrameData::FLAG_END_OF_STREAM) { Loading