Audioflinger: adjust wait time for duplicating thread
When the downstream thread has a larger frame count than duplicating thread, lower the wait time to avoid underrun on the downstream thread.
Bug: 361029363
Change-Id: I1a9b64e363748ab9d1c0b16ebaef2f0022e1d3ec
Test: TH
Flag: EXEMPT bugfix
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index b7c0bb3..4aab996 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -7881,7 +7881,8 @@
// caller must hold mutex()
void DuplicatingThread::updateWaitTime_l()
{
- mWaitTimeMs = UINT_MAX;
+ // Initialize mWaitTimeMs according to the mixer buffer size.
+ mWaitTimeMs = mNormalFrameCount * 2 * 1000 / mSampleRate;
for (size_t i = 0; i < mOutputTracks.size(); i++) {
const auto strong = mOutputTracks[i]->thread().promote();
if (strong != 0) {