diff options
author | Glenn Kasten <gkasten@google.com> | 2014-02-24 15:12:48 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2014-02-24 17:21:49 -0800 |
commit | 089e87201522c8979ac8f00fa729e907f54c790b (patch) | |
tree | ae86fd828953a88786a4ef6f02d9d0248280e73a /media/libmedia/AudioRecord.cpp | |
parent | 5f631515d098c29603cda88f7a7e7580a2d55b57 (diff) | |
download | frameworks_av-089e87201522c8979ac8f00fa729e907f54c790b.zip frameworks_av-089e87201522c8979ac8f00fa729e907f54c790b.tar.gz frameworks_av-089e87201522c8979ac8f00fa729e907f54c790b.tar.bz2 |
mAudioRecord is always non-0 if set() is successful
Change-Id: I0c2483210903c922f06f097ada373a37b9a90a02
Diffstat (limited to 'media/libmedia/AudioRecord.cpp')
-rw-r--r-- | media/libmedia/AudioRecord.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp index bb66b4c..ad9e996 100644 --- a/media/libmedia/AudioRecord.cpp +++ b/media/libmedia/AudioRecord.cpp @@ -110,10 +110,8 @@ AudioRecord::~AudioRecord() mAudioRecordThread->requestExitAndWait(); mAudioRecordThread.clear(); } - if (mAudioRecord != 0) { - mAudioRecord->asBinder()->unlinkToDeath(mDeathNotifier, this); - mAudioRecord.clear(); - } + mAudioRecord->asBinder()->unlinkToDeath(mDeathNotifier, this); + mAudioRecord.clear(); IPCThreadState::self()->flushCommands(); AudioSystem::releaseAudioSessionId(mSessionId, -1); } @@ -170,6 +168,7 @@ status_t AudioRecord::set( AutoMutex lock(mLock); + // invariant that mAudioRecord != 0 is true only after set() returns successfully if (mAudioRecord != 0) { ALOGE("Track already in use"); return INVALID_OPERATION; @@ -508,6 +507,7 @@ status_t AudioRecord::openRecord_l(size_t epoch) ALOGE("Could not get control block pointer"); return NO_INIT; } + // invariant that mAudioRecord != 0 is true only after set() returns successfully if (mAudioRecord != 0) { mAudioRecord->asBinder()->unlinkToDeath(mDeathNotifier, this); mDeathNotifier.clear(); |