From bf40a8504078ce9c20a840f3d883f38b60fd261f Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 23 Jan 2019 13:29:23 +0100 Subject: [PATCH] rtp: move parameter intialization to rtp_init() --- lib/nodes/rtp.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/nodes/rtp.c b/lib/nodes/rtp.c index 9399ecac9..4374af802 100644 --- a/lib/nodes/rtp.c +++ b/lib/nodes/rtp.c @@ -96,6 +96,21 @@ static int rtp_aimd(struct node *n, double loss_frac) return 0; } +int rtp_init(struct node *n) +{ + struct rtp *r = (struct rtp *) n->_vd; + + /* Default values */ + r->rate = 1; + + r->aimd.a = 10; + r->aimd.b = 0.5; + r->aimd.last_rate = 1; + + + return 0; +} + int rtp_reverse(struct node *n) { struct rtp *r = (struct rtp *) n->_vd; @@ -124,11 +139,6 @@ int rtp_parse(struct node *n, json_t *cfg) json_error_t err; json_t *json_rtcp = NULL, *json_aimd = NULL; - /* 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?: f, s?: o, s?: o, s: { s: s }, s: { s: s } }", "format", &format, "rate", &r->rate, @@ -568,6 +578,7 @@ static struct plugin p = { .size = sizeof(struct rtp), .type.start = rtp_type_start, .type.stop = rtp_type_stop, + .init = rtp_init, .reverse = rtp_reverse, .parse = rtp_parse, .print = rtp_print,