Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
PRRT
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
26
Issues
26
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LARN
PRRT
Commits
5fb9a18d
Commit
5fb9a18d
authored
Oct 18, 2017
by
rna
Committed by
Andreas Schmidt
Oct 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Target delay is set upon socket creation.
parent
33d2a19e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
18 additions
and
36 deletions
+18
-36
prrt/cprrt.pxd
prrt/cprrt.pxd
+1
-1
prrt/proto/applicationConstraints.c
prrt/proto/applicationConstraints.c
+2
-10
prrt/proto/applicationConstraints.h
prrt/proto/applicationConstraints.h
+1
-2
prrt/proto/socket.c
prrt/proto/socket.c
+4
-8
prrt/proto/socket.h
prrt/proto/socket.h
+1
-1
prrt/prrt.pyx
prrt/prrt.pyx
+4
-8
prrt/receiver.c
prrt/receiver.c
+2
-2
prrt/sender.c
prrt/sender.c
+2
-2
tests/perf/__init__.py
tests/perf/__init__.py
+1
-2
No files found.
prrt/cprrt.pxd
View file @
5fb9a18d
...
...
@@ -114,7 +114,7 @@ cdef extern from "proto/socket.h":
ctypedef
prrtSocket
PrrtSocket
cdef
PrrtSocket
*
PrrtSocket_create
(
bint
isSender
)
cdef
PrrtSocket
*
PrrtSocket_create
(
bint
isSender
,
const
uint32_t
target_delay
)
bint
PrrtSocket_bind
(
PrrtSocket
*
sock_ptr
,
const_char
*
ipAddress
,
const
uint16_t
port
)
int
PrrtSocket_close
(
const
PrrtSocket
*
sock_ptr
)
int
PrrtSocket_connect
(
PrrtSocket
*
sock_ptr
,
const_char
*
host
,
const
uint16_t
port
)
...
...
prrt/proto/applicationConstraints.c
View file @
5fb9a18d
...
...
@@ -3,14 +3,14 @@
#include "../util/dbg.h"
#include "applicationConstraints.h"
PrrtApplicationConstraints
*
PrrtApplicationConstraints_create
()
PrrtApplicationConstraints
*
PrrtApplicationConstraints_create
(
prrtTimedelta_t
target_delay_us
)
{
PrrtApplicationConstraints
*
constraints
=
calloc
(
1
,
sizeof
(
PrrtApplicationConstraints
));
check_mem
(
constraints
);
pthread_mutex_init
(
&
constraints
->
lock
,
NULL
);
constraints
->
targetDelay_us
=
1000
*
1000
;
constraints
->
targetDelay_us
=
target_delay_us
;
constraints
->
queue_size
=
1000
;
return
constraints
;
...
...
@@ -35,14 +35,6 @@ prrtTimedelta_t PrrtApplicationConstraints_get_target_delay(PrrtApplicationConst
return
targetDelay
;
}
bool
PrrtApplicationConstraints_set_target_delay
(
PrrtApplicationConstraints
*
applicationConstraints
,
prrtTimedelta_t
targetDelay
)
{
pthread_mutex_lock
(
&
applicationConstraints
->
lock
);
applicationConstraints
->
targetDelay_us
=
targetDelay
;
pthread_mutex_unlock
(
&
applicationConstraints
->
lock
);
return
true
;
}
uint32_t
PrrtApplicationConstraints_get_app_queue_size
(
PrrtApplicationConstraints
*
applicationConstraints
)
{
pthread_mutex_lock
(
&
applicationConstraints
->
lock
);
...
...
prrt/proto/applicationConstraints.h
View file @
5fb9a18d
...
...
@@ -9,11 +9,10 @@ typedef struct applicationConstraints {
pthread_mutex_t
lock
;
}
PrrtApplicationConstraints
;
PrrtApplicationConstraints
*
PrrtApplicationConstraints_create
(
void
);
PrrtApplicationConstraints
*
PrrtApplicationConstraints_create
(
prrtTimedelta_t
target_delay_us
);
bool
PrrtApplicationConstraints_destroy
(
PrrtApplicationConstraints
*
applicationConstraints
);
prrtTimedelta_t
PrrtApplicationConstraints_get_target_delay
(
PrrtApplicationConstraints
*
applicationConstraints
);
bool
PrrtApplicationConstraints_set_target_delay
(
PrrtApplicationConstraints
*
applicationConstraints
,
prrtTimedelta_t
targetDelay
);
uint32_t
PrrtApplicationConstraints_get_app_queue_size
(
PrrtApplicationConstraints
*
applicationConstraints
);
bool
PrrtApplicationConstraints_set_app_queue_size
(
PrrtApplicationConstraints
*
applicationConstraints
,
uint32_t
size
);
...
...
prrt/proto/socket.c
View file @
5fb9a18d
...
...
@@ -17,7 +17,7 @@
#include "socket.h"
#include "receiver.h"
PrrtSocket
*
PrrtSocket_create
(
const
bool
is_sender
)
{
PrrtSocket
*
PrrtSocket_create
(
const
bool
is_sender
,
prrtTimedelta_t
target_delay_us
)
{
assert
(
sizeof
(
float
)
==
4
);
PrrtSocket
*
sock_ptr
=
(
PrrtSocket
*
)
calloc
(
1
,
sizeof
(
PrrtSocket
));
check_mem
(
sock_ptr
);
...
...
@@ -35,7 +35,8 @@ PrrtSocket *PrrtSocket_create(const bool is_sender) {
sock_ptr
->
sequenceNumberRedundancy
=
1
;
sock_ptr
->
csi
=
PrrtChannelStateInformation_create
();
sock_ptr
->
applicationConstraints
=
PrrtApplicationConstraints_create
();
check
(
target_delay_us
<
HALF_TIMESTAMP
,
"Specify target delay between 0 and %i"
,
HALF_TIMESTAMP
-
1
)
sock_ptr
->
applicationConstraints
=
PrrtApplicationConstraints_create
(
target_delay_us
);
sock_ptr
->
packetTimeoutTable
=
PrrtPacketTimeoutTable_create
();
...
...
@@ -365,12 +366,7 @@ uint32_t PrrtSocket_get_sock_opt(PrrtSocket *sock_ptr, const char *name) {
}
bool
PrrtSocket_set_sock_opt
(
PrrtSocket
*
sock_ptr
,
const
char
*
name
,
const
uint32_t
value
)
{
if
(
strcmp
(
name
,
"targetdelay"
)
==
0
)
{
if
(
value
>
HALF_TIMESTAMP
)
{
PERROR
(
"Invalid targetdelay. Too big."
)
}
PrrtApplicationConstraints_set_target_delay
(
sock_ptr
->
applicationConstraints
,
value
);
}
else
if
(
strcmp
(
name
,
"app_queue_size"
))
{
if
(
strcmp
(
name
,
"app_queue_size"
))
{
PrrtApplicationConstraints_set_app_queue_size
(
sock_ptr
->
applicationConstraints
,
value
);
Pipe_set_size
(
sock_ptr
->
sendDataQueue
,
value
);
}
else
{
...
...
prrt/proto/socket.h
View file @
5fb9a18d
...
...
@@ -68,7 +68,7 @@ typedef struct prrtSocket {
}
PrrtSocket
;
PrrtSocket
*
PrrtSocket_create
(
const
bool
is_sender
);
PrrtSocket
*
PrrtSocket_create
(
const
bool
is_sender
,
prrtTimedelta_t
target_delay_us
);
bool
PrrtSocket_bind
(
PrrtSocket
*
sock_ptr
,
const
char
*
ipAddress
,
const
uint16_t
port
);
...
...
prrt/prrt.pyx
View file @
5fb9a18d
...
...
@@ -73,8 +73,9 @@ cdef class PrrtSocket:
cdef
cprrt
.
PrrtSocket
*
_c_socket
cdef
bint
isSender
def
__cinit__
(
self
,
port
,
isSender
):
self
.
_c_socket
=
cprrt
.
PrrtSocket_create
(
isSender
)
def
__cinit__
(
self
,
port
,
isSender
,
target_delay
=
1
):
target_delay_us
=
target_delay
*
1000
**
2
self
.
_c_socket
=
cprrt
.
PrrtSocket_create
(
isSender
,
target_delay_us
)
cprrt
.
PrrtSocket_bind
(
self
.
_c_socket
,
"0.0.0.0"
,
port
)
self
.
isSender
=
isSender
...
...
@@ -89,12 +90,7 @@ cdef class PrrtSocket:
def
__get__
(
self
):
if
not
self
.
isSender
:
raise
Exception
(
"Not a sender."
)
return
cprrt
.
PrrtSocket_get_sock_opt
(
self
.
_c_socket
,
"targetdelay"
)
def
__set__
(
self
,
value
):
if
not
self
.
isSender
:
raise
Exception
(
"Not a sender."
)
cprrt
.
PrrtSocket_set_sock_opt
(
self
.
_c_socket
,
"targetdelay"
,
value
)
return
cprrt
.
PrrtSocket_get_sock_opt
(
self
.
_c_socket
,
"targetdelay"
)
*
0.000001
property
app_queue_size
:
def
__get__
(
self
):
...
...
prrt/receiver.c
View file @
5fb9a18d
...
...
@@ -37,9 +37,9 @@ int main(int argc, char *const argv[]) {
}
#endif
sock
=
PrrtSocket_create
(
false
);
check
(
PrrtSocket_bind
(
sock
,
"0.0.0.0"
,
port
),
"bind failed"
);
sock
=
PrrtSocket_create
(
false
,
HALF_TIMESTAMP
-
1
);
check
(
sock
!=
NULL
,
"Could not create socket."
);
check
(
PrrtSocket_bind
(
sock
,
"0.0.0.0"
,
port
),
"bind failed"
);
XlapTimestampTable
*
tstable_data
=
malloc
(
sizeof
(
XlapTimestampTable
));
XlapTimestampTable
*
tstable_redundancy
=
malloc
(
sizeof
(
XlapTimestampTable
));
...
...
prrt/sender.c
View file @
5fb9a18d
...
...
@@ -31,8 +31,8 @@ int main(int argc, char *const argv[]) {
uint16_t
local_port
=
6000
;
PrrtSocket
*
socket
=
PrrtSocket_create
(
true
);
PrrtSocket_set_sock_opt
(
socket
,
"targetdelay"
,
(
uint32_t
)
60
*
1000
*
1000
);
PrrtSocket
*
socket
=
PrrtSocket_create
(
true
,
60
*
1000
*
1000
);
check
(
socket
!=
NULL
,
"Socket create failed."
);
//PrrtSocket_set_coding_parameters(socket, 1, 1); // comment this line to re-enable coding.
check
(
PrrtSocket_bind
(
socket
,
"0.0.0.0"
,
local_port
),
"bind failed"
);
...
...
tests/perf/__init__.py
View file @
5fb9a18d
...
...
@@ -36,8 +36,7 @@ class ReceiverThread(threading.Thread):
class
SenderThread
(
threading
.
Thread
):
def
__init__
(
self
,
seqnoDigits
,
packetCount
):
threading
.
Thread
.
__init__
(
self
)
self
.
sock
=
prrt
.
PrrtSocket
(
7005
,
True
)
self
.
sock
.
target_delay
=
0.1
*
1000
**
2
self
.
sock
=
prrt
.
PrrtSocket
(
7005
,
True
,
0.1
)
self
.
packetCount
=
packetCount
self
.
seqnoDigits
=
seqnoDigits
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment