mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
rtp: small fix in debug output, lower bound of 1 for decimate hook ratio
This commit is contained in:
parent
7a12800306
commit
8da43f7070
2 changed files with 27 additions and 5 deletions
|
@ -58,6 +58,7 @@ static struct plugin p;
|
|||
static int rtp_set_rate(struct node *n, double rate)
|
||||
{
|
||||
struct rtp *r = (struct rtp *) n->_vd;
|
||||
int ratio;
|
||||
|
||||
switch (r->rtcp.throttle_mode) {
|
||||
case RTCP_THROTTLE_HOOK_LIMIT_RATE:
|
||||
|
@ -65,7 +66,10 @@ static int rtp_set_rate(struct node *n, double rate)
|
|||
break;
|
||||
|
||||
case RTCP_THROTTLE_HOOK_DECIMATE:
|
||||
decimate_set_ratio(r->rtcp.throttle_hook, r->rate / rate);
|
||||
ratio = r->rate / rate;
|
||||
if (ratio == 0)
|
||||
ratio = 1;
|
||||
decimate_set_ratio(r->rtcp.throttle_hook, ratio);
|
||||
break;
|
||||
|
||||
case RTCP_THROTTLE_DISABLED:
|
||||
|
@ -87,6 +91,9 @@ static int rtp_aimd(struct node *n, double loss_frac)
|
|||
int ret;
|
||||
double rate;
|
||||
|
||||
if (!r->rtcp.enabled)
|
||||
return -1;
|
||||
|
||||
if (loss_frac < 1e-3)
|
||||
rate = r->aimd.last_rate + r->aimd.a;
|
||||
else
|
||||
|
@ -98,7 +105,8 @@ static int rtp_aimd(struct node *n, double loss_frac)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
fprintf(r->aimd.log, "%d\t%f\t%f\n", r->rtcp.num_rrs, loss_frac, rate);
|
||||
if (r->aimd.log)
|
||||
fprintf(r->aimd.log, "%d\t%f\t%f\n", r->rtcp.num_rrs, loss_frac, rate);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -113,6 +121,7 @@ int rtp_init(struct node *n)
|
|||
r->aimd.a = 10;
|
||||
r->aimd.b = 0.5;
|
||||
r->aimd.last_rate = 100;
|
||||
r->aimd.log = NULL;
|
||||
|
||||
r->rtcp.enabled = false;
|
||||
r->rtcp.throttle_mode = RTCP_THROTTLE_DISABLED;
|
||||
|
|
|
@ -45,6 +45,9 @@ NUM_SAMPLES=100
|
|||
|
||||
cat > ${CONFIG_FILE_SRC} << EOF
|
||||
{
|
||||
"logging" : {
|
||||
"level" : "debug"
|
||||
},
|
||||
"nodes" : {
|
||||
"rtp_node" : {
|
||||
"type" : "rtp",
|
||||
|
@ -77,6 +80,9 @@ EOF
|
|||
|
||||
cat > ${CONFIG_FILE_DEST} << EOF
|
||||
{
|
||||
"logging" : {
|
||||
"level" : "debug"
|
||||
},
|
||||
"nodes" : {
|
||||
"rtp_node" : {
|
||||
"type" : "rtp",
|
||||
|
@ -107,11 +113,16 @@ cat > ${CONFIG_FILE_DEST} << EOF
|
|||
}
|
||||
EOF
|
||||
|
||||
villas-signal mixed -v 5 -l ${NUM_SAMPLES} -n > ${INPUT_FILE}
|
||||
|
||||
VILLAS_LOG_PREFIX="[DEST] " \
|
||||
villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE_DEST} rtp_node > ${OUTPUT_FILE} &
|
||||
PID=$!
|
||||
|
||||
villas-pipe ${CONFIG_FILE_SRC} rtp_node < ${INPUT_FILE}
|
||||
sleep 1
|
||||
|
||||
VILLAS_LOG_PREFIX="[SIGN] " \
|
||||
villas-signal mixed -v 5 -r ${RATE} -l ${NUM_SAMPLES} | tee ${INPUT_FILE} | \
|
||||
VILLAS_LOG_PREFIX="[SRC] " \
|
||||
villas-pipe ${CONFIG_FILE_SRC} rtp_node > ${OUTPUT_FILE}
|
||||
|
||||
# Compare data
|
||||
villas-test-cmp ${CMPFLAGS} ${INPUT_FILE} ${OUTPUT_FILE}
|
||||
|
@ -119,4 +130,6 @@ RC=$?
|
|||
|
||||
rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE}
|
||||
|
||||
kill $PID
|
||||
|
||||
exit $RC
|
||||
|
|
Loading…
Add table
Reference in a new issue