summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2015-03-24 19:42:30 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-03-24 19:42:31 +0000
commit82ceac025459b5b8887441d709081ec29c6b9416 (patch)
tree6400948366e9d51774601a03d149a4ba7b33e2cb
parent21b51b61ee52e6aa74d98b138d3dd4f0e17b1441 (diff)
parentbfd318402924414fbde4d31c9d23cc423f10b630 (diff)
downloadframeworks_av-82ceac025459b5b8887441d709081ec29c6b9416.zip
frameworks_av-82ceac025459b5b8887441d709081ec29c6b9416.tar.gz
frameworks_av-82ceac025459b5b8887441d709081ec29c6b9416.tar.bz2
Merge "set() in AudioRecord and AudioTracks needs no lock"
-rw-r--r--include/media/AudioRecord.h1
-rw-r--r--include/media/AudioTrack.h1
-rw-r--r--media/libmedia/AudioRecord.cpp3
-rw-r--r--media/libmedia/AudioTrack.cpp3
4 files changed, 4 insertions, 4 deletions
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h
index f6832c9..3daac65 100644
--- a/include/media/AudioRecord.h
+++ b/include/media/AudioRecord.h
@@ -183,6 +183,7 @@ public:
/* Initialize an AudioRecord that was created using the AudioRecord() constructor.
* Don't call set() more than once, or after an AudioRecord() constructor that takes parameters.
+ * set() is not multi-thread safe.
* Returned status (from utils/Errors.h) can be:
* - NO_ERROR: successful intialization
* - INVALID_OPERATION: AudioRecord is already initialized or record device is already in use
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 81b1181..818c8cd 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -238,6 +238,7 @@ public:
/* Initialize an AudioTrack that was created using the AudioTrack() constructor.
* Don't call set() more than once, or after the AudioTrack() constructors that take parameters.
+ * set() is not multi-thread safe.
* Returned status (from utils/Errors.h) can be:
* - NO_ERROR: successful initialization
* - INVALID_OPERATION: AudioTrack is already initialized
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index 1a65ee8..7decafd 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -161,8 +161,6 @@ status_t AudioRecord::set(
}
mTransfer = transferType;
- AutoMutex lock(mLock);
-
// invariant that mAudioRecord != 0 is true only after set() returns successfully
if (mAudioRecord != 0) {
ALOGE("Track already in use");
@@ -235,6 +233,7 @@ status_t AudioRecord::set(
if (cbf != NULL) {
mAudioRecordThread = new AudioRecordThread(*this, threadCanCallJava);
mAudioRecordThread->run("AudioRecord", ANDROID_PRIORITY_AUDIO);
+ // thread begins in paused state, and will not reference us until start()
}
// create the IAudioRecord
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 8fd5278..98f64fe 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -274,8 +274,6 @@ status_t AudioTrack::set(
ALOGV("set() streamType %d frameCount %zu flags %04x", streamType, frameCount, flags);
- AutoMutex lock(mLock);
-
// invariant that mAudioTrack != 0 is true only after set() returns successfully
if (mAudioTrack != 0) {
ALOGE("Track already in use");
@@ -401,6 +399,7 @@ status_t AudioTrack::set(
if (cbf != NULL) {
mAudioTrackThread = new AudioTrackThread(*this, threadCanCallJava);
mAudioTrackThread->run("AudioTrack", ANDROID_PRIORITY_AUDIO, 0 /*stack*/);
+ // thread begins in paused state, and will not reference us until start()
}
// create the IAudioTrack