summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-09-30 14:56:11 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-30 14:56:11 +0000
commita5d419be9507c81af3b1f522cdc681708769f625 (patch)
tree4daee2ae255711668a4b810cbe1bc8e3dc6b7320 /services
parent1f25ce3c3c4d34826cddbd1907e2b09f1cd735f6 (diff)
parentf71224ce266abb39f83ecba87783c2347631654a (diff)
downloadframeworks_av-a5d419be9507c81af3b1f522cdc681708769f625.zip
frameworks_av-a5d419be9507c81af3b1f522cdc681708769f625.tar.gz
frameworks_av-a5d419be9507c81af3b1f522cdc681708769f625.tar.bz2
am f71224ce: Merge "audioflinger: forward flush to direct output streams" into lmp-dev
* commit 'f71224ce266abb39f83ecba87783c2347631654a': audioflinger: forward flush to direct output streams
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/Threads.cpp11
-rw-r--r--services/audioflinger/Threads.h5
-rw-r--r--services/audioflinger/Tracks.cpp4
3 files changed, 16 insertions, 4 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index d885558..12e09ab 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -4042,6 +4042,9 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::DirectOutputThread::prep
track->mState = TrackBase::STOPPED;
}
if (track->isStopped()) {
+ if (track->mState == TrackBase::FLUSHED) {
+ flushHw_l();
+ }
track->reset();
}
tracksToRemove->add(track);
@@ -4214,6 +4217,12 @@ void AudioFlinger::DirectOutputThread::cacheParameters_l()
}
}
+void AudioFlinger::DirectOutputThread::flushHw_l()
+{
+ if (mOutput->stream->flush != NULL)
+ mOutput->stream->flush(mOutput->stream);
+}
+
// ----------------------------------------------------------------------------
AudioFlinger::AsyncCallbackThread::AsyncCallbackThread(
@@ -4581,7 +4590,7 @@ bool AudioFlinger::OffloadThread::waitingAsyncCallback()
void AudioFlinger::OffloadThread::flushHw_l()
{
- mOutput->stream->flush(mOutput->stream);
+ DirectOutputThread::flushHw_l();
// Flush anything still waiting in the mixbuffer
mCurrentWriteLength = 0;
mBytesRemaining = 0;
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index fd025b5..7af5264 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -894,6 +894,7 @@ public:
virtual bool checkForNewParameter_l(const String8& keyValuePair,
status_t& status);
+ virtual void flushHw_l();
protected:
virtual int getTrackName_l(audio_channel_mask_t channelMask,
@@ -929,6 +930,7 @@ public:
OffloadThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output,
audio_io_handle_t id, uint32_t device);
virtual ~OffloadThread() {};
+ virtual void flushHw_l();
protected:
// threadLoop snippets
@@ -941,9 +943,6 @@ protected:
virtual void onAddNewTrack_l();
private:
- void flushHw_l();
-
-private:
bool mHwPaused;
bool mFlushPending;
size_t mPausedWriteLength; // length in bytes of write interrupted by pause
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index c0a75b9..75190f3 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -824,6 +824,10 @@ void AudioFlinger::PlaybackThread::Track::flush()
// remove from active track list, reset(), and trigger presentation complete
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