SL-16182: LLAudioDecodeMgr: Get general worker thread count directly from ThreadPool
parent
3e60b53d52
commit
30252bceb0
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue