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

Commit d2094760 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

parents 192b7b91 577aa365
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -267,7 +267,11 @@ status_t StreamHalAidl::getLatency(uint32_t *latency) {
    if (status_t status = updateCountersIfNeeded(&reply); status != OK) {
        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;
}