Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. //Calculates the Media Frame Rate. The Numerator and Denominator were obtained from IMFMediaType from the video file loaded locally by IMFSourceReader.
  2. var FrameRate = Math.Round((Numerator / Denominator)).
  3.  
  4. //Calculates the delay that will be used to call the next sample. Video processing time is 8 to 11ms.
  5. var Delay = Math.Round((1000 - Video Sample Processing Time) / FrameRate) - 12.
  6.  
  7. //Get the next video sample available in the buffer.
  8. IMFSample VideoSample = BufferVideo.Next();
  9.  
  10. //Calls the method that will copy the read sample data to the IMFVideoSampleAllocator sample. The sample is accessed for the IMF2DBuffer2 interface as recommended by MSDN.
  11. ProcessVideoSample(VideoSample);
  12.  
  13. //I call IMFSourceReader to read the next available video sample. This method is thread safe. The sample reader is in Asynchronous mode.
  14. RequestNextSample(TypeSample.Video);
  15.  
  16. //Delay to read the next sample. The delay is calculated as shown above.
  17. await Task.Delay(DelayFrameRate);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement