A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
delay-jitter-estimation.cc
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
9
#include "
delay-jitter-estimation.h
"
10
11
#include "ns3/simulator.h"
12
#include "ns3/string.h"
13
#include "ns3/timestamp-tag.h"
14
15
namespace
ns3
16
{
17
18
DelayJitterEstimation::DelayJitterEstimation
()
19
{
20
}
21
22
void
23
DelayJitterEstimation::PrepareTx
(
Ptr<const Packet>
packet)
24
{
25
TimestampTag
tag(
Simulator::Now
());
26
packet->AddByteTag(tag);
27
}
28
29
void
30
DelayJitterEstimation::RecordRx
(
Ptr<const Packet>
packet)
31
{
32
TimestampTag
tag;
33
34
if
(!packet->FindFirstMatchingByteTag(tag))
35
{
36
return
;
37
}
38
39
// Variable names from
40
// RFC 1889 Appendix A.8 ,p. 71,
41
// RFC 3550 Appendix A.8, p. 94
42
Time
r_ts = tag.
GetTimestamp
();
43
Time
arrival =
Simulator::Now
();
44
Time
transit = arrival - r_ts;
45
Time
delta = transit -
m_transit
;
46
m_transit
= transit;
47
48
// floating jitter version
49
// m_jitter += (Abs (delta) - m_jitter) / 16;
50
51
// int variant
52
m_jitter
+=
Abs
(delta) - ((
m_jitter
+ TimeStep(8)) / 16);
53
}
54
55
Time
56
DelayJitterEstimation::GetLastDelay
()
const
57
{
58
return
m_transit
;
59
}
60
61
uint64_t
62
DelayJitterEstimation::GetLastJitter
()
const
63
{
64
// floating jitter version
65
// return m_jitter.GetTimeStep();
66
67
// int variant
68
return
(
m_jitter
/ 16).GetTimeStep();
69
}
70
71
}
// namespace ns3
ns3::DelayJitterEstimation::GetLastDelay
Time GetLastDelay() const
Get the Last Delay object.
Definition
delay-jitter-estimation.cc:56
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:30
ns3::DelayJitterEstimation::DelayJitterEstimation
DelayJitterEstimation()
Definition
delay-jitter-estimation.cc:18
ns3::DelayJitterEstimation::GetLastJitter
uint64_t GetLastJitter() const
The jitter is calculated using the RFC 1889 (RTP) jitter definition.
Definition
delay-jitter-estimation.cc:62
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:23
ns3::DelayJitterEstimation::m_transit
Time m_transit
Relative transit time for the previous packet.
Definition
delay-jitter-estimation.h:71
ns3::DelayJitterEstimation::m_jitter
Time m_jitter
Jitter estimation.
Definition
delay-jitter-estimation.h:70
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::Simulator::Now
static Time Now()
Return the current simulation virtual time.
Definition
simulator.cc:197
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::TimestampTag
Timestamp tag for associating a timestamp with a packet.
Definition
timestamp-tag.h:28
ns3::TimestampTag::GetTimestamp
Time GetTimestamp() const
Get the Timestamp object.
Definition
timestamp-tag.cc:68
delay-jitter-estimation.h
ns3::Abs
int64x64_t Abs(const int64x64_t &value)
Absolute value.
Definition
int64x64.h:203
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
network
helper
delay-jitter-estimation.cc
Generated on Sat Nov 9 2024 09:20:44 for ns-3 by
1.11.0