summaryrefslogtreecommitdiffstats
path: root/media/libmedia
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2009-11-12 23:10:34 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2009-11-12 23:10:34 -0800
commit6efdbcc3c1afafe2f9401668ce252167600b498f (patch)
treefdf8b5bb900bedfcdb064ed00b4724ce08b3a9e4 /media/libmedia
parent609acfd2a1067f49e51925776484b070a24d8301 (diff)
parentfddfb9ae03a2730ac5ce27fa4c47b7d3a0285d0f (diff)
downloadframeworks_base-6efdbcc3c1afafe2f9401668ce252167600b498f.zip
frameworks_base-6efdbcc3c1afafe2f9401668ce252167600b498f.tar.gz
frameworks_base-6efdbcc3c1afafe2f9401668ce252167600b498f.tar.bz2
am fddfb9ae: Merge change Iad79689a into eclair
Merge commit 'fddfb9ae03a2730ac5ce27fa4c47b7d3a0285d0f' into eclair-mr2 * commit 'fddfb9ae03a2730ac5ce27fa4c47b7d3a0285d0f': Improvements for issue 2197683: English IME key-press latency is noticeably higher on passion than sholes
Diffstat (limited to 'media/libmedia')
-rw-r--r--media/libmedia/AudioTrack.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 8529a8e..cedd79d 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -318,26 +318,35 @@ void AudioTrack::start()
}
if (android_atomic_or(1, &mActive) == 0) {
- audio_io_handle_t output = AudioTrack::getOutput();
+ audio_io_handle_t output = getOutput();
+ AudioSystem::startOutput(output, (AudioSystem::stream_type)mStreamType);
+ mNewPosition = mCblk->server + mUpdatePeriod;
+ mCblk->bufferTimeoutMs = MAX_STARTUP_TIMEOUT_MS;
+ mCblk->waitTimeMs = 0;
+ if (t != 0) {
+ t->run("AudioTrackThread", THREAD_PRIORITY_AUDIO_CLIENT);
+ } else {
+ setpriority(PRIO_PROCESS, 0, THREAD_PRIORITY_AUDIO_CLIENT);
+ }
+
status_t status = mAudioTrack->start();
if (status == DEAD_OBJECT) {
LOGV("start() dead IAudioTrack: creating a new one");
status = createTrack(mStreamType, mCblk->sampleRate, mFormat, mChannelCount,
mFrameCount, mFlags, mSharedBuffer, output);
- }
- if (status == NO_ERROR) {
- AudioSystem::startOutput(output, (AudioSystem::stream_type)mStreamType);
mNewPosition = mCblk->server + mUpdatePeriod;
mCblk->bufferTimeoutMs = MAX_STARTUP_TIMEOUT_MS;
mCblk->waitTimeMs = 0;
+ }
+ if (status != NO_ERROR) {
+ LOGV("start() failed");
+ android_atomic_and(~1, &mActive);
if (t != 0) {
- t->run("AudioTrackThread", THREAD_PRIORITY_AUDIO_CLIENT);
+ t->requestExit();
} else {
- setpriority(PRIO_PROCESS, 0, THREAD_PRIORITY_AUDIO_CLIENT);
+ setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_NORMAL);
}
- } else {
- LOGV("start() failed");
- android_atomic_and(~1, &mActive);
+ AudioSystem::stopOutput(output, (AudioSystem::stream_type)mStreamType);
}
}