[FFmpeg-devel] [PATCH] Sync the NTP timestamps for RTP streams
Michael Niedermayer
michaelni
Mon Mar 15 10:43:00 CET 2010
On Mon, Mar 15, 2010 at 11:27:59AM +0200, Martin Storsj? wrote:
> On Thu, 11 Mar 2010, Martin Storsj? wrote:
>
> > On Thu, 11 Mar 2010, Michael Niedermayer wrote:
> >
> > > On Thu, Mar 11, 2010 at 11:51:08AM +0200, Martin Storsj? wrote:
> > > >
> > > > diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > > > index 10371a4..7c74951 100644
> > > > --- a/libavformat/avformat.h
> > > > +++ b/libavformat/avformat.h
> > > > @@ -526,6 +526,14 @@ typedef struct AVStream {
> > > > * Number of frames that have been demuxed during av_find_stream_info()
> > > > */
> > > > int codec_info_nb_frames;
> > > > +
> > > > + /**
> > > > + * Start time of the stream in real world time, in microseconds
> > > > + * since the unix epoch.
> > > > + * - encoding: Set by user.
> > > > + * - decoding: Unused.
> > > > + */
> > > > + int64_t start_time_realtime;
> > >
> > > this is not completely clear, we have
> > > time of transmission of first packet
> > > time of decoding of first packet
> > > time of presentation of first packet
> > > time corresponding to timestamp=0 instead of first packet
> > >
> > > and i think you should write out what the unix epoch is
> >
> > Ok, I'll clarify it. In this case, it is the real-world time corresponding
> > to timestamp = 0 in the stream, that is, when the data was captured.
> >
> > > that said, i didnt follow the thread very much, could you explain in a few
> > > lines why this is needed?
> >
> > Syncing of multiple RTP streams is done through sender reports, where the
> > sender says that timestamp X in the RTP stream corresponds to real-world
> > time Y.
> >
> > When sending multiple RTP streams, currently the timestamp=0 <-> realworld
> > time mapping is made when the RTP muxer is opened, which makes the
> > timestamp=0 map to different realworld times in the muxers, since the RTP
> > muxers can't be opened at the exact same time. (In practice, one can get a
> > 5-30 ms difference between them, when doing RTSP commands inbetween.)
> >
> > So when writing multiple RTP streams, we need to make sure timestamp=0
> > maps to the exact same realworld time, so that the receiver can sync the
> > streams back together.
> >
> > In the RTP scenarios, the actual value of the NTP timestamps doesn't
> > matter all that much, only the difference between them is used for syncing
> > the streams together.
>
> Updated patch attached, clarified the details of this field.
>
> Also, I realized that there's no need to keep it separate for each
> AVStream, so moved it to AVFormatContext instead.
>
> Is this ok to be added?
>
> // Martin
> avformat.h | 9 +++++++++
> 1 file changed, 9 insertions(+)
> 8532797ce5adc0f97261d7e970b9d0904f29b1bc start_time_realtime.patch
> commit 68520d720168df043013d48a8f6d578b9cea1aac
> Author: Martin Storsjo <martin at martin.st>
> Date: Thu Mar 11 11:11:43 2010 +0200
>
> Add a field to AVFormatContext for specifying a real world start time for the stream
looks ok, dont forget minor ver bump and apichanges update though
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100315/68be8898/attachment.pgp>
More information about the ffmpeg-devel
mailing list