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

Commit f8edf68a authored by Glenn Kasten's avatar Glenn Kasten Committed by Android (Google) Code Review
Browse files

Merge "Rename fields of AudioSessionRef"

parents 92b8360f 012ca6b4
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -310,10 +310,10 @@ status_t AudioFlinger::dumpClients(int fd, const Vector<String16>& args)
    }

    result.append("Global session refs:\n");
    result.append(" session pid cnt\n");
    result.append(" session pid count\n");
    for (size_t i = 0; i < mAudioSessionRefs.size(); i++) {
        AudioSessionRef *r = mAudioSessionRefs[i];
        snprintf(buffer, SIZE, " %7d %3d %3d\n", r->sessionid, r->pid, r->cnt);
        snprintf(buffer, SIZE, " %7d %3d %3d\n", r->mSessionid, r->mPid, r->mCnt);
        result.append(buffer);
    }
    write(fd, result.string(), result.size());
@@ -1036,9 +1036,9 @@ void AudioFlinger::removeNotificationClient(pid_t pid)
    bool removed = false;
    for (size_t i = 0; i< num; ) {
        AudioSessionRef *ref = mAudioSessionRefs.itemAt(i);
        ALOGV(" pid %d @ %d", ref->pid, i);
        if (ref->pid == pid) {
            ALOGV(" removing entry for pid %d session %d", pid, ref->sessionid);
        ALOGV(" pid %d @ %d", ref->mPid, i);
        if (ref->mPid == pid) {
            ALOGV(" removing entry for pid %d session %d", pid, ref->mSessionid);
            mAudioSessionRefs.removeAt(i);
            delete ref;
            removed = true;
@@ -5699,9 +5699,9 @@ void AudioFlinger::acquireAudioSessionId(int audioSession)
    size_t num = mAudioSessionRefs.size();
    for (size_t i = 0; i< num; i++) {
        AudioSessionRef *ref = mAudioSessionRefs.editItemAt(i);
        if (ref->sessionid == audioSession && ref->pid == caller) {
            ref->cnt++;
            ALOGV(" incremented refcount to %d", ref->cnt);
        if (ref->mSessionid == audioSession && ref->mPid == caller) {
            ref->mCnt++;
            ALOGV(" incremented refcount to %d", ref->mCnt);
            return;
        }
    }
@@ -5717,10 +5717,10 @@ void AudioFlinger::releaseAudioSessionId(int audioSession)
    size_t num = mAudioSessionRefs.size();
    for (size_t i = 0; i< num; i++) {
        AudioSessionRef *ref = mAudioSessionRefs.itemAt(i);
        if (ref->sessionid == audioSession && ref->pid == caller) {
            ref->cnt--;
            ALOGV(" decremented refcount to %d", ref->cnt);
            if (ref->cnt == 0) {
        if (ref->mSessionid == audioSession && ref->mPid == caller) {
            ref->mCnt--;
            ALOGV(" decremented refcount to %d", ref->mCnt);
            if (ref->mCnt == 0) {
                mAudioSessionRefs.removeAt(i);
                delete ref;
                purgeStaleEffects_l();
@@ -5765,9 +5765,9 @@ void AudioFlinger::purgeStaleEffects_l() {
        bool found = false;
        for (size_t k = 0; k < numsessionrefs; k++) {
            AudioSessionRef *ref = mAudioSessionRefs.itemAt(k);
            if (ref->sessionid == sessionid) {
            if (ref->mSessionid == sessionid) {
                ALOGV(" session %d still exists for %d with %d refs",
                     sessionid, ref->pid, ref->cnt);
                     sessionid, ref->mPid, ref->mCnt);
                found = true;
                break;
            }
+5 −6
Original line number Diff line number Diff line
@@ -1572,12 +1572,11 @@ mutable Mutex mLock; // mutex for process, commands and handl

    // for mAudioSessionRefs only
    struct AudioSessionRef {
        // FIXME rename parameter names when fields get "m" prefix
        AudioSessionRef(int sessionid_, pid_t pid_) :
            sessionid(sessionid_), pid(pid_), cnt(1) {}
        const int sessionid;
        const pid_t pid;
        int cnt;
        AudioSessionRef(int sessionid, pid_t pid) :
            mSessionid(sessionid), mPid(pid), mCnt(1) {}
        const int   mSessionid;
        const pid_t mPid;
        int         mCnt;
    };

    friend class RecordThread;