diff options
author | Eric Laurent <elaurent@google.com> | 2013-09-30 14:12:28 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-09-30 14:12:28 -0700 |
commit | a6c7d98033c161592a062c61eaa6b7fd635e3006 (patch) | |
tree | ac0e06b5c5da9daad30aef9de4ff25dac7478c79 /services | |
parent | aceceea5e0d5772353e6049f51cc29084b76ead1 (diff) | |
parent | 0adc67dfc5cedb211c36f06849681a60a32f5805 (diff) | |
download | frameworks_av-a6c7d98033c161592a062c61eaa6b7fd635e3006.zip frameworks_av-a6c7d98033c161592a062c61eaa6b7fd635e3006.tar.gz frameworks_av-a6c7d98033c161592a062c61eaa6b7fd635e3006.tar.bz2 |
am 0adc67df: Merge "audioflinger: fix crash when starting offload thread" into klp-dev
* commit '0adc67dfc5cedb211c36f06849681a60a32f5805':
audioflinger: fix crash when starting offload thread
Diffstat (limited to 'services')
-rw-r--r-- | services/audioflinger/Threads.cpp | 14 | ||||
-rw-r--r-- | services/audioflinger/Threads.h | 12 |
2 files changed, 13 insertions, 13 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index aca6c18..e70a09a 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -1602,6 +1602,7 @@ void AudioFlinger::PlaybackThread::readOutputParameters() if (mOutput->stream->set_callback(mOutput->stream, AudioFlinger::PlaybackThread::asyncCallback, this) == 0) { mUseAsyncWrite = true; + mCallbackThread = new AudioFlinger::AsyncCallbackThread(this); } } @@ -3756,9 +3757,9 @@ void AudioFlinger::DirectOutputThread::cacheParameters_l() // ---------------------------------------------------------------------------- AudioFlinger::AsyncCallbackThread::AsyncCallbackThread( - const sp<AudioFlinger::OffloadThread>& offloadThread) + const wp<AudioFlinger::PlaybackThread>& playbackThread) : Thread(false /*canCallJava*/), - mOffloadThread(offloadThread), + mPlaybackThread(playbackThread), mWriteAckSequence(0), mDrainSequence(0) { @@ -3793,13 +3794,13 @@ bool AudioFlinger::AsyncCallbackThread::threadLoop() mDrainSequence &= ~1; } { - sp<AudioFlinger::OffloadThread> offloadThread = mOffloadThread.promote(); - if (offloadThread != 0) { + sp<AudioFlinger::PlaybackThread> playbackThread = mPlaybackThread.promote(); + if (playbackThread != 0) { if (writeAckSequence & 1) { - offloadThread->resetWriteBlocked(writeAckSequence >> 1); + playbackThread->resetWriteBlocked(writeAckSequence >> 1); } if (drainSequence & 1) { - offloadThread->resetDraining(drainSequence >> 1); + playbackThread->resetDraining(drainSequence >> 1); } } } @@ -3857,7 +3858,6 @@ AudioFlinger::OffloadThread::OffloadThread(const sp<AudioFlinger>& audioFlinger, mHwPaused(false), mPausedBytesRemaining(0) { - mCallbackThread = new AudioFlinger::AsyncCallbackThread(this); } AudioFlinger::OffloadThread::~OffloadThread() diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h index b96e1c8..92e845b 100644 --- a/services/audioflinger/Threads.h +++ b/services/audioflinger/Threads.h @@ -761,7 +761,7 @@ private: class AsyncCallbackThread : public Thread { public: - AsyncCallbackThread(const sp<OffloadThread>& offloadThread); + AsyncCallbackThread(const wp<PlaybackThread>& playbackThread); virtual ~AsyncCallbackThread(); @@ -778,17 +778,17 @@ public: void resetDraining(); private: - wp<OffloadThread> mOffloadThread; + const wp<PlaybackThread> mPlaybackThread; // mWriteAckSequence corresponds to the last write sequence passed by the offload thread via // setWriteBlocked(). The sequence is shifted one bit to the left and the lsb is used // to indicate that the callback has been received via resetWriteBlocked() - uint32_t mWriteAckSequence; + uint32_t mWriteAckSequence; // mDrainSequence corresponds to the last drain sequence passed by the offload thread via // setDraining(). The sequence is shifted one bit to the left and the lsb is used // to indicate that the callback has been received via resetDraining() - uint32_t mDrainSequence; - Condition mWaitWorkCV; - Mutex mLock; + uint32_t mDrainSequence; + Condition mWaitWorkCV; + Mutex mLock; }; class DuplicatingThread : public MixerThread { |