MFX_ERR_MEMORY_ALLOC

MFX_ERR_MEMORY_ALLOC

Hi

When the implementation of the

sts = m_pmfxDEC->Init(&m_mfxVideoParams);

return value is -4 (MFX_ERR_MEMORY_ALLOC)

May I ask what factors produced this result?

Thanks

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi,

In your case Intel Media SDK failed to allocate the memory required to create decoder surfaces.

Your system has likely run out of memory. You may try to free up some memory used by other applications or try other lower resolution workload, or expand your system with additonal RAM.
Regards,Petter

I have the exact same problem but I do have enough RAM and when I run the intel example it's work fine.. but I changed it and now it's not working this way. here is my code for initializing decoder :
 

mfxStatus decoder::initDecoder(HWND window, mfxBitstream *Header) {
	mfxStatus sts = MFX_ERR_NONE;
	mfxVersion ver = { { 0, 1 } };
	mfxVideoParam mfxVideoParams;
	mfxFrameAllocator mfxAllocator;
	mfxFrameAllocResponse mfxResponse;

	sts = m_mfxSession.Init(MFX_IMPL_AUTO_ANY, &ver); //sts = MFX_ERR_NONE

	if (sts == MFX_ERR_NONE) {
		sts = m_mfxSession.SetHandle(MFX_HANDLE_DIRECT3D_DEVICE_MANAGER9, 
			m_renderer.initD3d(GetIntelDeviceAdapterNum(), window)); //sts = MFX_ERR_NONE
		if (sts == MFX_ERR_NONE) {
			mfxAllocator.pthis = m_mfxSession;
			sts = m_mfxSession.SetFrameAllocator(&mfxAllocator); //sts = MFX_ERR_NONE
			if (sts == MFX_ERR_NONE) {
				MFXVideoDECODE mfxDEC(m_mfxSession);
				m_mfxVideoDecode = mfxDEC;
				memset(&mfxVideoParams, 0, sizeof(mfxVideoParams));
				mfxVideoParams.mfx.CodecId = MFX_CODEC_AVC;
				mfxVideoParams.IOPattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY;

				sts = m_mfxVideoDecode.DecodeHeader(Header, &mfxVideoParams); //sts = MFX_ERR_NONE
				if (sts == MFX_ERR_NONE) {
					memset(&m_mfxRequest, 0, sizeof(m_mfxRequest));
					sts = m_mfxVideoDecode.Query(&mfxVideoParams, &mfxVideoParams);
					sts = m_mfxVideoDecode.QueryIOSurf(&mfxVideoParams, &m_mfxRequest); //sts = MFX_ERR_NONE
					if (sts == MFX_ERR_NONE) {
						sts = m_renderer.allocSurfaces(mfxAllocator.pthis, &m_mfxRequest, &mfxResponse);
						if (sts == MFX_ERR_NONE) {
							m_pmfxSurfaces = new mfxFrameSurface1 *[m_mfxRequest.NumFrameSuggested];
							for (int i = 0; i < m_mfxRequest.NumFrameSuggested; i++) {
								m_pmfxSurfaces[i] = new mfxFrameSurface1;
								memset(m_pmfxSurfaces[i], 0, sizeof(mfxFrameSurface1));
								memcpy(&(m_pmfxSurfaces[i]->Info), &(mfxVideoParams.mfx.FrameInfo), sizeof(mfxFrameInfo));
								// MID (memory id) represents one video NV12 surface
								m_pmfxSurfaces[i]->Data.MemId = mfxResponse.mids[i];
							};
							sts = m_mfxVideoDecode.Init(&mfxVideoParams); //sts = MFX_ERR_MEMORY_ALLOC
						}
					}
				}
			}
		}
	}

	return sts;
}

 

Leave a Comment

Please sign in to add a comment. Not a member? Join today