locked
MF and Multicore RRS feed

  • Question

  • hi there,

    i wonder if there is any documentation available on Media Foundation and Multicore/Multithreading stuff. i currently encounter some issues with playback of several dozen videos at the same time. i implemented a custom media source and i could see that long running operations in RequestSample() of an IMFMediaStream brake down playback of other media sessions. as Sample delivery should be performed asynchronously, this is not that much of a problem. however. to me it seems that MediaFoundation does a lot of stuff in a synchronous manner internally. 

    Even when i create my mediasessions, topologies etc. on different threads, cpu core usage seems to me as if a lot of stuff happens on the same thread.

    i tried to distribute most of the work onto different threads, however, during playback of e.g. 12 mpeg4 videos á 25fps, one of my four cores is under heavy load while the others aren't.

    i recognized that even when i create multiple independent mediasessions, the RequestSample() call to my custom media streams is always done on the same thread. 

    are there any documents out there regarding MF and load balancing on multiple cores or how data is processed internally? or is MF out of the box not suited for parallel playback of multiple video sources?

     

    regards

    joachim

    Tuesday, August 24, 2010 2:28 PM

All replies

  • All media sessions within the same application use the same platform workqueues for processing, unless otherwise set up.  If you run a large number of sessions within the same applications, one or two threads could easily get overloaded with work items.  The solution to this problem is to create private workqueues and assign them to topology branches.

    To create a private workqueue, use MFAllocateWorkQueue to get a workqueue identifier.  Then set the MF_TOPONODE_WORKQUEUE_ID attribute on the source stream node that you want to use that workqueue.  You can also use private workqueues inside custom components by passing the right workqueue identifier when calling functions like MFPutWorkItem.

    Using Work Queues has more information about how work queues are used within Media Foundation.

    Thursday, September 9, 2010 12:55 AM
  • Hi Matt,

    thanks for this hint. works like charm. 

    regards

    j.

    Friday, September 10, 2010 8:43 AM