locked
IMFSample with SampleTime 0 leads to Tearing on the EVR RRS feed

  • Question

  • hello,

    i recently encountered an unexpected behavior of the EVR. I render live video streams using a custom media source. when i use the frame time stamps, everything works as expected and the EVR eliminates tearing as stated in the docs.

    however, my media source has a special mode where i ignore the timestamps of the frames, and just set the sampleTime to 0 (Zero) which leads to instant rendering and a subsequent RequestSample call on my Media Stream. 

    At least this was my way for "instant" rendering until now. today i realized that using IMFSamples with sample time 0 reintroduces tearing.

    is this by design or a bug in the EVR? (enabling/disabling DXVA makes no difference, tried on different GPUs of 3 manufacturers)

    are there any other best practices to instantly render a frame (without caring about delay or anything else) for live sources? characteristics of my media source are set to MFMEDIASOURCE_IS_LIVE.

    thanks

    Edit: This could not be reproduced when the Aero Design is active, so i guess Aero has its fingers in too. Any ideas would be appreciated.

    Monday, February 20, 2012 3:37 PM

Answers

  • If all samples have a time of 0, every sample will appear late (really late) to the EVR.  It will present the sample immediately rather than scheduling it for a presentation time, which is likely what leads to the tearing you are seeing.

    Unfortunately, there is no way to mark a sample so that is presented immediately but is not considered late.  The MF device source uses QueryPerformanceCounter to generate a timestamp as samples come in, which roughly gets them presented 'now.'  You could try something similar, generating a timestamp based off of the QueryPerformanceCounter delta from the last timestamp you provided.

    Aero turns on desktop composition, so it is possible that the EVR's output is getting resynchronized with the monitor when Aero composes the desktop image.

    Saturday, April 14, 2012 12:11 AM