AudioFlinger: Fix unsigned overflow

Can occur on duplicating thread shutdown with no output tracks.

Test: compiles
Bug: 312949498
Change-Id: I7a979c547238bc1a2b24f7cdbbee61514006d6e8
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 2aa7cbf..860a4e4 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -7758,7 +7758,8 @@
 
 uint32_t DuplicatingThread::activeSleepTimeUs() const
 {
-    return (mWaitTimeMs * 1000) / 2;
+    // return half the wait time in microseconds.
+    return std::min(mWaitTimeMs * 500ULL, (unsigned long long)UINT32_MAX);  // prevent overflow.
 }
 
 void DuplicatingThread::cacheParameters_l()