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

Commit b4a3b65d authored by Wonsik Kim's avatar Wonsik Kim Committed by Android (Google) Code Review
Browse files

Merge changes I4dd906fe,I2ef7f266 into rvc-dev

* changes:
  MediaCodec: set release surface in more states
  CCodec: fix resource releases
parents 72c3e0bb fa9ced08
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1402,6 +1402,7 @@ void CCodecBufferChannel::stop() {
    if (mInputSurface != nullptr) {
        mInputSurface.reset();
    }
    mPipelineWatcher.lock()->flush();
}

void CCodecBufferChannel::reset() {
@@ -1409,6 +1410,7 @@ void CCodecBufferChannel::reset() {
    {
        Mutexed<Input>::Locked input(mInput);
        input->buffers.reset(new DummyInputBuffers(""));
        input->extraBuffers.flush();
    }
    {
        Mutexed<Output>::Locked output(mOutput);
@@ -1425,6 +1427,8 @@ void CCodecBufferChannel::release() {
        blockPools->inputPool.reset();
        blockPools->outputPoolIntf.reset();
    }
    setCrypto(nullptr);
    setDescrambler(nullptr);
}


+12 −11
Original line number Diff line number Diff line
@@ -3036,11 +3036,11 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {

            int32_t async = 0;
            if (msg->findInt32("async", &async) && async) {
                if ((mState ==  CONFIGURED || mState == STARTED || mState == FLUSHED)
                       && mSurface != NULL) {
                if (mSurface != NULL) {
                    if (!mReleaseSurface) {
                        mReleaseSurface.reset(new ReleaseSurface);
                    }
                    if (mSurface != mReleaseSurface->getSurface()) {
                        status_t err = connectToSurface(mReleaseSurface->getSurface());
                        ALOGW_IF(err != OK, "error connecting to release surface: err = %d", err);
                        if (err == OK && !(mFlags & kFlagUsesSoftwareRenderer)) {
@@ -3053,6 +3053,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                        }
                    }
                }
            }

            mReplyID = replyID;
            setState(msg->what() == kWhatStop ? STOPPING : RELEASING);