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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 */
19#ifndef DELAY_JITTER_ESTIMATION_H
20#define DELAY_JITTER_ESTIMATION_H
21
22#include "ns3/nstime.h"
23#include "ns3/packet.h"
24
25namespace ns3
26{
27
28/**
29 * \ingroup stats
30 *
31 * \brief Quick and dirty delay and jitter estimation,
32 * implementing the jitter algorithm originally from
33 * \RFC{1889} (RTP), and unchanged in \RFC{3550}
34 *
35 * This implementation uses the integer variant of the algorithm
36 * given in RFC 1889 Appendix A.8 ,p. 71, and repeated in
37 * RFC 3550 Appendix A.8, p. 94.
38 */
40{
41 public:
43
44 /**
45 * This method should be invoked once on each packet to
46 * record within the packet the tx time which is used upon
47 * packet reception to calculate the delay and jitter. The
48 * tx time is stored in the packet as an ns3::Tag which means
49 * that it does not use any network resources and is not
50 * taken into account in transmission delay calculations.
51 *
52 * \param packet the packet to send over a wire
53 */
54 static void PrepareTx(Ptr<const Packet> packet);
55
56 /**
57 * Invoke this method to update the delay and jitter calculations
58 * After a call to this method, \ref GetLastDelay and \ref GetLastJitter
59 * will return an updated delay and jitter.
60 *
61 * \param packet the packet received
62 */
63 void RecordRx(Ptr<const Packet> packet);
64
65 /**
66 * Get the Last Delay object.
67 *
68 * \return the updated delay.
69 */
70 Time GetLastDelay() const;
71
72 /**
73 * The jitter is calculated using the \RFC{1889} (RTP) jitter
74 * definition.
75 *
76 * \return the updated jitter.
77 */
78 uint64_t GetLastJitter() const;
79
80 private:
81 Time m_jitter{0}; //!< Jitter estimation
82 Time m_transit{0}; //!< Relative transit time for the previous packet
83};
84
85} // namespace ns3
86
87#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.
Time m_jitter
Jitter estimation.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Every class exported by the ns3 library is enclosed in the ns3 namespace.