summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/AMRWriter.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-03-23 14:33:02 -0700
committerAndreas Huber <andih@google.com>2010-04-09 13:49:39 -0700
commitebe87f32e442c9a8fb2931632311d6c5a126eddb (patch)
treeef19cacaa3d207b78061e41803593d56de3bdf94 /media/libstagefright/AMRWriter.cpp
parent03b268eac37ca2589bfff0bf58daf79d29cc14f4 (diff)
downloadframeworks_av-ebe87f32e442c9a8fb2931632311d6c5a126eddb.zip
frameworks_av-ebe87f32e442c9a8fb2931632311d6c5a126eddb.tar.gz
frameworks_av-ebe87f32e442c9a8fb2931632311d6c5a126eddb.tar.bz2
Remove unnecessary lock from AMRWriter.
Change-Id: Ia02966d936dd8cbb31e92051578a3fa816885710
Diffstat (limited to 'media/libstagefright/AMRWriter.cpp')
-rw-r--r--media/libstagefright/AMRWriter.cpp26
1 files changed, 5 insertions, 21 deletions
diff --git a/media/libstagefright/AMRWriter.cpp b/media/libstagefright/AMRWriter.cpp
index bf4424b..73ea56d 100644
--- a/media/libstagefright/AMRWriter.cpp
+++ b/media/libstagefright/AMRWriter.cpp
@@ -53,8 +53,6 @@ status_t AMRWriter::initCheck() const {
}
status_t AMRWriter::addSource(const sp<MediaSource> &source) {
- Mutex::Autolock autoLock(mLock);
-
if (mInitCheck != OK) {
return mInitCheck;
}
@@ -95,8 +93,6 @@ status_t AMRWriter::addSource(const sp<MediaSource> &source) {
}
status_t AMRWriter::start() {
- Mutex::Autolock autoLock(mLock);
-
if (mInitCheck != OK) {
return mInitCheck;
}
@@ -127,16 +123,12 @@ status_t AMRWriter::start() {
}
void AMRWriter::stop() {
- {
- Mutex::Autolock autoLock(mLock);
-
- if (!mStarted) {
- return;
- }
-
- mDone = true;
+ if (!mStarted) {
+ return;
}
+ mDone = true;
+
void *dummy;
pthread_join(mThread, &dummy);
@@ -153,13 +145,7 @@ void *AMRWriter::ThreadWrapper(void *me) {
}
void AMRWriter::threadFunc() {
- for (;;) {
- Mutex::Autolock autoLock(mLock);
-
- if (mDone) {
- break;
- }
-
+ while (!mDone) {
MediaBuffer *buffer;
status_t err = mSource->read(&buffer);
@@ -184,12 +170,10 @@ void AMRWriter::threadFunc() {
buffer = NULL;
}
- Mutex::Autolock autoLock(mLock);
mReachedEOS = true;
}
bool AMRWriter::reachedEOS() {
- Mutex::Autolock autoLock(mLock);
return mReachedEOS;
}