diff options
author | Eric Laurent <elaurent@google.com> | 2012-09-24 10:41:17 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-09-24 10:41:17 -0700 |
commit | d4c1f2b55688fafabd468cd5b316dea636d7b4b8 (patch) | |
tree | c201c3f2ae28cb66e67a8bf81128abef3de21b89 /services/audioflinger | |
parent | a3903b1fe72c1c3ad70d54489575d8b1b7e48cfd (diff) | |
parent | 842feefd25f3ac03de3cd9bcc5bc7627abec6ebc (diff) | |
download | frameworks_av-d4c1f2b55688fafabd468cd5b316dea636d7b4b8.zip frameworks_av-d4c1f2b55688fafabd468cd5b316dea636d7b4b8.tar.gz frameworks_av-d4c1f2b55688fafabd468cd5b316dea636d7b4b8.tar.bz2 |
am 842feefd: am c0c3b298: Merge "fix end of track presentation on suspended output" into jb-mr1-dev
* commit '842feefd25f3ac03de3cd9bcc5bc7627abec6ebc':
fix end of track presentation on suspended output
Diffstat (limited to 'services/audioflinger')
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index de116a9..8e950aa 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -2116,7 +2116,17 @@ status_t AudioFlinger::PlaybackThread::getRenderPosition(uint32_t *halFrames, ui } *halFrames = mBytesWritten / audio_stream_frame_size(&mOutput->stream->common); - return mOutput->stream->get_render_position(mOutput->stream, dspFrames); + if (isSuspended()) { + // return an estimation of rendered frames when the output is suspended + int32_t frames = mBytesWritten - latency_l(); + if (frames < 0) { + frames = 0; + } + *dspFrames = (uint32_t)frames; + return NO_ERROR; + } else { + return mOutput->stream->get_render_position(mOutput->stream, dspFrames); + } } uint32_t AudioFlinger::PlaybackThread::hasAudioSession(int sessionId) const @@ -2573,7 +2583,6 @@ bool AudioFlinger::PlaybackThread::threadLoop() threadLoop_standby(); mStandby = true; - mBytesWritten = 0; } if (!mActiveTracks.size() && mConfigEvents.isEmpty()) { @@ -2593,6 +2602,7 @@ bool AudioFlinger::PlaybackThread::threadLoop() mMixerStatus = MIXER_IDLE; mMixerStatusIgnoringFastTracks = MIXER_IDLE; + mBytesWritten = 0; checkSilentMode_l(); @@ -2623,6 +2633,7 @@ bool AudioFlinger::PlaybackThread::threadLoop() if (isSuspended()) { sleepTime = suspendSleepTimeUs(); + mBytesWritten += mixBufferSize; } // only process effects if we're going to write |