I have working code that reads ASF files using the Windows Media Format 11 SDK. The code uses the asynchronous ASF-reader pattern. However, recently we obtained ASF files larger than 2GB and the code stops working. I have done some research and can see that after calling IWMReader::Start()
- Note that parsing the stream information went well up to that point - the WMF library seems trying to pull in the whole video file. This fails after a while because of an internal out of memory problem. Finally it does surface as IWMStatusCallback::OnStatus()
with WMT_ERROR
and hr=0x8007000E
(Not enough memory resources are available to complete this operation.). In this scenario I can also see the memory consumption of the process going up quite high (before the error message), so that it is obvious that the OOM problem is what one is dealing with.
From the Microsoft Help it is not at all obvious how one can deal with this situation using the asynchronous reader pattern and control how much memory is consumed until one will get first samples on the IWMReaderCallbackAdvanced::OnStreamSample()
callbacks side. In case of the large ASF file (>2GB) one never gets into that sample delivery callback.
Maybe it is worthwhile trying the synchronous ASF reader as an alternative but that seems to be lot of work and I like to make sure not to have overlook any simple solution regarding the asynchronous Reader.
Any hint on how to deal with this situation is more than welcome.
User contributions licensed under CC BY-SA 3.0