summaryrefslogtreecommitdiffstats
path: root/media/libmedia
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-08-07 09:44:19 -0700
committerGlenn Kasten <gkasten@google.com>2012-08-07 15:13:42 -0700
commita997e7a7c5aa2fc7e95316218316f8b7b98786ba (patch)
tree4f98e352833c4de61728588cacc08d40d1d01778 /media/libmedia
parent8da4cd7d706d9f551bf2d08cd8b61907a10cd38d (diff)
downloadframeworks_av-a997e7a7c5aa2fc7e95316218316f8b7b98786ba.zip
frameworks_av-a997e7a7c5aa2fc7e95316218316f8b7b98786ba.tar.gz
frameworks_av-a997e7a7c5aa2fc7e95316218316f8b7b98786ba.tar.bz2
Revert "Swap the order of creating IAudioTrack and thread"
This reverts commit 5d464eb0b8cffb994a754ff108795e858a882414. It caused the wrong thread ID -1 to be passed to IAudioFlinger::createTrack(). Change-Id: Ic221d2bb4af572d3d2d752af19238c52f6728e3a
Diffstat (limited to 'media/libmedia')
-rw-r--r--media/libmedia/AudioTrack.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 0ca035f..73d396e 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -278,6 +278,11 @@ status_t AudioTrack::set(
mFlags = flags;
mCbf = cbf;
+ if (cbf != NULL) {
+ mAudioTrackThread = new AudioTrackThread(*this, threadCanCallJava);
+ mAudioTrackThread->run("AudioTrack", ANDROID_PRIORITY_AUDIO, 0 /*stack*/);
+ }
+
// create the IAudioTrack
status_t status = createTrack_l(streamType,
sampleRate,
@@ -287,15 +292,15 @@ status_t AudioTrack::set(
flags,
sharedBuffer,
output);
+
if (status != NO_ERROR) {
+ if (mAudioTrackThread != 0) {
+ mAudioTrackThread->requestExit();
+ mAudioTrackThread.clear();
+ }
return status;
}
- if (cbf != NULL) {
- mAudioTrackThread = new AudioTrackThread(*this, threadCanCallJava);
- mAudioTrackThread->run("AudioTrack", ANDROID_PRIORITY_AUDIO);
- }
-
mStatus = NO_ERROR;
mStreamType = streamType;