Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7b1cf4c authored by Sungtak Lee's avatar Sungtak Lee
Browse files

CCodec: Retain old stop()/release() behavior on HIDL HALs

Stop the decoder output surface first then stop the HAL when HIDL
Codec2 is enabled in order to keep the behavior same.

Still the behavior can be overrided by a boolean system property.
  debug.codec2.stop_hal_before_surface

Test: build
Bug: 339247977
Change-Id: I83ac981fb56920a98e22fde8d42d500c2c02b998
parent 492b739b
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -2229,9 +2229,15 @@ void CCodec::stop(bool pushBlankBuffer) {
    // See also b/300350761.
    //
    // The workaround is no longer needed with fetchGraphicBlock & C2Fence changes.
    // so we are reverting back to the logical sequence of the operations.
    // so we are reverting back to the logical sequence of the operations when
    // AIDL HALs are selected.
    // When the HIDL HALs are selected, we retained workaround(the reversed
    // order) as default in order to keep legacy behavior.
    bool stopHalBeforeSurface =
            Codec2Client::IsAidlSelected() ||
            property_get_bool("debug.codec2.stop_hal_before_surface", false);
    status_t err = C2_OK;
    if (android::media::codec::provider_->stop_hal_before_surface()) {
    if (stopHalBeforeSurface && android::media::codec::provider_->stop_hal_before_surface()) {
        err = comp->stop();
        mChannel->stopUseOutputSurface(pushBlankBuffer);
    } else {
@@ -2334,8 +2340,14 @@ void CCodec::release(bool sendCallback, bool pushBlankBuffer) {
    // See also b/300350761.
    //
    // 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()) {
    // so we are reverting back to the logical sequence of the operations when
    // AIDL HALs are selected.
    // When the HIDL HALs are selected, we retained workaround(the reversed
    // order) as default in order to keep legacy behavior.
    bool stopHalBeforeSurface =
            Codec2Client::IsAidlSelected() ||
            property_get_bool("debug.codec2.stop_hal_before_surface", false);
    if (stopHalBeforeSurface && android::media::codec::provider_->stop_hal_before_surface()) {
        comp->release();
        mChannel->stopUseOutputSurface(pushBlankBuffer);
    } else {