diff options
author | Sungtak Lee <taklee@google.com> | 2024-05-07 19:51:28 +0000 |
---|---|---|
committer | Sungtak Lee <taklee@google.com> | 2024-05-07 20:38:29 +0000 |
commit | 34402aeb6dbd1bed270042f5eda0bfd657eb3d06 (patch) | |
tree | f265ff26f8b1beb626d9b352959041321aa0b053 | |
parent | 6c6c7b2f90568d66c9fdaffda0a42aa6eeaf91f9 (diff) | |
download | av-34402aeb6dbd1bed270042f5eda0bfd657eb3d06.tar.gz |
CCodec: stop()/release() HAL before stop using output surface
Bug: 339247977
Test: atest CtsMediaDecoderTestCases
Change-Id: I7dd4c31d2525254dbb65bf9cb34858f3ff1a7352
-rw-r--r-- | media/codec2/sfplugin/CCodec.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/media/codec2/sfplugin/CCodec.cpp b/media/codec2/sfplugin/CCodec.cpp index 463b63fc7b..20b6d7f719 100644 --- a/media/codec2/sfplugin/CCodec.cpp +++ b/media/codec2/sfplugin/CCodec.cpp @@ -2227,8 +2227,17 @@ void CCodec::stop(bool pushBlankBuffer) { // 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(); + // + // The workaround is no longer needed with fetchGraphicBlock & C2Fence changes. + // so we are reverting back to the logical sequence of the operations. + status_t err = C2_OK; + if (android::media::codec::provider_->stop_hal_before_surface()) { + err = comp->stop(); + mChannel->stopUseOutputSurface(pushBlankBuffer); + } else { + mChannel->stopUseOutputSurface(pushBlankBuffer); + err = comp->stop(); + } if (err != C2_OK) { // TODO: convert err into status_t mCallback->onError(UNKNOWN_ERROR, ACTION_CODE_FATAL); @@ -2323,8 +2332,16 @@ void CCodec::release(bool sendCallback, bool pushBlankBuffer) { // So we reverse their order for stopUseOutputSurface() to notify C2Fence waiters // prior to comp->release(). // See also b/300350761. - mChannel->stopUseOutputSurface(pushBlankBuffer); - comp->release(); + // + // The workaround is no longer needed with fetchGraphicBlock & C2Fence changes. + // so we are reverting back to the logical sequence of the operations. + if (android::media::codec::provider_->stop_hal_before_surface()) { + comp->release(); + mChannel->stopUseOutputSurface(pushBlankBuffer); + } else { + mChannel->stopUseOutputSurface(pushBlankBuffer); + comp->release(); + } { Mutexed<State>::Locked state(mState); |