How to tell what type of sample is requested by MediaStreamSource.SampleRequested? RRS feed

  • Question

  • MediaStreamSource.SampleRequested handler gets MediaStreamSourceSampleRequestedEventArgs which has s StreamDescriptor.

    The StreamDescriptor has property Name, but it does not seem to work.  When the MediaStreamSource is created, both VideoStreamDescriptor and AudioStreamDescriptor have their Name property set, but Name is null in the SampleRequested handler.


    Friday, April 24, 2015 12:29 PM

All replies

  • Do we really need the name for the StreamDescriptor?

    VideoStreamDescriptor and AudioStreamDescriptor have name because they may have different sources.

    Monday, April 27, 2015 9:40 AM
  • How would you differentiate these two streams when dealing with a media stream with both audio and video streams?

    After posting the question, I found checking the type of object MediaStreamSourceSampleRequestedEventArgs.Request.StreamDescriptor seems to work.  


    Monday, April 27, 2015 12:03 PM
  • I think check the object type (e.g. if (args.Request.StreamDescriptor is VideoStreamDescriptor)...) is a hack. This will not work if there are more than one streams of the same type (e.g. audio).  I would still like to know the official way of doing this. I am also curious about the usage of the Name property.


    Tuesday, April 28, 2015 1:08 PM