Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(native): the audio watchdog compiles under the min macro windows.h defines

yhh627ce0c58ec9
diff --git a/native/host/media/audio_watchdog.hpp b/native/host/media/audio_watchdog.hpp
index 2b597d42a..438049ec3 100644
--- a/native/host/media/audio_watchdog.hpp
+++ b/native/host/media/audio_watchdog.hpp
@@ -2,7 +2,6 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
#pragma once
-#include <algorithm>
#include <cstdint>
namespace eshost {
@@ -35,7 +34,8 @@ public:
}
if (nowMs < nextTryMs_) return Action::None;
++failures_;
- nextTryMs_ = nowMs + std::min(kGraceMs * double(1 << std::min(failures_, 4)), kMaxBackoffMs);
+ const double backoff = kGraceMs * double(1 << (failures_ < 4 ? failures_ : 4));
+ nextTryMs_ = nowMs + (backoff < kMaxBackoffMs ? backoff : kMaxBackoffMs);
return failures_ <= kRestartsBeforeRebuild ? Action::Restart : Action::Rebuild;
}