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

Commit 012ca6b4 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Rename fields of AudioSessionRef

Change-Id: I9f2a66094135c4ac6bec2d3e9db3ac5fbf988ede
parent 70a1577d
Loading
Loading
Loading
Loading
+14 −14
Original line number Original line 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("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++) {
    for (size_t i = 0; i < mAudioSessionRefs.size(); i++) {
        AudioSessionRef *r = mAudioSessionRefs[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);
        result.append(buffer);
    }
    }
    write(fd, result.string(), result.size());
    write(fd, result.string(), result.size());
@@ -1036,9 +1036,9 @@ void AudioFlinger::removeNotificationClient(pid_t pid)
    bool removed = false;
    bool removed = false;
    for (size_t i = 0; i< num; ) {
    for (size_t i = 0; i< num; ) {
        AudioSessionRef *ref = mAudioSessionRefs.itemAt(i);
        AudioSessionRef *ref = mAudioSessionRefs.itemAt(i);
        ALOGV(" pid %d @ %d", ref->pid, i);
        ALOGV(" pid %d @ %d", ref->mPid, i);
        if (ref->pid == pid) {
        if (ref->mPid == pid) {
            ALOGV(" removing entry for pid %d session %d", pid, ref->sessionid);
            ALOGV(" removing entry for pid %d session %d", pid, ref->mSessionid);
            mAudioSessionRefs.removeAt(i);
            mAudioSessionRefs.removeAt(i);
            delete ref;
            delete ref;
            removed = true;
            removed = true;
@@ -5700,9 +5700,9 @@ void AudioFlinger::acquireAudioSessionId(int audioSession)
    size_t num = mAudioSessionRefs.size();
    size_t num = mAudioSessionRefs.size();
    for (size_t i = 0; i< num; i++) {
    for (size_t i = 0; i< num; i++) {
        AudioSessionRef *ref = mAudioSessionRefs.editItemAt(i);
        AudioSessionRef *ref = mAudioSessionRefs.editItemAt(i);
        if (ref->sessionid == audioSession && ref->pid == caller) {
        if (ref->mSessionid == audioSession && ref->mPid == caller) {
            ref->cnt++;
            ref->mCnt++;
            ALOGV(" incremented refcount to %d", ref->cnt);
            ALOGV(" incremented refcount to %d", ref->mCnt);
            return;
            return;
        }
        }
    }
    }
@@ -5718,10 +5718,10 @@ void AudioFlinger::releaseAudioSessionId(int audioSession)
    size_t num = mAudioSessionRefs.size();
    size_t num = mAudioSessionRefs.size();
    for (size_t i = 0; i< num; i++) {
    for (size_t i = 0; i< num; i++) {
        AudioSessionRef *ref = mAudioSessionRefs.itemAt(i);
        AudioSessionRef *ref = mAudioSessionRefs.itemAt(i);
        if (ref->sessionid == audioSession && ref->pid == caller) {
        if (ref->mSessionid == audioSession && ref->mPid == caller) {
            ref->cnt--;
            ref->mCnt--;
            ALOGV(" decremented refcount to %d", ref->cnt);
            ALOGV(" decremented refcount to %d", ref->mCnt);
            if (ref->cnt == 0) {
            if (ref->mCnt == 0) {
                mAudioSessionRefs.removeAt(i);
                mAudioSessionRefs.removeAt(i);
                delete ref;
                delete ref;
                purgeStaleEffects_l();
                purgeStaleEffects_l();
@@ -5766,9 +5766,9 @@ void AudioFlinger::purgeStaleEffects_l() {
        bool found = false;
        bool found = false;
        for (size_t k = 0; k < numsessionrefs; k++) {
        for (size_t k = 0; k < numsessionrefs; k++) {
            AudioSessionRef *ref = mAudioSessionRefs.itemAt(k);
            AudioSessionRef *ref = mAudioSessionRefs.itemAt(k);
            if (ref->sessionid == sessionid) {
            if (ref->mSessionid == sessionid) {
                ALOGV(" session %d still exists for %d with %d refs",
                ALOGV(" session %d still exists for %d with %d refs",
                     sessionid, ref->pid, ref->cnt);
                     sessionid, ref->mPid, ref->mCnt);
                found = true;
                found = true;
                break;
                break;
            }
            }
+5 −6
Original line number Original line Diff line number Diff line
@@ -1570,12 +1570,11 @@ mutable Mutex mLock; // mutex for process, commands and handl


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


    friend class RecordThread;
    friend class RecordThread;