I'm using Intel Media SDK API Version 1.17 on Windows 10 x64, Intel Iris Graphics 540 driver version 22.214.171.12452
When trying to decode an AVC stream, I get the following exception when trying to decode the header using MFXVideoDECODE_DecodeHeader
First-chance exception at 0x00007FFB37991F08 in vrd.exe: Microsoft C++ exception: UMC::h264_exception at memory location 0x00000073437FBB40.
The exception is continuable and eventually, after enough data has been read into the bitstream, the function returns successfully.
This exception only occurs when you tell Visual Studio to break on all thrown exceptions.
Is there a way to prevent this exception from being thrown?
Media SDK works on a frame by frame basis. For best performance, of the Media SDK decoder is to use it in a asynchronous fashion, and it reads frame until enough frame data is available for decoding and hence exception is raised until enough frame data is available for decoding.
Can you provide more background on the application you are using to decode AVC stream. Can you please try with sample_decode (https://github.com/Intel-Media-SDK/samples).
We are using custom code, not the media samples. Data comes into the decoder either from a file or over the network. Our decoder logic appends this data to a bitstream and calls MFXVideoDECODE_DecodeHeader. I could provide code, but it relies on lots of our custom software, so it wouldn't be easy to reproduce.
Is there some rule about how much data we need to read into a bitstream before MFXVideoDECODE_DecodeHeader will execute successfully without throwing the exception?
In streaming use cases throughput is likely not the most central feature but instead latency and robustness etc. If you are requiring encoder to deliver frames in a ordered manner you have to make some changes to introduce either additional sync points or by reordering the bit stream chunks delivered after SyncOperation is called. As, the incoming data over streaming depending on received over channel, I suggest adding a sync point and query before calling MFXVideoDECODE_DecodeHeader function which checks if enough data is received by decoder for next step. You may be interested in taking a look at MediaSDK framework here: https://software.intel.com/en-us/articles/framework-for-developing-applications-using-media-sdk