How to get WaveFormatEx from RTP packet or SDP RRS feed

  • Question

  • I am trying to play a live audio stream, i want know if is it possible to get WaveFormatEx information from RTP packet or SDP? and how to get sample duration of each frame?

    Thank you

    Monday, April 11, 2011 9:20 AM

All replies

  • The a= line in the SDP should give you the information you need to fill in a WaveFormatEx structure.  The fields to look for in the a= line will vary depending upon the format.  The sample duration will generally come from parsing the RTP payload and getting duration information (if available) from the payload format.
    Friday, May 6, 2011 11:30 PM
  • Thanks Matt for the answer,

    and how to get the duration for a live video frame without duration information embedded in RTP payload header? how to calculate the duration?

    Monday, May 16, 2011 9:12 AM
  • Usually the frame duration comes from the frame rate in the media type information if there is no explicit duration for the frame.  Without either of those, it is anyone's guess what the frame duration should be -- though the standard 1/30th of a second is always a good guess.

    Wednesday, June 22, 2011 10:42 PM
  • Hi Matt,
      When i test, i found the fps should  be 15, I used MFFrameRateToAverageTimePerFrame(15, 1, out duration) function to get the duration and assigned the value for each frames, and also set MF_MT_FRAME_RATE to 15pfs for PresentationDescriptor of my custom media source, but when the client to display the video through the custom media source, the client request sample from media stream very fast, it's more than 15fps, so the server always don't have enough buffer, and client is alway waiting for the new frames from source(this client is working well with non-customized media source), i thought it's the media source settings issues, do you have any suggest that which Attributes i have to check?

    Thursday, June 23, 2011 2:17 AM
  • What timestamp are you assigning your samples?  Timestamps are more important than durations, as they are the de-facto standard of when samples will be presented.  You can also see very fast sample requests if the samples are not in the right format the decoder -- the decoder will immediately drop the sample and a new one will be requested from the source.

    Friday, July 29, 2011 12:24 AM