Loading media/codec2/hal/client/output.cpp +19 −3 Original line number Diff line number Diff line Loading @@ -336,9 +336,25 @@ void OutputBufferQueue::expireOldWaiters() { } void OutputBufferQueue::stop() { std::shared_ptr<C2SurfaceSyncMemory> oldMem; { std::scoped_lock<std::mutex> l(mMutex); if (mStopped) { return; } mStopped = true; mOwner.reset(); // destructor of the block will not triger IGBP::cancel() mOwner.reset(); // destructor of the block will not trigger IGBP::cancel() // basically configuring null surface oldMem = mSyncMem; mSyncMem.reset(); mIgbp.clear(); mGeneration = 0; mBqId = 0; } { std::scoped_lock<std::mutex> l(mOldMutex); mOldMem = oldMem; } } bool OutputBufferQueue::registerBuffer(const C2ConstGraphicBlock& block) { Loading media/codec2/sfplugin/CCodec.cpp +17 −2 Original line number Diff line number Diff line Loading @@ -1915,8 +1915,16 @@ void CCodec::stop(bool pushBlankBuffer) { } comp = state->comp; } status_t err = comp->stop(); // Note: Logically mChannel->stopUseOutputSurface() should be after comp->stop(). // But in the case some HAL implementations hang forever on comp->stop(). // (HAL is waiting for C2Fence until fetchGraphicBlock unblocks and not // completing stop()). // So we reverse their order for stopUseOutputSurface() to notify C2Fence waiters // prior to comp->stop(). // See also b/300350761. mChannel->stopUseOutputSurface(pushBlankBuffer); status_t err = comp->stop(); if (err != C2_OK) { // TODO: convert err into status_t mCallback->onError(UNKNOWN_ERROR, ACTION_CODE_FATAL); Loading Loading @@ -2004,8 +2012,15 @@ void CCodec::release(bool sendCallback, bool pushBlankBuffer) { } comp = state->comp; } comp->release(); // Note: Logically mChannel->stopUseOutputSurface() should be after comp->release(). // But in the case some HAL implementations hang forever on comp->release(). // (HAL is waiting for C2Fence until fetchGraphicBlock unblocks and not // completing release()). // So we reverse their order for stopUseOutputSurface() to notify C2Fence waiters // prior to comp->release(). // See also b/300350761. mChannel->stopUseOutputSurface(pushBlankBuffer); comp->release(); { Mutexed<State>::Locked state(mState); Loading Loading
media/codec2/hal/client/output.cpp +19 −3 Original line number Diff line number Diff line Loading @@ -336,9 +336,25 @@ void OutputBufferQueue::expireOldWaiters() { } void OutputBufferQueue::stop() { std::shared_ptr<C2SurfaceSyncMemory> oldMem; { std::scoped_lock<std::mutex> l(mMutex); if (mStopped) { return; } mStopped = true; mOwner.reset(); // destructor of the block will not triger IGBP::cancel() mOwner.reset(); // destructor of the block will not trigger IGBP::cancel() // basically configuring null surface oldMem = mSyncMem; mSyncMem.reset(); mIgbp.clear(); mGeneration = 0; mBqId = 0; } { std::scoped_lock<std::mutex> l(mOldMutex); mOldMem = oldMem; } } bool OutputBufferQueue::registerBuffer(const C2ConstGraphicBlock& block) { Loading
media/codec2/sfplugin/CCodec.cpp +17 −2 Original line number Diff line number Diff line Loading @@ -1915,8 +1915,16 @@ void CCodec::stop(bool pushBlankBuffer) { } comp = state->comp; } status_t err = comp->stop(); // Note: Logically mChannel->stopUseOutputSurface() should be after comp->stop(). // But in the case some HAL implementations hang forever on comp->stop(). // (HAL is waiting for C2Fence until fetchGraphicBlock unblocks and not // completing stop()). // So we reverse their order for stopUseOutputSurface() to notify C2Fence waiters // prior to comp->stop(). // See also b/300350761. mChannel->stopUseOutputSurface(pushBlankBuffer); status_t err = comp->stop(); if (err != C2_OK) { // TODO: convert err into status_t mCallback->onError(UNKNOWN_ERROR, ACTION_CODE_FATAL); Loading Loading @@ -2004,8 +2012,15 @@ void CCodec::release(bool sendCallback, bool pushBlankBuffer) { } comp = state->comp; } comp->release(); // Note: Logically mChannel->stopUseOutputSurface() should be after comp->release(). // But in the case some HAL implementations hang forever on comp->release(). // (HAL is waiting for C2Fence until fetchGraphicBlock unblocks and not // completing release()). // So we reverse their order for stopUseOutputSurface() to notify C2Fence waiters // prior to comp->release(). // See also b/300350761. mChannel->stopUseOutputSurface(pushBlankBuffer); comp->release(); { Mutexed<State>::Locked state(mState); Loading