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

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

Merge "audio flinger: extend command timeout for patch creation" into main

parents 2ec03470 3fddffee
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -165,6 +165,9 @@ static const int kRecordThreadSleepUs = 5000;

// maximum time to wait in sendConfigEvent_l() for a status to be received
static const nsecs_t kConfigEventTimeoutNs = seconds(2);
// longer timeout for create audio patch to account for specific scenarii
// with Bluetooth devices
static const nsecs_t kCreatePatchEventTimeoutNs = seconds(4);

// minimum sleep time for the mixer thread loop when tracks are active but in underrun
static const uint32_t kMinThreadSleepTimeUs = 5000;
@@ -731,9 +734,11 @@ NO_THREAD_SAFETY_ANALYSIS // condition variable
    mutex().unlock();
    {
        audio_utils::unique_lock _l(event->mutex());
        nsecs_t timeoutNs = event->mType == CFG_EVENT_CREATE_AUDIO_PATCH ?
              kCreatePatchEventTimeoutNs : kConfigEventTimeoutNs;
        while (event->mWaitStatus) {
            if (event->mCondition.wait_for(
                    _l, std::chrono::nanoseconds(kConfigEventTimeoutNs), getTid())
                    _l, std::chrono::nanoseconds(timeoutNs), getTid())
                            == std::cv_status::timeout) {
                event->mStatus = TIMED_OUT;
                event->mWaitStatus = false;