Loading media/codec2/hal/client/client.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -2372,7 +2372,7 @@ void Codec2Client::Component::stopUsingOutputSurface( void Codec2Client::Component::onBufferReleasedFromOutputSurface( uint32_t generation) { (void) generation; mOutputBufferQueue->onBufferReleased(generation); } c2_status_t Codec2Client::Component::connectToInputSurface( Loading media/codec2/hal/client/include/codec2/hidl/output.h +4 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,10 @@ struct OutputBufferQueue { const BnGraphicBufferProducer::QueueBufferInput& input, BnGraphicBufferProducer::QueueBufferOutput* output); // Nofify a buffer is released from the output surface. If HAL ver is 1.2 // update the number of dequeueable/allocatable buffers. void onBufferReleased(uint32_t generation); // Retrieve frame event history from the output surface. void pollForRenderedFrames(FrameEventHistoryDelta* delta); Loading media/codec2/hal/client/output.cpp +31 −6 Original line number Diff line number Diff line Loading @@ -441,10 +441,12 @@ status_t OutputBufferQueue::outputBuffer( status = outputIgbp->queueBuffer(static_cast<int>(bqSlot), input, output); if (status == OK) { if (output->bufferReplaced) { syncVar->lock(); syncVar->notifyQueuedLocked(); syncVar->unlock(); } } } else { status = outputIgbp->queueBuffer(static_cast<int>(bqSlot), input, output); Loading Loading @@ -496,10 +498,12 @@ status_t OutputBufferQueue::outputBuffer( status = outputIgbp->queueBuffer(static_cast<int>(bqSlot), input, output); if (status == OK) { if (output->bufferReplaced) { syncVar->lock(); syncVar->notifyQueuedLocked(); syncVar->unlock(); } } } else { status = outputIgbp->queueBuffer(static_cast<int>(bqSlot), input, output); Loading @@ -514,6 +518,27 @@ status_t OutputBufferQueue::outputBuffer( return OK; } void OutputBufferQueue::onBufferReleased(uint32_t generation) { std::shared_ptr<C2SurfaceSyncMemory> syncMem; mMutex.lock(); if (mStopped) { return; } sp<IGraphicBufferProducer> outputIgbp = mIgbp; uint32_t outputGeneration = mGeneration; syncMem = mSyncMem; mMutex.unlock(); if (outputIgbp && generation == outputGeneration) { auto syncVar = syncMem ? syncMem->mem() : nullptr; if (syncVar) { syncVar->lock(); syncVar->notifyQueuedLocked(); syncVar->unlock(); } } } void OutputBufferQueue::pollForRenderedFrames(FrameEventHistoryDelta* delta) { if (mIgbp) { mIgbp->getFrameTimestamps(delta); Loading Loading
media/codec2/hal/client/client.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -2372,7 +2372,7 @@ void Codec2Client::Component::stopUsingOutputSurface( void Codec2Client::Component::onBufferReleasedFromOutputSurface( uint32_t generation) { (void) generation; mOutputBufferQueue->onBufferReleased(generation); } c2_status_t Codec2Client::Component::connectToInputSurface( Loading
media/codec2/hal/client/include/codec2/hidl/output.h +4 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,10 @@ struct OutputBufferQueue { const BnGraphicBufferProducer::QueueBufferInput& input, BnGraphicBufferProducer::QueueBufferOutput* output); // Nofify a buffer is released from the output surface. If HAL ver is 1.2 // update the number of dequeueable/allocatable buffers. void onBufferReleased(uint32_t generation); // Retrieve frame event history from the output surface. void pollForRenderedFrames(FrameEventHistoryDelta* delta); Loading
media/codec2/hal/client/output.cpp +31 −6 Original line number Diff line number Diff line Loading @@ -441,10 +441,12 @@ status_t OutputBufferQueue::outputBuffer( status = outputIgbp->queueBuffer(static_cast<int>(bqSlot), input, output); if (status == OK) { if (output->bufferReplaced) { syncVar->lock(); syncVar->notifyQueuedLocked(); syncVar->unlock(); } } } else { status = outputIgbp->queueBuffer(static_cast<int>(bqSlot), input, output); Loading Loading @@ -496,10 +498,12 @@ status_t OutputBufferQueue::outputBuffer( status = outputIgbp->queueBuffer(static_cast<int>(bqSlot), input, output); if (status == OK) { if (output->bufferReplaced) { syncVar->lock(); syncVar->notifyQueuedLocked(); syncVar->unlock(); } } } else { status = outputIgbp->queueBuffer(static_cast<int>(bqSlot), input, output); Loading @@ -514,6 +518,27 @@ status_t OutputBufferQueue::outputBuffer( return OK; } void OutputBufferQueue::onBufferReleased(uint32_t generation) { std::shared_ptr<C2SurfaceSyncMemory> syncMem; mMutex.lock(); if (mStopped) { return; } sp<IGraphicBufferProducer> outputIgbp = mIgbp; uint32_t outputGeneration = mGeneration; syncMem = mSyncMem; mMutex.unlock(); if (outputIgbp && generation == outputGeneration) { auto syncVar = syncMem ? syncMem->mem() : nullptr; if (syncVar) { syncVar->lock(); syncVar->notifyQueuedLocked(); syncVar->unlock(); } } } void OutputBufferQueue::pollForRenderedFrames(FrameEventHistoryDelta* delta) { if (mIgbp) { mIgbp->getFrameTimestamps(delta); Loading