DirectShow timestamps vs RTP



I've been working for some time on a set of DS filters that send and
receive an RTP stream (audio or video). Until now I was sending the
timing information from the MediaSamples along with the stream to
ensure timely playback and synchronization between 2 different
streams. Since the stream should be platform independent I am now
rewriting the filters so that only the RTP timestamp and RTCP sender
reports are used. I'm a bit unsure though on how the generate the
timestamps of the MediaSamples on the receiver side.

I'm pretty sure I've got the sending side right: for each new
MediaSample, increase the RTP timestamp with (TimeEnd - TimeStart)/
10^7 (to convert to 1sec units) multiplied with the clock rate (90khz
for video, sample rate for audio).

On the receiving side I would calculate TimeStart of the MediaSample
like this:
1. take the 64-bit NTP time (1sec units) from the last SR and convert
to 100ns units
2. calculate the difference between the last SR's timestamp and the
timestamp of the first RTP packet I received for this MediaSample, and
also convert it to 100ns units
3. add 1 and 2

And then I have to figure out something for TimeEnd as well :)

Am I getting this right? And if I would do this for an audio and video
stream independently they should be synchronized?

I have some doubts because when I compare the time stamps of for
example an audio and video stream in the same graph, they do not seem
to relate to each other. This makes me wonder how DS synchronizes.
.



Relevant Pages

  • Re: Burning a video to DVD from AIFF and MPEG-2 files
    ... I have never attempted to burn a video to DVD. ... video and audio are available for download as separate files. ... depending on whether I wanted an AC3 or MP2 audio stream. ... for the higher video bitrate when using an MP2 audio stream is because ...
    (alt.os.linux.suse)
  • Managing one video source with 2 audio sources....
    ... We have some issues that are keeping us from improving our video quality. ... The main issue is having audio streams for a given region of the country. ... The problem comes in where we've got to manage each audio stream separately, ... keeping our separate audio streams which is important to our customers. ...
    (microsoft.public.windowsmedia.sdk)
  • Re: video playback speed too fast
    ... If I play the video stream only the playback speed appears to be correct! ... Under proposed solutions and tests doing just the audio stream all of the solutions failed. ... I tried unchecking all the converters and with the default set both with same 'fast' playback. ...
    (microsoft.public.windows.vista.music_pictures_video)
  • Re: How to implement a DS source/splitter filter that accept live video
    ... video and audio are in separate stream. ... I still don't understand what this source filter ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: (OT?): Could DTV become the new Radio
    ... If you got the bit stream down to around a half a megabit ... The video could be minimal, ... audio of an associated radio station. ... could transmit *only* the audio stream. ...
    (rec.radio.shortwave)