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

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

Merge "resourcemanagerservice: make a copy of client config" into udc-dev

parents 9ae72618 b9876d4b
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -146,18 +146,21 @@ void ResourceManagerMetrics::notifyClientCreated(const ClientInfoParcel& clientI

void ResourceManagerMetrics::notifyClientReleased(const ClientInfoParcel& clientInfo) {
    bool stopCalled = true;
    ClientConfigMap::iterator found;
    ClientConfigParcel clientConfig;
    {
        std::scoped_lock lock(mLock);
        found = mClientConfigMap.find(clientInfo.id);
        ClientConfigMap::iterator found = mClientConfigMap.find(clientInfo.id);
        if (found != mClientConfigMap.end()) {
            // Release is called without Stop!
            stopCalled = false;
            clientConfig = found->second;
            // Update the timestamp for stopping the codec.
            clientConfig.timeStamp = systemTime(SYSTEM_TIME_MONOTONIC) / 1000LL;
        }
    }
    if (!stopCalled) {
        // call Stop to update the metrics.
        notifyClientStopped(found->second);
        notifyClientStopped(clientConfig);
    }
    {
        std::scoped_lock lock(mLock);