Community
cancel
Showing results for 
Search instead for 
Did you mean: 
koby_s_
Beginner
86 Views

Limit number of threads in audio session

Hi

I am looking for a way to set the number of thread in an audio session .

Currently, I am running my software on a 16 cores machine and it looks like I have 16 (!) threads per audio session which is way too much for my audio input (AAC-LC, 2 channel, 48KHz). I believe that 1 thread (max 2 threads) should be enough for my scenario.

Is there any way to set the number of threads? I didn't find it in the "Reference Manual For Audio Processing".

Thank you

Koby

0 Kudos
2 Replies
86 Views

Hi Koby, 

If you interested in managing threads on a multicore machine, I recommend taking a look Intel TBB: https://software.intel.com/en-us/intel-tbb. But, please note as Audio is a plugin to Media SDK foundation; using MediaSDK and TBB in parallel could impact overall performance.

Thanks, 

 

koby_s_
Beginner
86 Views

Hi Harsh

Thank you for your response but I don't see how Intel TBB  can help me to reduce the number of threads generated by the Server Studio SDK (and not by my software).

To be more clear, when I call: 

	mfxStatus sts = m_audioSession.Init(MFX_IMPL_AUDIO | MFX_IMPL_SOFTWARE, &version);

I see 16 new threads, and all of them are started from libmfxaudiosw64.dll.

I am looking for a way to limit the number of threads, same way (if possible) as it's done with video session (in sample_multi_transcode for example)

mfxStatus			sts;
mfxInitParam 		initParam;
mfxExtThreadsParam 	threadsParam;
mfxExtBuffer* 		extBufs[1];
bool				needInitExtPar(false);

initPar.Version.Major 	= 1;
initPar.Version.Minor 	= 0;
initPar.GPUCopy 		= 0;
initPar.Implementation 	= pParams->libType;

init_ext_buffer(threadsPar);

if (pParams->nThreadsNum) {
	threadsPar.NumThread = pParams->nThreadsNum;
	needInitExtPar = true;
}

if (needInitExtPar) {
	extBufs[0] = (mfxExtBuffer*)&threadsPar;
	initPar.ExtParam = extBufs;
	initPar.NumExtParam = 1;
}

m_pmfxSession.reset(new MFXVideoSession);
sts = m_pmfxSession->InitEx(initPar);

Thank you !

Reply