A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
delay-jitter-estimation.cc
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
20
#include "
delay-jitter-estimation.h
"
21
22
#include "ns3/simulator.h"
23
#include "ns3/string.h"
24
#include "ns3/timestamp-tag.h"
25
26
namespace
ns3
27
{
28
29
DelayJitterEstimation::DelayJitterEstimation
()
30
{
31
}
32
33
void
34
DelayJitterEstimation::PrepareTx
(
Ptr<const Packet>
packet)
35
{
36
TimestampTag
tag(
Simulator::Now
());
37
packet->
AddByteTag
(tag);
38
}
39
40
void
41
DelayJitterEstimation::RecordRx
(
Ptr<const Packet>
packet)
42
{
43
TimestampTag
tag;
44
45
if
(!packet->
FindFirstMatchingByteTag
(tag))
46
{
47
return
;
48
}
49
50
// Variable names from
51
// RFC 1889 Appendix A.8 ,p. 71,
52
// RFC 3550 Appendix A.8, p. 94
53
Time
r_ts = tag.
GetTimestamp
();
54
Time
arrival =
Simulator::Now
();
55
Time
transit = arrival - r_ts;
56
Time
delta
= transit -
m_transit
;
57
m_transit
= transit;
58
59
// floating jitter version
60
// m_jitter += (Abs (delta) - m_jitter) / 16;
61
62
// int variant
63
m_jitter
+=
Abs
(
delta
) - ((
m_jitter
+ TimeStep(8)) / 16);
64
}
65
66
Time
67
DelayJitterEstimation::GetLastDelay
()
const
68
{
69
return
m_transit
;
70
}
71
72
uint64_t
73
DelayJitterEstimation::GetLastJitter
()
const
74
{
75
// floating jitter version
76
// return m_jitter.GetTimeStep();
77
78
// int variant
79
return
(
m_jitter
/ 16).GetTimeStep();
80
}
81
82
}
// namespace ns3
ns3::DelayJitterEstimation::GetLastDelay
Time GetLastDelay() const
Get the Last Delay object.
Definition:
delay-jitter-estimation.cc:67
ns3::DelayJitterEstimation::RecordRx
void RecordRx(Ptr< const Packet > packet)
Invoke this method to update the delay and jitter calculations After a call to this method,...
Definition:
delay-jitter-estimation.cc:41
ns3::DelayJitterEstimation::DelayJitterEstimation
DelayJitterEstimation()
Definition:
delay-jitter-estimation.cc:29
ns3::DelayJitterEstimation::GetLastJitter
uint64_t GetLastJitter() const
The jitter is calculated using the RFC 1889 (RTP) jitter definition.
Definition:
delay-jitter-estimation.cc:73
ns3::DelayJitterEstimation::PrepareTx
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...
Definition:
delay-jitter-estimation.cc:34
ns3::DelayJitterEstimation::m_transit
Time m_transit
Relative transit time for the previous packet.
Definition:
delay-jitter-estimation.h:82
ns3::DelayJitterEstimation::m_jitter
Time m_jitter
Jitter estimation.
Definition:
delay-jitter-estimation.h:81
ns3::Packet::FindFirstMatchingByteTag
bool FindFirstMatchingByteTag(Tag &tag) const
Finds the first tag matching the parameter Tag type.
Definition:
packet.cc:943
ns3::Packet::AddByteTag
void AddByteTag(const Tag &tag) const
Tag each byte included in this packet with a new byte tag.
Definition:
packet.cc:915
ns3::Ptr< const Packet >
ns3::Simulator::Now
static Time Now()
Return the current simulation virtual time.
Definition:
simulator.cc:208
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
ns3::TimestampTag
Timestamp tag for associating a timestamp with a packet.
Definition:
timestamp-tag.h:39
ns3::TimestampTag::GetTimestamp
Time GetTimestamp() const
Get the Timestamp object.
Definition:
timestamp-tag.cc:79
delay-jitter-estimation.h
ns3::Abs
int64x64_t Abs(const int64x64_t &value)
Absolute value.
Definition:
int64x64.h:215
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
two-ray-to-three-gpp-ch-calibration.delta
delta
Definition:
two-ray-to-three-gpp-ch-calibration.py:521
src
network
helper
delay-jitter-estimation.cc
Generated on Sun Mar 3 2024 17:11:05 for ns-3 by
1.9.1