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

Commit e6affce8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Clamp AIDL stream latency to [1, 3000] ms" into main am: 577aa365 am: d2094760

parents 9d0ea8ef d2094760
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -267,7 +267,11 @@ status_t StreamHalAidl::getLatency(uint32_t *latency) {
    if (status_t status = updateCountersIfNeeded(&reply); status != OK) {
    if (status_t status = updateCountersIfNeeded(&reply); status != OK) {
        return status;
        return status;
    }
    }
    *latency = std::max<int32_t>(0, reply.latencyMs);

    *latency = std::clamp(std::max<int32_t>(0, reply.latencyMs), 1, 3000);
    ALOGW_IF(reply.latencyMs != static_cast<int32_t>(*latency),
             "Suspicious latency value reported by HAL: %d, clamped to %u", reply.latencyMs,
             *latency);
    return OK;
    return OK;
}
}