diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2012-09-28 14:49:39 -0700 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2012-09-30 11:11:26 -0700 |
commit | 2bfc6b42b3733c12485dd51ed95191956abc3e4e (patch) | |
tree | 0b8c0eef5d695bd7428f9bd984a2038e3b3ec4b4 /services/audioflinger/AudioFlinger.cpp | |
parent | 003d9f71937070791418bf7efc1f7fe1e4c6b821 (diff) | |
download | frameworks_av-2bfc6b42b3733c12485dd51ed95191956abc3e4e.zip frameworks_av-2bfc6b42b3733c12485dd51ed95191956abc3e4e.tar.gz frameworks_av-2bfc6b42b3733c12485dd51ed95191956abc3e4e.tar.bz2 |
bug 7253033 clean up before closing an output
An output can only be closed if there is no lock contention that
prevents ThreadBase::exit() from being blocked. If an output
device is waiting for an operation to complete (here a write
in the remote_submix module, because the pipe is full), signal
the module that it's entering the "exiting" state.
Change-Id: I8248add60da543e90c25a4c809866cdb26255651
Diffstat (limited to 'services/audioflinger/AudioFlinger.cpp')
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 9689654..1388671 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -1163,6 +1163,8 @@ AudioFlinger::ThreadBase::~ThreadBase() void AudioFlinger::ThreadBase::exit() { ALOGV("ThreadBase::exit"); + // do any cleanup required for exit to succeed + preExit(); { // This lock prevents the following race in thread (uniprocessor for illustration): // if (!exitPending()) { @@ -1694,6 +1696,15 @@ void AudioFlinger::PlaybackThread::onFirstRef() run(mName, ANDROID_PRIORITY_URGENT_AUDIO); } +// ThreadBase virtuals +void AudioFlinger::PlaybackThread::preExit() +{ + ALOGV(" preExit()"); + // FIXME this is using hard-coded strings but in the future, this functionality will be + // converted to use audio HAL extensions required to support tunneling + mOutput->stream->common.set_parameters(&mOutput->stream->common, "exiting=1"); +} + // PlaybackThread::createTrack_l() must be called with AudioFlinger::mLock held sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrack_l( const sp<AudioFlinger::Client>& client, |