I'm not sure I fully understand your question but my take is that you are asking why Media SDK decoder does not output decoder frame immediately after being fed a compressed frame from the input stream? Does that sufficiently describe your question?
If you are using the sample_decode sample from the SDK, the answer is quite simple. There are two main reasons why the decoder does not output decoded frames immediately:
- Since sample_decode implements an asynchronous pipeline (for optimal performance), the application continues to feed frames into decoder until the allocated decode surfaces are all used up (sync required) or the decode frame call returns ERR_NONE indicating that the first frame has been decoded. So effectively what happens is that, while Media SDK works on decoding the first frame, the application keeps feeding additional frames into the decoder for improved performance. So, even though the first frame is a reference frame there will be a "perceived" delay. If you require immediate output of decoded frame you will have to sync after each frame, which naturally will impact performance.
- Another reason for delayed decoder output is based on the fact that some frames have dependencies (such as B frames) on other frames. If frame X depends on frame Y, X cannot be fully decoded until Y has been decoded.