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

Commit 3244d0db authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "stagefright: notify async release complete" into rvc-dev

parents 45d5095e 80bc81ba
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -1482,9 +1482,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);
}
@@ -2695,6 +2695,11 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                    if (mReplyID != nullptr) {
                        (new AMessage)->postReply(mReplyID);
                    }
                    if (mAsyncReleaseCompleteNotification != nullptr) {
                        flushMediametrics();
                        mAsyncReleaseCompleteNotification->post();
                        mAsyncReleaseCompleteNotification.clear();
                    }
                    break;
                }

@@ -3081,8 +3086,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);
@@ -3114,10 +3119,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
@@ -139,7 +139,7 @@ struct MediaCodec : public AHandler {
    // object.
    status_t release();

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

    status_t flush();

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

    sp<ResourceManagerServiceProxy> mResourceManagerProxy;