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

Commit 0da727de authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "stagefright: notify async release complete" into rvc-dev am: 3244d0db...

Merge "stagefright: notify async release complete" into rvc-dev am: 3244d0db am: cb2a9094 am: 0d114fc6 am: 385bbff0

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/11795217

Change-Id: I3ac9934f452670ee443d25480a5e35edd66eb3b6
parents 8100a0b8 385bbff0
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -1483,9 +1483,9 @@ status_t MediaCodec::release() {
    return PostAndAwaitResponse(msg, &response);
}

status_t MediaCodec::releaseAsync() {
status_t MediaCodec::releaseAsync(const sp<AMessage> &notify) {
    sp<AMessage> msg = new AMessage(kWhatRelease, this);
    msg->setInt32("async", 1);
    msg->setMessage("async", notify);
    sp<AMessage> response;
    return PostAndAwaitResponse(msg, &response);
}
@@ -2696,6 +2696,11 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                    if (mReplyID != nullptr) {
                        (new AMessage)->postReply(mReplyID);
                    }
                    if (mAsyncReleaseCompleteNotification != nullptr) {
                        flushMediametrics();
                        mAsyncReleaseCompleteNotification->post();
                        mAsyncReleaseCompleteNotification.clear();
                    }
                    break;
                }

@@ -3082,8 +3087,8 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                break;
            }

            int32_t async = 0;
            if (msg->findInt32("async", &async) && async) {
            sp<AMessage> asyncNotify;
            if (msg->findMessage("async", &asyncNotify) && asyncNotify != nullptr) {
                if (mSurface != NULL) {
                    if (!mReleaseSurface) {
                        mReleaseSurface.reset(new ReleaseSurface);
@@ -3115,10 +3120,11 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                pushBlankBuffersToNativeWindow(mSurface.get());
            }

            if (async) {
            if (asyncNotify != nullptr) {
                mResourceManagerProxy->markClientForPendingRemoval();
                (new AMessage)->postReply(mReplyID);
                mReplyID = 0;
                mAsyncReleaseCompleteNotification = asyncNotify;
            }

            break;
+2 −1
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ struct MediaCodec : public AHandler {
    // object.
    status_t release();

    status_t releaseAsync();
    status_t releaseAsync(const sp<AMessage> &notify);

    status_t flush();

@@ -390,6 +390,7 @@ private:
    sp<AMessage> mInputFormat;
    sp<AMessage> mCallback;
    sp<AMessage> mOnFrameRenderedNotification;
    sp<AMessage> mAsyncReleaseCompleteNotification;

    sp<ResourceManagerServiceProxy> mResourceManagerProxy;