DirectShow timestamps vs RTP
- From: tim.slechten@xxxxxxxxx
- Date: Thu, 18 Sep 2008 06:50:37 -0700 (PDT)
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.
.
- Follow-Ups:
- Re: DirectShow timestamps vs RTP
- From: Tim
- Re: DirectShow timestamps vs RTP
- From: Alessandro Angeli
- Re: DirectShow timestamps vs RTP
- From: Geraint Davies
- Re: DirectShow timestamps vs RTP
- Prev by Date: Re: Creating Overlay menu infront of a video window
- Next by Date: Re: mpeg2 demux output pin buffer size
- Previous by thread: VMR9 Run() Halt - Presentation Times?
- Next by thread: Re: DirectShow timestamps vs RTP
- Index(es):
Relevant Pages
|