summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-11-12 22:53:28 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-11-12 22:53:28 -0800
commitfddfb9ae03a2730ac5ce27fa4c47b7d3a0285d0f (patch)
tree3ec21d76715c79bd5faa79dcc1de9e540c8b274d /media
parent1aa9f3cac31a7c2b50fcb3c9259cead8d638ae54 (diff)
parent059b4be2a5a5b3fd410f8263e5f5928689c97af7 (diff)
downloadframeworks_base-fddfb9ae03a2730ac5ce27fa4c47b7d3a0285d0f.zip
frameworks_base-fddfb9ae03a2730ac5ce27fa4c47b7d3a0285d0f.tar.gz
frameworks_base-fddfb9ae03a2730ac5ce27fa4c47b7d3a0285d0f.tar.bz2
Merge change Iad79689a into eclair
* changes: Improvements for issue 2197683: English IME key-press latency is noticeably higher on passion than sholes
Diffstat (limited to 'media')
-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);
}
}