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

Commit 4b80abcd authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Remove dead mutex in AudioTrack/AudioRecord thread

The client callback threads had mutexes called AudioTrackThread::mLock
and ClientRecordThread::mLock.  These mutexes were only used by start()
and stop(), and were unused by the thread itself.  But start() and
stop() already have their own protection provided by AudioTrack::mLock
and AudioRecord::mLock.  So the thread mutexes can be removed.

Change-Id: I098406d381645d77fba06a15511e179a327848ef
parent 26daa02b
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -344,7 +344,6 @@ private:
        virtual status_t    readyToRun() { return NO_ERROR; }
        virtual void        onFirstRef() {}
        AudioRecord& mReceiver;
        Mutex       mLock;
    };

            bool processAudioBuffer(const sp<ClientRecordThread>& thread);
+0 −1
Original line number Diff line number Diff line
@@ -446,7 +446,6 @@ private:
        virtual status_t    readyToRun();
        virtual void        onFirstRef();
        AudioTrack& mReceiver;
        Mutex       mLock;
    };

            bool processAudioBuffer(const sp<AudioTrackThread>& thread);
+0 −13
Original line number Diff line number Diff line
@@ -293,7 +293,6 @@ status_t AudioRecord::start()
                return WOULD_BLOCK;
            }
        }
        t->mLock.lock();
     }

    AutoMutex lock(mLock);
@@ -334,10 +333,6 @@ status_t AudioRecord::start()
        }
    }

    if (t != 0) {
        t->mLock.unlock();
    }

    return ret;
}

@@ -347,10 +342,6 @@ status_t AudioRecord::stop()

    ALOGV("stop");

    if (t != 0) {
        t->mLock.lock();
    }

    AutoMutex lock(mLock);
    if (mActive == 1) {
        mActive = 0;
@@ -367,10 +358,6 @@ status_t AudioRecord::stop()
        }
    }

    if (t != 0) {
        t->mLock.unlock();
    }

    return NO_ERROR;
}

+0 −10
Original line number Diff line number Diff line
@@ -345,7 +345,6 @@ void AudioTrack::start()
                return;
            }
        }
        t->mLock.lock();
     }

    AutoMutex lock(mLock);
@@ -396,9 +395,6 @@ void AudioTrack::start()
        }
    }

    if (t != 0) {
        t->mLock.unlock();
    }
}

void AudioTrack::stop()
@@ -406,9 +402,6 @@ void AudioTrack::stop()
    sp<AudioTrackThread> t = mAudioTrackThread;

    ALOGV("stop %p", this);
    if (t != 0) {
        t->mLock.lock();
    }

    AutoMutex lock(mLock);
    if (mActive) {
@@ -434,9 +427,6 @@ void AudioTrack::stop()
        }
    }

    if (t != 0) {
        t->mLock.unlock();
    }
}

bool AudioTrack::stopped() const