codec/h264: fix potential segfault and mf_init
This commit is contained in:
parent
acd97ccdd7
commit
456ce96618
@ -468,7 +468,7 @@ BOOL h264_context_init(H264_CONTEXT* h264)
|
||||
for (i = 0; i < MAX_SUBSYSTEMS; i++)
|
||||
{
|
||||
H264_CONTEXT_SUBSYSTEM* subsystem = subSystems[i];
|
||||
if (!subsystem->Init)
|
||||
if (!subsystem || !subsystem->Init)
|
||||
break;
|
||||
|
||||
if (subsystem->Init(h264))
|
||||
|
@ -517,10 +517,12 @@ static BOOL mf_init(H264_CONTEXT* h264)
|
||||
"MFCreateMediaType");
|
||||
sys->MFCreateDXGIDeviceManager = (pfnMFCreateDXGIDeviceManager) GetProcAddress(
|
||||
sys->mfplat, "MFCreateDXGIDeviceManager");
|
||||
|
||||
/**
|
||||
* Note: MFCreateDXGIDeviceManager is supported starting from Windows 8.
|
||||
* Don't fail below if GetProcAddress returned NULL.
|
||||
*/
|
||||
if (!sys->MFStartup || !sys->MFShutdown || !sys->MFCreateSample
|
||||
|| !sys->MFCreateMemoryBuffer ||
|
||||
!sys->MFCreateMediaType || !sys->MFCreateDXGIDeviceManager)
|
||||
|| !sys->MFCreateMemoryBuffer || !sys->MFCreateMediaType)
|
||||
goto error;
|
||||
|
||||
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
|
||||
|
Loading…
Reference in New Issue
Block a user