Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ac56b60 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change Iac196e17 into eclair

* changes:
  Fix issue 2292062: Audio freezes for three seconds when choosing ringtones with a headset connected and music playing.
parents 33ad0f9e ac196e17
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -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);