OSDN Git Service

Simplify RecordTrack::stop()
authorGlenn Kasten <gkasten@google.com>
Thu, 25 Jul 2013 21:37:52 +0000 (14:37 -0700)
committerGlenn Kasten <gkasten@google.com>
Thu, 25 Jul 2013 21:44:51 +0000 (14:44 -0700)
Change-Id: Ib959c1e9dc9544d12277ce11bea445118b2e0521

services/audioflinger/Threads.cpp
services/audioflinger/Threads.h
services/audioflinger/Tracks.cpp

index f27d908..e2e023a 100644 (file)
@@ -4031,8 +4031,9 @@ void AudioFlinger::RecordThread::handleSyncStartEvent(const sp<SyncEvent>& event
     }
 }
 
-bool AudioFlinger::RecordThread::stop_l(RecordThread::RecordTrack* recordTrack) {
+bool AudioFlinger::RecordThread::stop(RecordThread::RecordTrack* recordTrack) {
     ALOGV("RecordThread::stop");
+    AutoMutex _l(mLock);
     if (recordTrack != mActiveTrack.get() || recordTrack->mState == TrackBase::PAUSING) {
         return false;
     }
index 365c790..4c969d8 100644 (file)
@@ -747,7 +747,7 @@ public:
 
             // ask the thread to stop the specified track, and
             // return true if the caller should then do it's part of the stopping process
-            bool        stop_l(RecordTrack* recordTrack);
+            bool        stop(RecordTrack* recordTrack);
 
             void        dump(int fd, const Vector<String16>& args);
             AudioStreamIn* clearInput();
index d424e16..1df333f 100644 (file)
@@ -1656,12 +1656,7 @@ void AudioFlinger::RecordThread::RecordTrack::stop()
     sp<ThreadBase> thread = mThread.promote();
     if (thread != 0) {
         RecordThread *recordThread = (RecordThread *)thread.get();
-        recordThread->mLock.lock();
-        bool doStop = recordThread->stop_l(this);
-        if (doStop) {
-        }
-        recordThread->mLock.unlock();
-        if (doStop) {
+        if (recordThread->stop(this)) {
             AudioSystem::stopInput(recordThread->id());
         }
     }