none
Custom mixer sleep issue

    Question

  • Hi ,

    I have an EVR with a custom mixer. The EVR is being used in a DirectShow filter graph with a push source filter connected directly to the EVR. Inside the custom mixer ProcessOutput function I process the input sample, and then call IMediaEventSink::Notify(EC_SAMPLE_NEEDED, 0, 0) to request the next sample from the filter graph.

    The problem is that even with the EC_SAMPLE_NEEDED call the custom mixer sometimes does not receive further samples unless I put a Sleep inside the ProcessOutput function. I had to find out how much of a Sleep to introduce by hit-and-trial. However this is not a  reliable situation and I have to keep tweaking the Sleep duration to get it to work. 

    So may I know why do I need this Sleep to receive samples inside the mixer? 
    Is there a better way to accomplish this without having to do an ugly sleep in the mixer? Should I implement some kind of frame rate control?

    Thanks in advance.

    Regards,
    Ahmad 
    • Moved by The March HareModerator Tuesday, June 30, 2009 11:44 PM dshow related (From:Media Foundation Development)
    Tuesday, June 30, 2009 11:14 PM

Answers

  • Finally I have found the solution to this problem. It was caused by building filter graphs with clips which have audio streams in them. And I do not really know what the issue with my sound card was, but disabling the sound card resolved the problem. So it seems like the filter graph hang was being caused by the faulty audio card/driver which was holding up the entire filter graph.

    I couldn't have resolved this issue without the help of Roman Ryltsov's filter graph spy, so kudos!

    • Marked as answer by ahmadR Saturday, August 01, 2009 1:12 AM
    Saturday, August 01, 2009 1:12 AM

All replies

  • My mistake - I did not have the IMediaEventSink pointer initialized after all. With the pointer initialized, everything seems to be fine.

    • Marked as answer by ahmadR Tuesday, June 30, 2009 11:24 PM
    • Unmarked as answer by ahmadR Thursday, July 30, 2009 10:33 PM
    Tuesday, June 30, 2009 11:24 PM
  • I have an update to the original question: On Windows 7 and WMV clips, everything is working fine in my application. However in Windows Vista, I do not get any samples in ProcessInput after the first few samples. WMVDecod.dll is waiting in MsgWaitForMultipleObjects so looks like further samples are not getting delivered to the mixer. I have the IMediaEventSink interface object properly defined and I ahve requested for the next sample, but it is not getting delivered.

    Seeing that this happens only on Vista and with 'some' WMV clips only (of the wmv and mpeg2 I tried), can someone point me to the right direction? What do I need to ensure apart from IMediaEventSink::Notify(EC_Sample_Needed ..) to make sure that I get input samples in the mixer?

     

    Thanks,

    Ahmad

     

     

    • Edited by ahmadR Thursday, July 30, 2009 10:46 PM
    Thursday, July 30, 2009 10:33 PM
  • Finally I have found the solution to this problem. It was caused by building filter graphs with clips which have audio streams in them. And I do not really know what the issue with my sound card was, but disabling the sound card resolved the problem. So it seems like the filter graph hang was being caused by the faulty audio card/driver which was holding up the entire filter graph.

    I couldn't have resolved this issue without the help of Roman Ryltsov's filter graph spy, so kudos!

    • Marked as answer by ahmadR Saturday, August 01, 2009 1:12 AM
    Saturday, August 01, 2009 1:12 AM