locked
How to properly use the MEStreamTick event RRS feed

  • Question

  • I'd like to use this event whenever my custom media source has to buffer data. I've found that blocking RequestSample() until buffering has completed results in delayed timestamps which causes the media session to just chew the buffered data anyway(data source provides data at the same rate of playback).

    I'm firing the event from the Media Stream since it generates the time-stamps artificially, per video frame. So within the media stream I've got:

    LONGLONG currentTimeStamp (class member)

    PROPVARIANT var;

    var.vt = VT_I8;
    var.hVal.QuadPart = currentTimeStamp;
    this->QueueEvent(MEStreamTick,GUID_NULL,S_OK,&var);

    then I have the required event fired to couple with the RequestSample() call

    var.vt = VT_UNKNOWN;
    var.punkVal = NULL;
    this->QueueEvent(MEMediaSample, GUID_NULL,S_OK,&var);

    After the call to RequestSample() where there is a MEStreamTick event, RequestSample() is never called again by the media source. I wasn't sure about what HRESULT values to use for either event in this situation so I tried combos of S_OK and E_FAIL but no luck.

    Any tips on where I'm going wrong would be great thanks.
    Monday, October 19, 2009 3:18 AM

Answers

  • MEStreamTick does not count as completing a RequestSample call, so the session will not call RequestSample again until you actually deliver a sample.

    Instead of MEStreamTick, you could send MEBufferingStarted / MEBufferingStopped events: http://msdn.microsoft.com/en-us/library/ms700171(VS.85).aspx

    - Mike


    Mike Wasson (SDK Documentation)
    • Marked as answer by _Nobby_ Monday, October 19, 2009 8:35 AM
    Monday, October 19, 2009 6:15 AM

All replies

  • MEStreamTick does not count as completing a RequestSample call, so the session will not call RequestSample again until you actually deliver a sample.

    Instead of MEStreamTick, you could send MEBufferingStarted / MEBufferingStopped events: http://msdn.microsoft.com/en-us/library/ms700171(VS.85).aspx

    - Mike


    Mike Wasson (SDK Documentation)
    • Marked as answer by _Nobby_ Monday, October 19, 2009 8:35 AM
    Monday, October 19, 2009 6:15 AM
  • Thanks for that Mike. That's a more logical solution than skipping time and works really well. I had an issue with neither implementation working initially because I was accidentally returning a non-S_OK HRESULT within RequestSample() =/
    Monday, October 19, 2009 8:35 AM