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

Commit 24bf51ae authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "AudioPolicyManager: Abort on input descriptor inconsistency"

parents 72b9ee11 9baf44fb
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -180,8 +180,12 @@ public:
        return it->second;
    }
    virtual void removeClient(audio_port_handle_t portId) {
        LOG_ALWAYS_FATAL_IF(mClients.erase(portId) == 0,
        auto it = mClients.find(portId);
        LOG_ALWAYS_FATAL_IF(it == mClients.end(),
                "%s(%d): client does not exist", __func__, portId);
        LOG_ALWAYS_FATAL_IF(it->second->active(),
                "%s(%d): removing client still active!", __func__, portId);
        (void)mClients.erase(it);
    }
    size_t getClientCount() const {
        return mClients.size();
+6 −2
Original line number Diff line number Diff line
@@ -257,6 +257,9 @@ void AudioInputDescriptor::close()
            mProfile->curActiveCount--;
        }
        mProfile->curOpenCount--;
        LOG_ALWAYS_FATAL_IF(mProfile->curOpenCount <  mProfile->curActiveCount,
                "%s(%d): mProfile->curOpenCount %d < mProfile->curActiveCount %d.",
                __func__, mId, mProfile->curOpenCount, mProfile->curActiveCount);
        mIoHandle = AUDIO_IO_HANDLE_NONE;
    }
}
@@ -272,8 +275,9 @@ void AudioInputDescriptor::setClientActive(const sp<RecordClientDescriptor>& cli
    // Handle non-client-specific activity ref count
    int32_t oldGlobalActiveCount = mGlobalActiveCount;
    if (!active && mGlobalActiveCount < 1) {
        ALOGW("%s invalid deactivation with globalRefCount %d", __FUNCTION__, mGlobalActiveCount);
        mGlobalActiveCount = 1;
        LOG_ALWAYS_FATAL("%s(%d) invalid deactivation with globalActiveCount %d",
               __func__, client->portId(), mGlobalActiveCount);
        // mGlobalActiveCount = 1;
    }
    const int delta = active ? 1 : -1;
    mGlobalActiveCount += delta;