From 43b4dcc660e6da96285e4672ae371070ab845401 Mon Sep 17 00:00:00 2001 From: Phil Burk Date: Tue, 9 Jun 2015 16:53:44 -0700 Subject: AudioFlinger: flush stream when switching tracks For direct threads, when recycling a stream, perform a flush so that the frame position is reset. Bug: 21145353 Change-Id: I08611cd64bb249a9659c44f9e4c47e7455f4838f Signed-off-by: Phil Burk --- services/audioflinger/Threads.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'services/audioflinger/Threads.h') diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h index 7b4fb14..4ebe615 100644 --- a/services/audioflinger/Threads.h +++ b/services/audioflinger/Threads.h @@ -941,6 +941,8 @@ protected: virtual void threadLoop_exit(); virtual bool shouldStandby_l(); + virtual void onAddNewTrack_l(); + // volumes last sent to audio HAL with stream->set_volume() float mLeftVolFloat; float mRightVolFloat; @@ -952,6 +954,9 @@ protected: // prepareTracks_l() tells threadLoop_mix() the name of the single active track sp mActiveTrack; + + wp mPreviousTrack; // used to detect track switch + public: virtual bool hasFastMixer() const { return false; } }; @@ -971,12 +976,10 @@ protected: virtual bool waitingAsyncCallback(); virtual bool waitingAsyncCallback_l(); - virtual void onAddNewTrack_l(); private: size_t mPausedWriteLength; // length in bytes of write interrupted by pause size_t mPausedBytesRemaining; // bytes still waiting in mixbuffer after resume - wp mPreviousTrack; // used to detect track switch }; class AsyncCallbackThread : public Thread { -- cgit v1.1