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

Commit 5869ba91 authored by Wonsik Kim's avatar Wonsik Kim Committed by Cherrypicker Worker
Browse files

MediaCodec: force synchronous release if setting release surface fails

Bug: 191966399
Test: presubmit
Change-Id: I50ef86e42cf2049d2bdad9e60d509d2ce05356b9
(cherry picked from commit dd67a5ff)
Merged-In: I50ef86e42cf2049d2bdad9e60d509d2ce05356b9
parent 448ae113
Loading
Loading
Loading
Loading
+26 −21
Original line number Diff line number Diff line
@@ -4155,8 +4155,8 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                break;
            }

            if (asyncNotify != nullptr) {
                if (mSurface != NULL) {
            bool forceSync = false;
            if (asyncNotify != nullptr && mSurface != NULL) {
                if (!mReleaseSurface) {
                    uint64_t usage = 0;
                    if (mSurface->getConsumerUsage(&usage) != OK) {
@@ -4174,7 +4174,10 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                    if (err == OK) {
                        (void)disconnectFromSurface();
                        mSurface = mReleaseSurface->getSurface();
                        }
                    } else {
                        // We were not able to switch the surface, so force
                        // synchronous release.
                        forceSync = true;
                    }
                }
            }
@@ -4198,8 +4201,10 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
            }

            if (asyncNotify != nullptr) {
                if (!forceSync) {
                    mResourceManagerProxy->markClientForPendingRemoval();
                    postPendingRepliesAndDeferredMessages("kWhatRelease:async");
                }
                asyncNotifyPost.clear();
                mAsyncReleaseCompleteNotification = asyncNotify;
            }