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

Commit e1c37946 authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "audio policy: fix overflow in condition wait timeout"

parents 3ba7ed56 d7eda8d0
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -449,7 +449,7 @@ void AudioPolicyService::AudioCommandThread::onFirstRef()

bool AudioPolicyService::AudioCommandThread::threadLoop()
{
    nsecs_t waitTime = INT64_MAX;
    nsecs_t waitTime = -1;

    mLock.lock();
    while (!exitPending())
@@ -614,7 +614,7 @@ bool AudioPolicyService::AudioCommandThread::threadLoop()
                        command->mCond.signal();
                    }
                }
                waitTime = INT64_MAX;
                waitTime = -1;
                // release mLock before releasing strong reference on the service as
                // AudioPolicyService destructor calls AudioCommandThread::exit() which
                // acquires mLock.
@@ -636,9 +636,13 @@ bool AudioPolicyService::AudioCommandThread::threadLoop()
        // has a finite delay. So unless we are exiting it is safe to wait.
        if (!exitPending()) {
            ALOGV("AudioCommandThread() going to sleep");
            if (waitTime == -1) {
                mWaitWorkCV.wait(mLock);
            } else {
                mWaitWorkCV.waitRelative(mLock, waitTime);
            }
        }
    }
    // release delayed commands wake lock before quitting
    if (!mAudioCommands.isEmpty()) {
        release_wake_lock(mName.string());