summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-09-08 16:07:40 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-08 16:07:40 -0700
commit98afd841e8f0803a00d1970e4a28ea8999e9c498 (patch)
tree88529696fc561e932a7d109b9dda779903d873d9 /media
parent7280088b2315b6c2eccd39f0f0363d498ec82f0d (diff)
parent2267ba18d0d2b2d4bd7f5411821ad89ac2659a88 (diff)
downloadframeworks_av-98afd841e8f0803a00d1970e4a28ea8999e9c498.zip
frameworks_av-98afd841e8f0803a00d1970e4a28ea8999e9c498.tar.gz
frameworks_av-98afd841e8f0803a00d1970e4a28ea8999e9c498.tar.bz2
Merge "AudioTrack: extend callback thread sleep time"
Diffstat (limited to 'media')
-rw-r--r--media/libmedia/AudioTrack.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 7509239..c2c6715 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -1078,6 +1078,11 @@ bool AudioTrack::processAudioBuffer(const sp<AudioTrackThread>& thread)
frames = mRemainingFrames;
}
+ int32_t waitCount = -1;
+ if (mUpdatePeriod || (!mMarkerReached && mMarkerPosition) || mLoopCount) {
+ waitCount = 1;
+ }
+
do {
audioBuffer.frameCount = frames;
@@ -1085,7 +1090,7 @@ bool AudioTrack::processAudioBuffer(const sp<AudioTrackThread>& thread)
// Calling obtainBuffer() with a wait count of 1
// limits wait time to WAIT_PERIOD_MS. This prevents from being
// stuck here not being able to handle timed events (position, markers, loops).
- status_t err = obtainBuffer(&audioBuffer, 1);
+ status_t err = obtainBuffer(&audioBuffer, waitCount);
if (err < NO_ERROR) {
if (err != TIMED_OUT) {
LOGE_IF(err != status_t(NO_MORE_BUFFERS), "Error obtaining an audio buffer, giving up.");