[FFmpeg-devel] [PATCH] Extracting NTP timestamp from RTCP

Michael Niedermayer michaelni at gmx.at
Sat Nov 9 11:45:58 CET 2013


On Fri, Nov 08, 2013 at 02:14:38PM -0700, Fred Rothganger wrote:
> On 11/08/2013 01:21 AM, Michael Niedermayer wrote:
> >why is first_rtcp_ntp_time split in low and high 32bit halfs ?
> 
> It was split in my original code for proper conditioning.

>  doc/APIchanges         |    3 +++
>  libavformat/avformat.h |    2 +-
>  libavformat/rtsp.c     |    9 +++++++++
>  libavformat/version.h  |    2 +-
>  4 files changed, 14 insertions(+), 2 deletions(-)
> e6e26ffdc263452fadf3f2c6e6ffa038e6ac7ecb  rtsp.patch
> diff --git a/doc/APIchanges b/doc/APIchanges
> index dfdc159..be3d90a 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -15,6 +15,9 @@ libavutil:     2012-10-22
>  
>  API changes, most recent first:
>  
> +2013-11-07 - xxxxxxx - lavf 55.21.101 - avformat.h
> +  Set AVFormatContext.start_time_realtime when decoding.
> +
>  2013-11-xx - xxxxxxx - lavc 55.41.100 / 55.25.0 - avcodec.h
>                         lavu 52.51.100 - frame.h
>    Add ITU-R BT.2020 and other not yet included values to color primaries,
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 6bd54ce..1c4929d 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1127,7 +1127,7 @@ typedef struct AVFormatContext {
>       * since the unix epoch (00:00 1st January 1970). That is, pts=0
>       * in the stream was captured at this real world time.
>       * - encoding: Set by user.
> -     * - decoding: Unused.
> +     * - decoding: Set by libavformt.
>       */
>      int64_t start_time_realtime;
>  
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 3b88fc7..c9f4784 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -2051,6 +2051,15 @@ redo:
>                   * as this one. */
>                  int i;
>                  AVStream *st = NULL;
> +                if (s->start_time_realtime == 0) {
> +                    s->start_time_realtime = av_rescale (rtpctx->first_rtcp_ntp_time - (NTP_OFFSET << 32), 1000000, 1LL << 32);
> +                    if (rtpctx->st) {
> +                        s->start_time_realtime -=
> +                            av_rescale (rtpctx->rtcp_ts_offset,
> +                                        (uint64_t) rtpctx->st->time_base.num * 1000000,
> +                                                   rtpctx->st->time_base.den);
> +                    }
> +                }

theres a comment in the code above the added code that seems to
belong to the code below

also, how do i test this ? it seems the field is just 0 when reading
a random rtsp stream

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131109/c7fbce94/attachment.asc>


More information about the ffmpeg-devel mailing list