diff options
author | Glenn Kasten <gkasten@google.com> | 2014-03-01 00:51:31 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-03-01 00:51:31 +0000 |
commit | ecc8155914bf006d435b825c0fda24f446228709 (patch) | |
tree | 3195944d2681ce53b66e3107b4f8ae243acb4305 /media/libmedia | |
parent | b442921146664fba77b91f221e9b1997ffb8170e (diff) | |
parent | 879707057cde0a83b5f6143c918c66b8f4a97581 (diff) | |
download | frameworks_av-ecc8155914bf006d435b825c0fda24f446228709.zip frameworks_av-ecc8155914bf006d435b825c0fda24f446228709.tar.gz frameworks_av-ecc8155914bf006d435b825c0fda24f446228709.tar.bz2 |
Merge "Make openRecord_l more like createTrack_l for fast tracks: part 3"
Diffstat (limited to 'media/libmedia')
-rw-r--r-- | media/libmedia/AudioRecord.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp index a8e1f5d..961b0a2 100644 --- a/media/libmedia/AudioRecord.cpp +++ b/media/libmedia/AudioRecord.cpp @@ -233,22 +233,27 @@ status_t AudioRecord::set( ALOGV("set(): mSessionId %d", mSessionId); mFlags = flags; + mCbf = cbf; + + if (cbf != NULL) { + mAudioRecordThread = new AudioRecordThread(*this, threadCanCallJava); + mAudioRecordThread->run("AudioRecord", ANDROID_PRIORITY_AUDIO); + } // create the IAudioRecord status = openRecord_l(0 /*epoch*/); + if (status != NO_ERROR) { + if (mAudioRecordThread != 0) { + mAudioRecordThread->requestExit(); // see comment in AudioRecord.h + mAudioRecordThread->requestExitAndWait(); + mAudioRecordThread.clear(); + } return status; } - if (cbf != NULL) { - mAudioRecordThread = new AudioRecordThread(*this, threadCanCallJava); - mAudioRecordThread->run("AudioRecord", ANDROID_PRIORITY_AUDIO); - } - mStatus = NO_ERROR; - mActive = false; - mCbf = cbf; mUserData = user; // TODO: add audio hardware input latency here mLatency = (1000*mFrameCount) / sampleRate; |