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

Commit 84198b72 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6249303 from ed19d2e9 to rvc-release

Change-Id: I678bb7c6f5c3c23e5778bdcd14b300bdc340804d
parents 7f54ad26 ed19d2e9
Loading
Loading
Loading
Loading

media/codec2/OWNERS

0 → 100644
+5 −0
Original line number Diff line number Diff line
set noparent
wonsik@google.com
lajos@google.com
pawin@google.com
taklee@google.com
+2 −0
Original line number Diff line number Diff line
set noparent
lajos@google.com
+6 −4
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ public:
            android::base::unique_fd &&fd0,
            android::base::unique_fd &&fd1) {
        Mutexed<Jobs>::Locked jobs(mJobs);
        auto it = jobs->queues.try_emplace(comp, comp, systemTime()).first;
        auto it = jobs->queues.try_emplace(comp, comp).first;
        it->second.workList.emplace_back(
                std::move(work), fenceFd, std::move(fd0), std::move(fd1));
        jobs->cond.broadcast();
@@ -79,7 +79,8 @@ protected:
            for (auto it = jobs->queues.begin(); it != jobs->queues.end(); ) {
                Queue &queue = it->second;
                if (queue.workList.empty()
                        || nowNs - queue.lastQueuedTimestampNs < kIntervalNs) {
                        || (queue.lastQueuedTimestampNs != 0 &&
                            nowNs - queue.lastQueuedTimestampNs < kIntervalNs)) {
                    ++it;
                    continue;
                }
@@ -104,6 +105,7 @@ protected:
                    sp<Fence> fence(new Fence(fenceFd));
                    fence->waitForever(LOG_TAG);
                }
                queue.lastQueuedTimestampNs = nowNs;
                comp->queue(&items);
                for (android::base::unique_fd &ufd : uniqueFds) {
                    (void)ufd.release();
@@ -143,8 +145,8 @@ private:
        android::base::unique_fd fd1;
    };
    struct Queue {
        Queue(const std::shared_ptr<Codec2Client::Component> &comp, nsecs_t timestamp)
            : component(comp), lastQueuedTimestampNs(timestamp) {}
        Queue(const std::shared_ptr<Codec2Client::Component> &comp)
            : component(comp), lastQueuedTimestampNs(0) {}
        Queue(const Queue &) = delete;
        Queue &operator =(const Queue &) = delete;

+8 −0
Original line number Diff line number Diff line
@@ -94,4 +94,12 @@ interface IResourceManagerService {
     *        remove existing override on originalPid if newPid is -1.
     */
    void overridePid(int originalPid, int newPid);

    /**
     * Mark a client for pending removal
     *
     * @param pid pid from which the client's resources will be removed.
     * @param clientId clientId within the pid that will be removed.
     */
    void markClientForPendingRemoval(int pid, long clientId);
}
+26 −1
Original line number Diff line number Diff line
@@ -199,6 +199,7 @@ struct MediaCodec::ResourceManagerServiceProxy : public RefBase {
    void addResource(const MediaResourceParcel &resource);
    void removeResource(const MediaResourceParcel &resource);
    void removeClient();
    void markClientForPendingRemoval();
    bool reclaimResource(const std::vector<MediaResourceParcel> &resources);

private:
@@ -280,6 +281,14 @@ void MediaCodec::ResourceManagerServiceProxy::removeClient() {
    mService->removeClient(mPid, getId(mClient));
}

void MediaCodec::ResourceManagerServiceProxy::markClientForPendingRemoval() {
    Mutex::Autolock _l(mLock);
    if (mService == nullptr) {
        return;
    }
    mService->markClientForPendingRemoval(mPid, getId(mClient));
}

bool MediaCodec::ResourceManagerServiceProxy::reclaimResource(
        const std::vector<MediaResourceParcel> &resources) {
    Mutex::Autolock _l(mLock);
@@ -1432,7 +1441,13 @@ status_t MediaCodec::reclaim(bool force) {

status_t MediaCodec::release() {
    sp<AMessage> msg = new AMessage(kWhatRelease, this);
    sp<AMessage> response;
    return PostAndAwaitResponse(msg, &response);
}

status_t MediaCodec::releaseAsync() {
    sp<AMessage> msg = new AMessage(kWhatRelease, this);
    msg->setInt32("async", 1);
    sp<AMessage> response;
    return PostAndAwaitResponse(msg, &response);
}
@@ -2600,7 +2615,9 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {

                    mResourceManagerProxy->removeClient();

                    if (mReplyID != nullptr) {
                        (new AMessage)->postReply(mReplyID);
                    }
                    break;
                }

@@ -2999,6 +3016,14 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                pushBlankBuffersToNativeWindow(mSurface.get());
            }

            int32_t async = 0;
            if (msg->findInt32("async", &async) && async) {
                mResourceManagerProxy->markClientForPendingRemoval();
                handleSetSurface(NULL);
                (new AMessage)->postReply(mReplyID);
                mReplyID = 0;
            }

            break;
        }

Loading