diff options
-rwxr-xr-x | indra/llaudio/llaudiodecodemgr.cpp | 7 |
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(); |