Merge commit '6076046a11d2cd3733e4c7d108b3b26d167ae731' into eclair-mr2-plus-aosp * commit '6076046a11d2cd3733e4c7d108b3b26d167ae731': Fix issue 2292062: Audio freezes for three seconds when choosing ringtones with a headset connected and music playing.
This commit is contained in:
@ -2277,10 +2277,8 @@ AudioFlinger::PlaybackThread::Track::~Track()
|
||||
LOGV("PlaybackThread::Track destructor");
|
||||
sp<ThreadBase> thread = mThread.promote();
|
||||
if (thread != 0) {
|
||||
thread->mLock.lock();
|
||||
Mutex::Autolock _l(thread->mLock);
|
||||
mState = TERMINATED;
|
||||
thread->mLock.unlock();
|
||||
AudioSystem::releaseOutput(thread->id());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2298,9 +2296,12 @@ void AudioFlinger::PlaybackThread::Track::destroy()
|
||||
{ // scope for mLock
|
||||
sp<ThreadBase> thread = mThread.promote();
|
||||
if (thread != 0) {
|
||||
if (!isOutputTrack() && (mState == ACTIVE || mState == RESUMING)) {
|
||||
if (!isOutputTrack()) {
|
||||
if (mState == ACTIVE || mState == RESUMING) {
|
||||
AudioSystem::stopOutput(thread->id(), (AudioSystem::stream_type)mStreamType);
|
||||
}
|
||||
AudioSystem::releaseOutput(thread->id());
|
||||
}
|
||||
Mutex::Autolock _l(thread->mLock);
|
||||
PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
|
||||
playbackThread->destroyTrack_l(this);
|
||||
|
Reference in New Issue
Block a user