summaryrefslogtreecommitdiffstats
path: root/services/audioflinger
diff options
context:
space:
mode:
authorHaynes Mathew George <hgeorge@codeaurora.org>2016-05-03 16:34:26 -0700
committerSteve Kondik <steve@cyngn.com>2016-08-19 13:38:26 -0700
commit6fde774471629832951e9b9b2e0d758e10f6431d (patch)
tree202a0a2571d532a9980d33b16abf8dfb79ed2f9f /services/audioflinger
parente72652f039b9067f9e747d70184507d41ef1f6d7 (diff)
downloadframeworks_av-6fde774471629832951e9b9b2e0d758e10f6431d.zip
frameworks_av-6fde774471629832951e9b9b2e0d758e10f6431d.tar.gz
frameworks_av-6fde774471629832951e9b9b2e0d758e10f6431d.tar.bz2
audioflinger: set flush pending on invalidating offload track
On invalidating an offload track, the IAudioTrack instance is destroyed and the offload output is released. If it so happens that APM::getOutputForAttr for the new IAudioTrack is called before OffloadThread::prepareTracks_l checks and removes an invalid track, the same output can get reused. The side effect of this is data present in HAL and below from before the invalidate will be rendered before data from the new seek position is rendered. This is unexpected. To fix this, set hint to issue flush when an offload track is invalidated. Bug: 28566885 CRs-Fixed: 1002438 Change-Id: Ib6c38a3abb600598b87591bac90d03b7150d5216
Diffstat (limited to 'services/audioflinger')
-rw-r--r--services/audioflinger/Threads.cpp16
-rw-r--r--services/audioflinger/Threads.h4
2 files changed, 17 insertions, 3 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index ecdbf43..ee5dc24 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2574,11 +2574,10 @@ void AudioFlinger::PlaybackThread::cacheParameters_l()
}
}
-void AudioFlinger::PlaybackThread::invalidateTracks(audio_stream_type_t streamType)
+void AudioFlinger::PlaybackThread::invalidateTracks_l(audio_stream_type_t streamType)
{
ALOGV("MixerThread::invalidateTracks() mixer %p, streamType %d, mTracks.size %d",
this, streamType, mTracks.size());
- Mutex::Autolock _l(mLock);
size_t size = mTracks.size();
for (size_t i = 0; i < size; i++) {
@@ -2589,6 +2588,12 @@ void AudioFlinger::PlaybackThread::invalidateTracks(audio_stream_type_t streamTy
}
}
+void AudioFlinger::PlaybackThread::invalidateTracks(audio_stream_type_t streamType)
+{
+ Mutex::Autolock _l(mLock);
+ invalidateTracks_l(streamType);
+}
+
status_t AudioFlinger::PlaybackThread::addEffectChain_l(const sp<EffectChain>& chain)
{
int session = chain->sessionId();
@@ -5371,6 +5376,13 @@ void AudioFlinger::OffloadThread::flushHw_l()
}
}
+void AudioFlinger::OffloadThread::invalidateTracks(audio_stream_type_t streamType)
+{
+ Mutex::Autolock _l(mLock);
+ mFlushPending = true;
+ PlaybackThread::invalidateTracks_l(streamType);
+}
+
// ----------------------------------------------------------------------------
AudioFlinger::DuplicatingThread::DuplicatingThread(const sp<AudioFlinger>& audioFlinger,
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index 48ff77d..8fab1e4 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -617,7 +617,8 @@ public:
virtual bool isValidSyncEvent(const sp<SyncEvent>& event) const;
// called with AudioFlinger lock held
- void invalidateTracks(audio_stream_type_t streamType);
+ void invalidateTracks_l(audio_stream_type_t streamType);
+ virtual void invalidateTracks(audio_stream_type_t streamType);
virtual size_t frameCount() const { return mNormalFrameCount; }
@@ -1000,6 +1001,7 @@ protected:
virtual bool waitingAsyncCallback();
virtual bool waitingAsyncCallback_l();
+ virtual void invalidateTracks(audio_stream_type_t streamType);
private:
size_t mPausedWriteLength; // length in bytes of write interrupted by pause