I have a Media Foundation based video decoder that works with the HEVC Codec from Microsoft.
On my development machine it works just fine.
However, on our production machines (which are very locked down devices with integrated GPUs and no Internet connections), attempting to activate the single transform that is found (the HEVC one I want to use) fails.
The error code returned is:
0x800704CF - The network location cannot be reached.
Some investigations suggest this is because Media Foundation (or the HEVC Codec or something associated with it) is trying to connect to sls.update.microsoft.com
. And if it can't do that, it fails the activation.
My question is: How can I stop this?
Or more specifically, because I probably can't stop this, how do I fool Media Foundation into thinking it has already tried and succeeded in connecting?
On my development machine, it doesn't look like Media Foundation is making this connection attempt every time the application starts - it appears to be a one time thing, so presumably there's a registry key being written that I can force/fake on our production machines.
I've been hunting through the registry on my development machine, but haven't located anything that could be related - yet. (Maybe someone knows where I should be looking?)
Or is there an official way to run Media Foundation on a machine with no Internet connection?
The H.265 / HEVC Video Decoder is in fact available through a Microsoft Windows Store application named HEVC Video Extensions (installed in %ProgramFiles%\WindowsApps\Microsoft.HEVCVideoExtension...
). It consists today of two binaries: HEVCDECODER_STORE.dll
and mfH265Enc.dll
.
Note this is not a free application. There used to also exist a 'HEVC from Device Manufacturer' that has disappeared from the store that was free. It's not clear the exact technical differences between the two, that may be due to HEVC licensing issues (see High Efficiency Video Coding).
On a Windows installation where this "application" has never been installed, it will try to contact Microsoft licensing server. If the server cannot be contacted because you don't have an available Internet connection, this step will fail. This is where you may get the 0x800704CF
(ERROR_NETWORK_UNREACHABLE
) error, and I get 0x80072ee7
(WININET_E_NAME_NOT_RESOLVED
)...
Note if you installed it once, then the license seems to stay even if you uninstall the application afterwards.
The licensing issue can be seen while debugging a simple application using the HEVC Media Foundation IMFActivate interface and trying to use it like this:
IMFActivate* hevcActivate ... gotten from somewhere
IMFTransform* hevcTransform;
hevcActivate->QueryInterface(IID_IMFTransform, (void**)&hevcTransform);
This is what's displayed in the debugger output:
...
ModLoad: 00007fff`71d10000 00007fff`71f47000 C:\Windows\System32\Windows.ApplicationModel.Store.dll
ModLoad: 00007fff`bdad0000 00007fff`bdaf9000 C:\Windows\System32\Cabinet.dll
ModLoad: 00007fff`bac20000 00007fff`baedc000 C:\Windows\System32\iertutil.dll
ModLoad: 00007fff`a3970000 00007fff`a3ac3000 C:\Windows\System32\webservices.dll
ModLoad: 00007fff`be070000 00007fff`be17a000 C:\Windows\System32\WINHTTP.dll
info:Setting MSA Client Id for Token requests: {f0c62012-2cef-4831-b1f7-930682874c86} (0x80004005) [WinStoreAuth::AuthenticationInternal::SetMsaClientId]
onecoreuap\enduser\winstore\auth\lib\winstoreauth.cpp(267)\Windows.ApplicationModel.Store.dll!00007FFF71D16DBE: (caller: 00007FFF71E3465F) LogHr(1) tid(148c) 80004005 Unspecified error
Msg:[Setting MSA Client Id for Token requests: {f0c62012-2cef-4831-b1f7-930682874c86}] [WinStoreAuth::AuthenticationInternal::SetMsaClientId]
info:Windows::Services::Store::StoreContextFactory::GetDefault() invoked. (CV:5TroTyea8UKFylH5.2) [Windows::Services::Store::StoreContextFactory::GetDefault]
ModLoad: 00007fff`bf2c0000 00007fff`bfa90000 C:\Windows\System32\OneCoreUAPCommonProxyStub.dll
info:StoreContextServer::Initialize: packageFullName = , productStoreId = , isLicensed = false, isAppContainer = false [Windows::Services::Store::Internal::StoreContextServer::Initialize]
info:Windows::Services::Store::StoreContext::AcquireStoreLicenseForOptionalPackageAsync invoked. (CV:5TroTyea8UKFylH5.2.3) [Windows::Services::Store::StoreContext::AcquireStoreLicenseForOptionalPackageAsync]
ERROR: (0x80070057) [ClientProcessUtils::GetCallingAppPackageFamilyName]
ModLoad: 00007fff`bd2a0000 00007fff`bd2b6000 C:\Windows\SYSTEM32\usermgrcli.dll
(c98.1ac4): Unknown exception - code 80072ee7 (first chance)
ERROR:ChkHr(hr) (0x80072ee7) [Windows::Services::Store::Internal::StoreContextServer::AcquireStoreLicenseForOptionalPackage]
ERROR:ChkHr(storeContextServer->AcquireStoreLicenseForOptionalPackage( optionalPfn.Get(), spStorePackageLicenseLostCallback.Get(), &_valid)) (0x80072ee7) [Windows::Services::Store::StorePackageLicense::RuntimeClassInitialize]
ERROR: (0x80070057) [ClientProcessUtils::GetCallingAppPackageFamilyName]
ERROR:ChkHr(MakeAndInitialize<StorePackageLicense>( &_pStorePackageLicense, _pOptionalPackage.Get(), _storeContext.Get() )) (0x80072ee7) [Windows::Services::Store::AcquireStoreLicenseForOptionalPackageOperation::DoWork]
(c98.148c): CLR exception - code e0434352 (first chance)
ModLoad: 00007fff`71cc0000 00007fff`71d0c000 C:\Program Files\WindowsApps\Microsoft.WebpImageExtension_1.1.522.0_x64__8wekyb3d8bbwe\x64\mswebp_store.dll
(c98.148c): C++ EH exception - code e06d7363 (first chance)
...
We see that underlying code uses the StoreContext.AcquireStoreLicenseForOptionalPackageAsync WinRT's method and fails with ERROR:ChkHr(hr) (0x80072ee7)
.
So, it's a licensing issue. Maybe it's possible to distribute this package offline, this is a hint Distribute offline apps, not sure how/if it works.