summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2014-02-25 22:58:02 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-02-25 22:58:02 +0000
commit591d9a3652f868652ccc48dd9e9714f3a9813963 (patch)
tree5b45f354e144448a00c4a0c9cd3261bd0816ded0
parent7c1b8941bb54e38f2a717e41af0d9565f5977c27 (diff)
parent089e87201522c8979ac8f00fa729e907f54c790b (diff)
downloadframeworks_av-591d9a3652f868652ccc48dd9e9714f3a9813963.zip
frameworks_av-591d9a3652f868652ccc48dd9e9714f3a9813963.tar.gz
frameworks_av-591d9a3652f868652ccc48dd9e9714f3a9813963.tar.bz2
Merge "mAudioRecord is always non-0 if set() is successful"
-rw-r--r--media/libmedia/AudioRecord.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index f2351d5..99f2fe5 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -102,10 +102,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);
}
@@ -162,6 +160,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;
@@ -501,6 +500,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();