media foundation H264 decoder not working properly


I'm creating an application for video conferencing using media foundation and I'm having an issue decoding the H264 video frames I receive over the network.

<strong>The Design</strong>

Currently my network source queues a token on every request sample, unless there is an available stored sample. If a sample arrives over the network and no token is available the sample is stored in a linked list. Otherwise it is queued with the MEMediaSample event. I also have the decoder set to low latency.

<strong>My Issue</strong>

When running the topology using my network source I immediately see the first frame rendered to the screen. I then experience a long pause until a live stream begins to play perfectly. After a few seconds the stream appears to pause but then you notice that it's just looping through the same frame over and over again adding in a live frame every couple of seconds that then disappears immediately and goes back to displaying the old loop.

Why is this happening? I'm by no means an expert in H264 or media foundation for that matter but, I've been trying to fix this issue for weeks with no success. I have no idea where the problem might be. Please help me!

The time stamp is created by starting at 0 and adding the duration to it for every new sample. The other data is retrieved from a IMFSampleGrabberSinkCallback.

I've also posted some of my MFTrace onto the msdn media foundation forums <a href="http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/a14e7435-a414-4a2a-849a-8e2c906d4b17/media-foundation-h264-decoder-not-working-properly?forum=mediafoundationdevelopment/" rel="nofollow">Link</a>

I mentioned on there that the presentation clock doesn't seem to change on the trace but, I'm unsure if that's the cause or how to fix it.


<strong>EDIT</strong>: Could you share the video and a full mftrace log for this issue? It's not clear for me what really happens: do you see the live video after a while?

The current log does not contain enough information to trace sample processing. From your description is looks like that only keyframes are rendered. Plus, duration is weird for the rendered keyframe:

Sample @00A74970, Time 6733ms, Duration 499ms. <- Duration is not 33ms.

I would like to see what happened to that sample.

In any case, if you are using standard encoder and decoder, the issue should be with your media source, and how it buffers frames. Incorrect circular buffer implementation? You may want to try and cache a second or two of samples before starting giving them to the decoder.


  • Android WebView : disable geo: for addresses
  • Embedded and installed IronPython - dll versions confusion
  • How to measures script execution and *parsing* time?
  • How to build Quazip 0.5.1 on Windows 7?
  • Java - localhost root folder?
  • Get Youtube Video ID From Link With JavaScript
  • Why unsigned int stills signed? [duplicate]
  • how to partition the nodes of an undirected graph into k sets
  • How to pivot table for year in SQL?
  • parser m3u file using java in android studio
  • CLLocationManager only monitors regions the first time the app is run after install
  • Apply function to an array of tuples
  • if there is no internet connection, hide iframe
  • Why use 4096 elements for a char array buffer?
  • Fixing tabs to the top of the page, but underneath the header
  • Proc sql: new and continue customers based on look back period
  • Java: search words in two dimensional array
  • C++ method declaration including a macro
  • CameraPreviewImageSource empty preview frame
  • Enable a text box only when 1 of the radio button is clicked
  • AngularJS Dynamic Directives inside ng-repeat
  • ClearCase can I use clearexport_ccase/clearimport to copy VOB data to a VOB on a different machine
  • Lodash cloneDeepWith to omit undefined
  • Laravel Query Builder Update with Increment
  • How can I access the Google account user_id?
  • Spongycastle is missing many algorithms when loaded on android
  • Validating a Firebase Key [duplicate]
  • Jekyll - How do I create pages in the root directory?
  • Map Annotation Disclosure Indicator - Xamarin.Form
  • Querying Elasticsearch Address Based Index
  • android : speech recognition what are the technologies available
  • Java Collections.shuffle() weird behaviour [closed]
  • Request Access Token in Postman for Azure Function App protected by Azure AD B2C
  • time column in sqlite using gorm
  • When to use the tag in the head and body section of a html page? [duplicate]
  • Change cell value based on cell color in google spreadsheet
  • How to handle a codeigniter PDF generator