Use fewer threads on 32-bit to save memory

This commit is contained in:
Jupeyy 2022-03-31 17:51:47 +02:00
parent 8a942a21dd
commit 0b1a801b7e

View file

@ -98,9 +98,16 @@ void CVideo::Start()
m_pFormat = m_pFormatContext->oformat;
#if defined(CONF_ARCH_IA32) || defined(CONF_ARCH_ARM)
// use only the minimum of 2 threads on 32-bit to save memory
m_VideoThreads = 2;
m_AudioThreads = 2;
#else
m_VideoThreads = std::thread::hardware_concurrency() + 2;
// audio gets a bit less
m_AudioThreads = (std::thread::hardware_concurrency() / 2) + 2;
#endif
m_CurVideoThreadIndex = 0;
m_CurAudioThreadIndex = 0;
@ -819,6 +826,11 @@ bool CVideo::AddStream(OutputStream *pStream, AVFormatContext *pOC, const AVCode
}
pStream->pEnc = c;
#if defined(CONF_ARCH_IA32) || defined(CONF_ARCH_ARM)
// use only 1 ffmpeg thread on 32-bit to save memory
c->thread_count = 1;
#endif
switch((*ppCodec)->type)
{
case AVMEDIA_TYPE_AUDIO: