A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
delay-jitter-estimation.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8#ifndef DELAY_JITTER_ESTIMATION_H
9#define DELAY_JITTER_ESTIMATION_H
10
11#include "ns3/nstime.h"
12#include "ns3/packet.h"
13
14namespace ns3
15{
16
17/**
18 * \ingroup stats
19 *
20 * \brief Quick and dirty delay and jitter estimation,
21 * implementing the jitter algorithm originally from
22 * \RFC{1889} (RTP), and unchanged in \RFC{3550}
23 *
24 * This implementation uses the integer variant of the algorithm
25 * given in RFC 1889 Appendix A.8 ,p. 71, and repeated in
26 * RFC 3550 Appendix A.8, p. 94.
27 */
29{
30 public:
32
33 /**
34 * This method should be invoked once on each packet to
35 * record within the packet the tx time which is used upon
36 * packet reception to calculate the delay and jitter. The
37 * tx time is stored in the packet as an ns3::Tag which means
38 * that it does not use any network resources and is not
39 * taken into account in transmission delay calculations.
40 *
41 * \param packet the packet to send over a wire
42 */
43 static void PrepareTx(Ptr<const Packet> packet);
44
45 /**
46 * Invoke this method to update the delay and jitter calculations
47 * After a call to this method, \ref GetLastDelay and \ref GetLastJitter
48 * will return an updated delay and jitter.
49 *
50 * \param packet the packet received
51 */
52 void RecordRx(Ptr<const Packet> packet);
53
54 /**
55 * Get the Last Delay object.
56 *
57 * \return the updated delay.
58 */
59 Time GetLastDelay() const;
60
61 /**
62 * The jitter is calculated using the \RFC{1889} (RTP) jitter
63 * definition.
64 *
65 * \return the updated jitter.
66 */
67 uint64_t GetLastJitter() const;
68
69 private:
70 Time m_jitter{0}; //!< Jitter estimation
71 Time m_transit{0}; //!< Relative transit time for the previous packet
72};
73
74} // namespace ns3
75
76#endif /* DELAY_JITTER_ESTIMATION_H */
Quick and dirty delay and jitter estimation, implementing the jitter algorithm originally from RFC 18...
Time GetLastDelay() const
Get the Last Delay object.
void RecordRx(Ptr< const Packet > packet)
Invoke this method to update the delay and jitter calculations After a call to this method,...
uint64_t GetLastJitter() const
The jitter is calculated using the RFC 1889 (RTP) jitter definition.
static void PrepareTx(Ptr< const Packet > packet)
This method should be invoked once on each packet to record within the packet the tx time which is us...
Time m_transit
Relative transit time for the previous packet.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Every class exported by the ns3 library is enclosed in the ns3 namespace.