summaryrefslogtreecommitdiff
path: root/indra/llaudio
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2022-05-31 12:49:53 -0700
committerCosmic Linden <cosmic@lindenlab.com>2022-06-14 11:31:52 -0700
commit30252bceb068bc1b687b18a85ab5e1b5a98c1184 (patch)
treecd5930263b8e40be0eaea9cdb5dc300c3a3d3a04 /indra/llaudio
parent3e60b53d52d09e3f1412a9476743a77e555104d9 (diff)
SL-16182: LLAudioDecodeMgr: Get general worker thread count directly from ThreadPool
Diffstat (limited to 'indra/llaudio')
-rwxr-xr-xindra/llaudio/llaudiodecodemgr.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp
index cc5abee08a..4c4f4d3d0e 100755
--- a/indra/llaudio/llaudiodecodemgr.cpp
+++ b/indra/llaudio/llaudiodecodemgr.cpp
@@ -35,6 +35,7 @@
#include "llendianswizzle.h"
#include "llassetstorage.h"
#include "llrefcount.h"
+#include "threadpool.h"
#include "workqueue.h"
#include "llvorbisencode.h"
@@ -575,8 +576,10 @@ void LLAudioDecodeMgr::Impl::startMoreDecodes()
// *NOTE: main_queue->postTo casts this refcounted smart pointer to a weak
// pointer
LL::WorkQueue::ptr_t general_queue = LL::WorkQueue::getInstance("General");
+ const LL::ThreadPool::ptr_t general_thread_pool = LL::ThreadPool::getInstance("General");
llassert_always(main_queue);
llassert_always(general_queue);
+ llassert_always(general_thread_pool);
// Set max decodes to double the thread count of the general work queue.
// This ensures the general work queue is full, but prevents theoretical
// buildup of buffers in memory due to disk writes once the
@@ -585,9 +588,9 @@ void LLAudioDecodeMgr::Impl::startMoreDecodes()
// without modifying/removing LLVorbisDecodeState, at which point we should
// consider decoding the audio during the asset download process.
// -Cosmic,2022-05-11
- const size_t MAX_DECODES = 4 * 2;
+ const size_t max_decodes = general_thread_pool->getWidth() * 2;
- while (!mDecodeQueue.empty() && mDecodes.size() < MAX_DECODES)
+ while (!mDecodeQueue.empty() && mDecodes.size() < max_decodes)
{
const LLUUID decode_id = mDecodeQueue.front();
mDecodeQueue.pop_front();