1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

rtp: added initial implementation for AIMD

This commit is contained in:
Steffen Vogel 2019-01-21 13:10:55 +01:00
parent 07c6826e1d
commit 3b0cca73e3
3 changed files with 38 additions and 4 deletions

View file

@ -2,6 +2,8 @@ nodes = {
rtp_node = {
type = "rtp"
rate = 10000,
rtcp = {
enabled = true,
@ -9,6 +11,11 @@ nodes = {
throttle_mode = "decimate"
}
aimd = {
a = 10,
b = 0.5
}
in = {
address = "0.0.0.0:12000",
signals = {

View file

@ -77,7 +77,10 @@ struct rtp {
} rtcp;
struct {
double a;
double b;
double last_rate;
} aimd; /** AIMD state */
struct queue_signalled recv_queue;

View file

@ -68,11 +68,17 @@ static int rtp_set_rate(struct node *n, double rate)
static int rtp_aimd(struct node *n, double loss_frac)
{
struct rtp *r = (struct rtp *) n->_vd;
int ret;
double rate;
/** @todo: Implement AIMD */
rate = 1;
if (loss_frac < 1e-3)
rate = r->aimd.last_rate + r->aimd.a;
else
rate = r->aimd.last_rate * r->aimd.b;
r->aimd.last_rate = rate;
ret = rtp_set_rate(n, rate);
if (ret)
@ -107,12 +113,18 @@ int rtp_parse(struct node *n, json_t *cfg)
uint16_t port;
json_error_t err;
json_t *json_rtcp = NULL;
json_t *json_rtcp = NULL, *json_aimd = NULL;
ret = json_unpack_ex(cfg, &err, 0, "{ s?: s, s?: o, s: { s: s }, s: { s: s } }",
/* Default values */
r->aimd.a = 10;
r->aimd.b = 0.5;
r->aimd.last_rate = 1;
ret = json_unpack_ex(cfg, &err, 0, "{ s?: s, s?: o, s?: o, s: { s: s }, s: { s: s } }",
"format", &format,
"rate", &r->rate,
"rtcp", &json_rtcp,
"aimd", &json_aimd,
"out",
"address", &remote,
"in",
@ -121,6 +133,16 @@ int rtp_parse(struct node *n, json_t *cfg)
if (ret)
jerror(&err, "Failed to parse configuration of node %s", node_name(n));
/* AIMD */
if (json_aimd) {
ret = json_unpack_ex(json_rtcp, &err, 0, "{ s?: f, s?: f }",
"a", &r->aimd.a,
"b", &r->aimd.b
);
if (ret)
jerror(&err, "Failed to parse configuration of node %s", node_name(n));
}
/* RTCP */
if (json_rtcp) {
const char *mode = "aimd";
@ -131,6 +153,8 @@ int rtp_parse(struct node *n, json_t *cfg)
"mode", &mode,
"throttle_mode", &throttle_mode
);
if (ret)
jerror(&err, "Failed to parse configuration of node %s", node_name(n));
/* RTCP Mode */
if (!strcmp(mode, "aimd"))