From d1f69b0b17acbd96987ecb2f3378abd394d05903 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Mon, 15 Dec 2014 14:33:13 -0800 Subject: audioflinger: implement pause/resume for direct outputs Extend pause/resume support to direct output threads (was only for offload threads). If the HAL implements pause/resume, track pause/resume is forwarded to the HAL. Pause, flush, resume sequence is respected by executing the HAL calls in the playback thread (same as offload). Make sure the track flags on client side are consistent with the flags on server side. Bug: 17883772. Change-Id: I89b360d69818f7a9204bd36e3ec63a79e106ecf1 --- services/audioflinger/Tracks.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'services/audioflinger/Tracks.cpp') diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp index fcbf8f8..e970036 100644 --- a/services/audioflinger/Tracks.cpp +++ b/services/audioflinger/Tracks.cpp @@ -823,12 +823,11 @@ void AudioFlinger::PlaybackThread::Track::flush() // this will be done by prepareTracks_l() when the track is stopped. // prepareTracks_l() will see mState == FLUSHED, then // remove from active track list, reset(), and trigger presentation complete + if (isDirect()) { + mFlushHwPending = true; + } if (playbackThread->mActiveTracks.indexOf(this) < 0) { reset(); - if (thread->type() == ThreadBase::DIRECT) { - DirectOutputThread *t = (DirectOutputThread *)playbackThread; - t->flushHw_l(); - } } } // Prevent flush being lost if the track is flushed and then resumed @@ -841,7 +840,7 @@ void AudioFlinger::PlaybackThread::Track::flush() // must be called with thread lock held void AudioFlinger::PlaybackThread::Track::flushAck() { - if (!isOffloaded()) + if (!isOffloaded() && !isDirect()) return; mFlushHwPending = false; -- cgit v1.1