IMFSourceReader consuming high CPU power RRS feed

  • Question

  • I'm working on a custom video player using the IMFSourceReader. However, I noticed that my application consumes more CPU than other video players in the market.
    If my video app takes 7-10 % CPU usage, windows media player would use between 3-5 % CPU.
    I looked out for various optimizations in my code but narrowed down to the ReadSample method of IMFSourceReader. I use D3D with DXVA-HD to render video samples and XAudio2 for audio. I just read the sample and did not render it and saw the CPU usage high.

    Also, even if I use an asynchronous source reader / or sync source reader in a low priority thread, the CPU usage remains high.

    I have set the attributes for the SourceReader to use Hardware acceleration. I'm working on a Sandybridge machine with IntelHD 3000 graphics.

    Can anyone help me optimize the usage?


    • Edited by mots_g Wednesday, February 29, 2012 9:30 AM
    Wednesday, February 29, 2012 9:15 AM

All replies

  • It is odd that you notice extra CPU usage with the source reader.  The source reader tries to serve frames with minimal extra processing.  Have you experimented with different media types as the output of the source reader?  It could be that the color space or some other attribute you are requesting on the output is not the most optimal format.  If you are not already, start with MFVideoFormat_NV12 and see if you experience better performance.
    Saturday, April 14, 2012 12:42 AM