locked
event problem when seeking RRS feed

  • Question

  • i m using media session to play n seek file. i have a fun to seek a frame and capturing events. when i seek at last frame i get

    'MESessionEnded' event but when i seek 2-3 frames back then i also get 'MESessionEnded'  event, how can i get session ended event when i seek 2-3 back. in some file at last frame i dont get 'MESessionEnded' event. i also check the status of events i dont get any error. i m using .avi files.

    plz reply.

    Thursday, June 17, 2010 8:04 AM

Answers

  • Seeking in the AVI source is not frame accurate.  The source approximates a byte offset in the file based upon the seek time, and this approximation could very well be off enough to be beyond the last sample of the stream if you are seeking near the end of the file.  This is a known problem and the workarounds are a bit ugly -- essentially, subtracting a constant delta from the seek time and then reading frames forward until the desired frame is hit.

    If you are saying that with some AVI content, you can seek near the end and not get any events back, that sounds like a bug.  If you could point me to the content I would be interested in taking a look at it.

    Tuesday, July 13, 2010 1:07 AM

All replies

  • Seeking in the AVI source is not frame accurate.  The source approximates a byte offset in the file based upon the seek time, and this approximation could very well be off enough to be beyond the last sample of the stream if you are seeking near the end of the file.  This is a known problem and the workarounds are a bit ugly -- essentially, subtracting a constant delta from the seek time and then reading frames forward until the desired frame is hit.

    If you are saying that with some AVI content, you can seek near the end and not get any events back, that sounds like a bug.  If you could point me to the content I would be interested in taking a look at it.

    Tuesday, July 13, 2010 1:07 AM
  • I know this thread is one year old, but I stumbled upon it when I was looking for an answer for the same issue. I'm implementing an accurate video player on top of Media Foundation to gives the user the ability to seek frame by frame (frame stepping), but the issue is that when I reach toward the end of the topology, MESessionEnded event is raised before reaching the actual end (i.e. several frames before the last frame). In your comment Matt you mentioned something about a possible workaround that might solve this issue but also might be a bit ugly, can you elaborate more on this workaround? 

    Any help regarding this is much appreciated, thanks.

    Sunday, June 26, 2011 1:27 PM