The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

MediaElement wrong Position when delivering audio and video samples from MediaStreamSource RRS feed

  • Question

  • Hello!

    I have implementation of MediaStreamSource which can deliver audio and video samples. When I use my implementation with MediaElement it produces wrong Position values which can be less than previous value of Position. In case when my MediaStreamSource  deliver only audio or video samples then Position values is right(i.e. next Position values is greater than previous). Also I have tested logic when every delivered audio or video sample have greated or equal TimeStamp then previous sample(for example audioSample_TS_0 <= videoSample_TS_0 <= videoSample_TS_1 <= audioSample_TS_1) and in this case Position is wrong. Maybe it is a bug inside MediaStreamSource ?

    Wednesday, April 9, 2014 9:52 AM

All replies

  • We haven't seen this reported.   Can you provide a repro?

    Bret Bentzinger (MSFT) @awehellyeah

    Thursday, April 10, 2014 3:24 AM
  • I have created very simple sample of delivering random audio and video data via MediaStreamSource implementation. And this bug is reproduced here.

    Link to sample Download Sample

    Sample contains GeneratorMediaSource class which implements MediaStreamSource and generates samples. At top of file with GeneratorMediaSource class I have added two macros to enable/disable audio/video generation. To reproduce a bug audio and video generation must be enabled. Also in file MainPage.xaml.cs at 53 line you can set a breakpoint to see the difference between previous and current MediaElement Position. And also on MainPage I have added TextBlock to display current time and when audio and video is enabled you can see how values of seconds is oscillating.
    Wednesday, April 16, 2014 12:18 PM
  • The HlsView.WP8 app from Windows Phone Streaming Media behaves the same.  Interestingly, the WP7 version (HlsView) behaves itself when run on WP7, but it also shows the time jumping about when run on WP8.

    Since it also deals with propagating status information from the guts of MediaElement to the app, this could possibly be related:  MediaElement's "Buffering" state: WP7 vs WP8

    Wednesday, April 16, 2014 10:07 PM
  • Out of curiosity, I just tried running the same WP7 app on a Lumia 920 with the WP8.1 Dev Preview.  The position on WP8.1 jumps about just like on WP8.

    I haven't tried using WP8.1's WinRT MediaStreamSource (which I am guessing should be simple enough to port from the Win8.1 version).

    Wednesday, April 16, 2014 10:15 PM
  • I think this bug connected with MediaStreamDescription.StreamID property. It have no setter and it always equals to 0.
    Thursday, April 24, 2014 4:16 PM