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

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

Merge "Issue 4345021: Audio routed to multiple devices..."

parents 18b43119 5f37be32
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -87,6 +87,8 @@ static const nsecs_t kWarningThrottle = seconds(5);
// RecordThread loop sleep time upon application overrun or audio HAL read error
static const int kRecordThreadSleepUs = 5000;

static const nsecs_t kSetParametersTimeout = seconds(2);

// ----------------------------------------------------------------------------

static bool recordingAllowed() {
@@ -1032,7 +1034,7 @@ status_t AudioFlinger::ThreadBase::setParameters(const String8& keyValuePairs)
    mWaitWorkCV.signal();
    // wait condition with timeout in case the thread loop has exited
    // before the request could be processed
    if (mParamCond.waitRelative(mLock, seconds(2)) == NO_ERROR) {
    if (mParamCond.waitRelative(mLock, kSetParametersTimeout) == NO_ERROR) {
        status = mParamStatus;
        mWaitWorkCV.signal();
    } else {
@@ -2349,7 +2351,9 @@ bool AudioFlinger::MixerThread::checkForNewParameters_l()

        mParamStatus = status;
        mParamCond.signal();
        mWaitWorkCV.wait(mLock);
        // wait for condition with time out in case the thread calling ThreadBase::setParameters()
        // already timed out waiting for the status and will never signal the condition.
        mWaitWorkCV.waitRelative(mLock, kSetParametersTimeout);
    }
    return reconfig;
}
@@ -2828,7 +2832,9 @@ bool AudioFlinger::DirectOutputThread::checkForNewParameters_l()

        mParamStatus = status;
        mParamCond.signal();
        mWaitWorkCV.wait(mLock);
        // wait for condition with time out in case the thread calling ThreadBase::setParameters()
        // already timed out waiting for the status and will never signal the condition.
        mWaitWorkCV.waitRelative(mLock, kSetParametersTimeout);
    }
    return reconfig;
}
@@ -4669,7 +4675,9 @@ bool AudioFlinger::RecordThread::checkForNewParameters_l()

        mParamStatus = status;
        mParamCond.signal();
        mWaitWorkCV.wait(mLock);
        // wait for condition with time out in case the thread calling ThreadBase::setParameters()
        // already timed out waiting for the status and will never signal the condition.
        mWaitWorkCV.waitRelative(mLock, kSetParametersTimeout);
    }
    return reconfig;
}