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

Commit 5d278695 authored by Aayush Soni's avatar Aayush Soni
Browse files

C2SoftAomEnc: Fix onStop() implementation

Reset C2SoftAomEnc mRequestSync state properly when the stop call is made.

Whenever an IDR frame is requested, the plugin after servicing the request clears the request. This clear request call manifests as a dummy request IDR call with value of mIntf->mRequestIDR is 0.

If a request IDR is not serviced, stop call is made and codec component is reconfigured for next encode cycle then old unserviced handle idr interface handle is used to initialize plugin context, which remains unserviced through out the life of encoding.

This uncleared interface request disallows any new idr requests. So, clear the state before stopping.

Bug: 147348711
Test: atest android.mediav2.cts

Change-Id: Ic5163f492013ad0912c3c14a3305294e5a48072a
parent 80ad54f6
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -338,6 +338,19 @@ c2_status_t C2SoftAomEnc::onInit() {
}

c2_status_t C2SoftAomEnc::onStop() {
    IntfImpl::Lock lock = mIntf->lock();
    std::shared_ptr<C2StreamRequestSyncFrameTuning::output> requestSync = mIntf->getRequestSync_l();
    lock.unlock();
    if (requestSync != mRequestSync) {
        // we can handle IDR immediately
        if (requestSync->value) {
            // unset request
            C2StreamRequestSyncFrameTuning::output clearSync(0u, C2_FALSE);
            std::vector<std::unique_ptr<C2SettingResult>> failures;
            mIntf->config({ &clearSync }, C2_MAY_BLOCK, &failures);
        }
        mRequestSync = requestSync;
    }
    onRelease();
    return C2_OK;
}