Our application creates 33 by QueryIOSurf now, I tried to modify through Request.NumFrameMin, but failed (decoder does not output frames at all). How can lower down this number?How does MFXVideoDECODE to calculate the number of surfaces required for decoder? What do these surfaces do?
Thanks in advance
QueryIOSurf will tell you the minimum number of surfaces the decoder or encoder needs. You cannot use less surfaces than reported by Request.NumFrameMin. However, by configuring the decoder component by explicitly setting the AsyncDepth parameter you can reduce the number of surfaces needed. AsyncDepth = 1 will result in least amount of surfaces, but note that this setting will likely also affect performance due to limited internal caching and multi-tasking.
The actual number of surfaces needed depends on the stream that is being decoded. Besides the memory needed for each surface the decoder/encoder also requires some additional memory for scratch buffers.
Note that if you set AsyncDepth to 0, Media SDK will select an appropriate value to achieve good performance. Also note that if low latency is more important than optimal performance then it is suggested to set AsyncDepth to 1 as explained in the SDK manual appendix covering video conferencing use case.
If you are interested in low latency usages please refer to the Media SDK 2012 sample_decode and sample_videoconf samples.
My experience with MSDK shows that if there more than one session running at the same time (joined or not) it's better to set AsyncDepth to value which depends on framerate and resolution, then QueryIOSurf returns appropriate number of surfaces, so all sessions runs smoothly and it doesn't have to drop frames (I speak about live encoding, where timing is very important). I've tested for total (for all sessions) framerate of 825 fps with loss of frames less than 0.02%.