From 42a6f422c09ca6a960673e0e805ddf71a9b51bef Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Thu, 29 Aug 2013 14:35:05 -0700 Subject: [PATCH] AudioTrack: fix write retries for compressed audio When the amount of frames that can be written to the buffer is less than requested, AudioTrack::processAudioBuffer() estimates the time needed to free the missing amount of frames and asks the callback thread to sleep. This behavior is not possible for compressed audio and should not be enabled for offloaded tracks. Change-Id: I5b657283cfba06254c9ac0ea9b447467cce7eb61 --- media/libmedia/AudioTrack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 214e789f68..7aa9e35c26 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -1550,7 +1550,7 @@ nsecs_t AudioTrack::processAudioBuffer(const sp& thread) return NS_NEVER; } - if (mRetryOnPartialBuffer) { + if (mRetryOnPartialBuffer && !isOffloaded()) { mRetryOnPartialBuffer = false; if (avail < mRemainingFrames) { int64_t myns = ((mRemainingFrames - avail) * 1100000000LL) / sampleRate; -- 2.11.0