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

Commit 34402aeb authored by Sungtak Lee's avatar Sungtak Lee
Browse files

CCodec: stop()/release() HAL before stop using output surface

Bug: 339247977
Test: atest CtsMediaDecoderTestCases
Change-Id: I7dd4c31d2525254dbb65bf9cb34858f3ff1a7352
parent 6c6c7b2f
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -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.
    //
    // 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);
    status_t err = comp->stop();
    } 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.
    //
    // 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);