diff options
author | Sungtak Lee <taklee@google.com> | 2024-05-08 17:43:41 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-05-08 17:43:41 +0000 |
commit | 0c88d1c5ba12d74c8d6a30742dbfecfc29fe44b7 (patch) | |
tree | 94d5c95b693d303865646c03fcf10a5ab8ae6865 | |
parent | 1fc5eb4c381d637fb66f38f86649ced905ef3268 (diff) | |
parent | 34402aeb6dbd1bed270042f5eda0bfd657eb3d06 (diff) | |
download | av-0c88d1c5ba12d74c8d6a30742dbfecfc29fe44b7.tar.gz |
Merge changes from topic "ccodec-stop-hal-first" into main
* changes:
CCodec: stop()/release() HAL before stop using output surface
aconfig: add a bugfix flag stop_hal_before_surface
-rw-r--r-- | media/aconfig/codec_fwk.aconfig | 10 | ||||
-rw-r--r-- | media/codec2/sfplugin/CCodec.cpp | 25 |
2 files changed, 31 insertions, 4 deletions
diff --git a/media/aconfig/codec_fwk.aconfig b/media/aconfig/codec_fwk.aconfig index 6d934eedbf..9f64a2881a 100644 --- a/media/aconfig/codec_fwk.aconfig +++ b/media/aconfig/codec_fwk.aconfig @@ -108,6 +108,16 @@ flag { } flag { + name: "stop_hal_before_surface" + namespace: "codec_fwk" + description: "Bugfix flag for setting state early to avoid a race condition" + bug: "339247977" + metadata { + purpose: PURPOSE_BUGFIX + } +} + +flag { name: "teamfood" namespace: "codec_fwk" description: "Feature flag to track teamfood population" 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); |