Browse Source

TT#178400 support reporting out measured jitter

Change-Id: I798ec9b05f48f3e12630aa71e16a6bf5746f5319
pull/1525/head
Richard Fuchs 4 years ago
parent
commit
778ec46b81
12 changed files with 224 additions and 38 deletions
  1. +4
    -0
      daemon/call.c
  2. +1
    -0
      daemon/main.c
  3. +4
    -1
      daemon/media_socket.c
  4. +0
    -1
      daemon/rtcp.c
  5. +5
    -0
      daemon/rtpengine.pod
  6. +27
    -0
      daemon/ssrc.c
  7. +2
    -1
      daemon/statistics.c
  8. +1
    -0
      include/counter_stats_fields.inc
  9. +1
    -0
      include/gauge_stats_fields.inc
  10. +1
    -0
      include/main.h
  11. +3
    -0
      include/ssrc.h
  12. +175
    -35
      t/test-stats.c

+ 4
- 0
daemon/call.c View File

@ -242,6 +242,10 @@ next:
for (it = c->medias.head; it; it = it->next) {
struct call_media *media = it->data;
if (rtpe_config.measure_rtp) {
media_update_stats(media);
ssrc_collect_metrics(media);
}
if (MEDIA_ISSET(media, TRANSCODE))
hlp->transcoded_media++;
}


+ 1
- 0
daemon/main.c View File

@ -573,6 +573,7 @@ static void options(int *argc, char ***argv) {
{ "mqtt-publish-scope",0,0,G_OPTION_ARG_STRING, &mqtt_publish_scope, "Scope for published mosquitto messages","global|call|media"},
#endif
{ "mos",0,0, G_OPTION_ARG_STRING, &mos, "Type of MOS calculation","CQ|LQ"},
{ "measure-rtp",0,0, G_OPTION_ARG_NONE, &rtpe_config.measure_rtp,"Enable measuring RTP statistics and VoIP metrics",NULL},
#ifdef SO_INCOMING_CPU
{ "socket-cpu-affinity",0,0,G_OPTION_ARG_INT, &rtpe_config.cpu_affinity,"CPU affinity for media sockets","INT"},
#endif


+ 4
- 1
daemon/media_socket.c View File

@ -1224,7 +1224,8 @@ static const char *kernelize_one(struct rtpengine_target_info *reti, GQueue *out
reti->stun = media->ice_agent ? 1 : 0;
reti->non_forwarding = non_forwarding ? 1 : 0;
reti->blackhole = blackhole ? 1 : 0;
reti->rtp_stats = (MEDIA_ISSET(media, RTCP_GEN) || (mqtt_publish_scope() != MPS_NONE)) ? 1 : 0;
reti->rtp_stats = (rtpe_config.measure_rtp
|| MEDIA_ISSET(media, RTCP_GEN) || (mqtt_publish_scope() != MPS_NONE)) ? 1 : 0;
handler->in->kernel(&reti->decrypt, stream);
if (!reti->decrypt.cipher || !reti->decrypt.hmac)
@ -1477,6 +1478,8 @@ static void __stream_update_stats(struct packet_stream *ps, int have_in_lock) {
atomic64_set(&ssrc_ctx->last_ts, stats_info.ssrc_stats[u].timestamp);
parent->jitter = stats_info.ssrc_stats[u].jitter;
RTPE_STATS_ADD(packets_lost, stats_info.ssrc_stats[u].total_lost);
uint32_t ssrc_map_out = ssrc_ctx->ssrc_map_out;
// update opposite outgoing SSRC


+ 0
- 1
daemon/rtcp.c View File

@ -1544,7 +1544,6 @@ void rtcp_receiver_reports(GQueue *out, struct ssrc_hash *hash, struct call_mono
rwlock_lock_r(&hash->lock);
for (GList *l = hash->q.head; l; l = l->next) {
struct ssrc_entry_call *e = l->data;
//ilog(LOG_DEBUG, "xxxxx %x %i %i %p %p %p", e->h.ssrc, (int) atomic64_get(&e->input_ctx.packets), (int) atomic64_get(&e->output_ctx.packets), ml, e->input_ctx.ref, e->output_ctx.ref);
struct ssrc_ctx *i = &e->input_ctx;
if (i->ref != ml)
continue;


+ 5
- 0
daemon/rtpengine.pod View File

@ -1033,6 +1033,11 @@ RTT into account and therefore requires peers to correctly send RTCP. If set to
B<LQ> (listening quality) RTT is ignored, allowing a MOS to be calculated in
the absence of RTCP.
=item B<--measure-rtp>
Enable measuring RTP metrics even for plain RTP passthrough scenarios. Without
that option, RTP metrics are measured only in transcoding scenarios.
=item B<--socket-cpu-affinity=>I<INT>
Enables setting the socket CPU affinity via the B<SO_INCOMING_CPU> socket


+ 27
- 0
daemon/ssrc.c View File

@ -599,3 +599,30 @@ void payload_tracker_add(struct payload_tracker *t, int pt) {
out:
mutex_unlock(&t->lock);
}
// call master lock held in R
void ssrc_collect_metrics(struct call_media *media) {
if (!media->streams.head)
return;
struct packet_stream *ps = media->streams.head->data;
for (int i = 0; i < RTPE_NUM_SSRC_TRACKING; i++) {
struct ssrc_ctx *s = ps->ssrc_in[i];
if (!s)
break; // end of list
struct ssrc_entry_call *e = s->parent;
// exclude zero values - technically possible but unlikely and probably just unset
if (!e->jitter)
continue;
if (e->input_ctx.tracker.most_len > 0 && e->input_ctx.tracker.most[0] != 255) {
const struct rtp_payload_type *rpt = rtp_payload_type(e->input_ctx.tracker.most[0],
&ps->media->codecs);
if (rpt && rpt->clock_rate)
e->jitter = e->jitter * 1000 / rpt->clock_rate;
}
RTPE_GAUGE_SET(jitter_measured, e->jitter);
}
}

+ 2
- 1
daemon/statistics.c View File

@ -553,10 +553,11 @@ GQueue *statistics_gather_metrics(void) {
HEADER("voip_metrics", "VoIP metrics:");
HEADER("{", "");
STAT_GET_PRINT(jitter, "jitter", 1.0);
STAT_GET_PRINT(jitter, "jitter (reported)", 1.0);
STAT_GET_PRINT(rtt_e2e, "end-to-end round-trip time", 1.0);
STAT_GET_PRINT(rtt_dsct, "discrete round-trip time", 1.0);
STAT_GET_PRINT(packetloss, "packet loss", 1.0);
STAT_GET_PRINT(jitter_measured, "jitter (measured)", 1.0);
HEADER(NULL, "");
HEADER("}", "");


+ 1
- 0
include/counter_stats_fields.inc View File

@ -19,3 +19,4 @@ F(oneway_stream_sess)
F(call_duration)
F(call_duration2)
F(total_calls_duration_intv)
F(packets_lost)

+ 1
- 0
include/gauge_stats_fields.inc View File

@ -13,3 +13,4 @@ F(jitter)
F(rtt_e2e)
F(rtt_dsct)
F(packetloss)
F(jitter_measured)

+ 1
- 0
include/main.h View File

@ -156,6 +156,7 @@ struct rtpengine_config {
MOS_CQ = 0,
MOS_LQ,
} mos;
int measure_rtp;
int cpu_affinity;
char *janus_secret;
};


+ 3
- 0
include/ssrc.h View File

@ -227,6 +227,9 @@ void ssrc_voip_metrics(struct call_media *m, const struct ssrc_xr_voip_metrics *
const struct timeval *);
void ssrc_collect_metrics(struct call_media *);
void payload_tracker_init(struct payload_tracker *t);
void payload_tracker_add(struct payload_tracker *, int);


+ 175
- 35
t/test-stats.c View File

@ -904,23 +904,23 @@ int main(void) {
"voip_metrics\n"
"\n"
"{\n"
"Sum of all jitter values sampled\n"
"Sum of all jitter (reported) values sampled\n"
"jitter_total\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter square values sampled\n"
"Sum of all jitter (reported) square values sampled\n"
"jitter2_total\n"
"0.000000\n"
"0.000000\n"
"Total number of jitter samples\n"
"Total number of jitter (reported) samples\n"
"jitter_samples_total\n"
"0\n"
"0\n"
"Average jitter\n"
"Average jitter (reported)\n"
"jitter_average\n"
"0.000000\n"
"0.000000\n"
"jitter standard deviation\n"
"jitter (reported) standard deviation\n"
"jitter_stddev\n"
"0.000000\n"
"0.000000\n"
@ -984,6 +984,26 @@ int main(void) {
"packetloss_stddev\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter (measured) values sampled\n"
"jitter_measured_total\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter (measured) square values sampled\n"
"jitter_measured2_total\n"
"0.000000\n"
"0.000000\n"
"Total number of jitter (measured) samples\n"
"jitter_measured_samples_total\n"
"0\n"
"0\n"
"Average jitter (measured)\n"
"jitter_measured_average\n"
"0.000000\n"
"0.000000\n"
"jitter (measured) standard deviation\n"
"jitter_measured_stddev\n"
"0.000000\n"
"0.000000\n"
"\n"
"\n"
"}\n"
@ -1892,23 +1912,23 @@ int main(void) {
"voip_metrics\n"
"\n"
"{\n"
"Sum of all jitter values sampled\n"
"Sum of all jitter (reported) values sampled\n"
"jitter_total\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter square values sampled\n"
"Sum of all jitter (reported) square values sampled\n"
"jitter2_total\n"
"0.000000\n"
"0.000000\n"
"Total number of jitter samples\n"
"Total number of jitter (reported) samples\n"
"jitter_samples_total\n"
"0\n"
"0\n"
"Average jitter\n"
"Average jitter (reported)\n"
"jitter_average\n"
"0.000000\n"
"0.000000\n"
"jitter standard deviation\n"
"jitter (reported) standard deviation\n"
"jitter_stddev\n"
"0.000000\n"
"0.000000\n"
@ -1972,6 +1992,26 @@ int main(void) {
"packetloss_stddev\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter (measured) values sampled\n"
"jitter_measured_total\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter (measured) square values sampled\n"
"jitter_measured2_total\n"
"0.000000\n"
"0.000000\n"
"Total number of jitter (measured) samples\n"
"jitter_measured_samples_total\n"
"0\n"
"0\n"
"Average jitter (measured)\n"
"jitter_measured_average\n"
"0.000000\n"
"0.000000\n"
"jitter (measured) standard deviation\n"
"jitter_measured_stddev\n"
"0.000000\n"
"0.000000\n"
"\n"
"\n"
"}\n"
@ -2877,23 +2917,23 @@ int main(void) {
"voip_metrics\n"
"\n"
"{\n"
"Sum of all jitter values sampled\n"
"Sum of all jitter (reported) values sampled\n"
"jitter_total\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter square values sampled\n"
"Sum of all jitter (reported) square values sampled\n"
"jitter2_total\n"
"0.000000\n"
"0.000000\n"
"Total number of jitter samples\n"
"Total number of jitter (reported) samples\n"
"jitter_samples_total\n"
"0\n"
"0\n"
"Average jitter\n"
"Average jitter (reported)\n"
"jitter_average\n"
"0.000000\n"
"0.000000\n"
"jitter standard deviation\n"
"jitter (reported) standard deviation\n"
"jitter_stddev\n"
"0.000000\n"
"0.000000\n"
@ -2957,6 +2997,26 @@ int main(void) {
"packetloss_stddev\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter (measured) values sampled\n"
"jitter_measured_total\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter (measured) square values sampled\n"
"jitter_measured2_total\n"
"0.000000\n"
"0.000000\n"
"Total number of jitter (measured) samples\n"
"jitter_measured_samples_total\n"
"0\n"
"0\n"
"Average jitter (measured)\n"
"jitter_measured_average\n"
"0.000000\n"
"0.000000\n"
"jitter (measured) standard deviation\n"
"jitter_measured_stddev\n"
"0.000000\n"
"0.000000\n"
"\n"
"\n"
"}\n"
@ -3875,23 +3935,23 @@ int main(void) {
"voip_metrics\n"
"\n"
"{\n"
"Sum of all jitter values sampled\n"
"Sum of all jitter (reported) values sampled\n"
"jitter_total\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter square values sampled\n"
"Sum of all jitter (reported) square values sampled\n"
"jitter2_total\n"
"0.000000\n"
"0.000000\n"
"Total number of jitter samples\n"
"Total number of jitter (reported) samples\n"
"jitter_samples_total\n"
"0\n"
"0\n"
"Average jitter\n"
"Average jitter (reported)\n"
"jitter_average\n"
"0.000000\n"
"0.000000\n"
"jitter standard deviation\n"
"jitter (reported) standard deviation\n"
"jitter_stddev\n"
"0.000000\n"
"0.000000\n"
@ -3955,6 +4015,26 @@ int main(void) {
"packetloss_stddev\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter (measured) values sampled\n"
"jitter_measured_total\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter (measured) square values sampled\n"
"jitter_measured2_total\n"
"0.000000\n"
"0.000000\n"
"Total number of jitter (measured) samples\n"
"jitter_measured_samples_total\n"
"0\n"
"0\n"
"Average jitter (measured)\n"
"jitter_measured_average\n"
"0.000000\n"
"0.000000\n"
"jitter (measured) standard deviation\n"
"jitter_measured_stddev\n"
"0.000000\n"
"0.000000\n"
"\n"
"\n"
"}\n"
@ -4868,23 +4948,23 @@ int main(void) {
"voip_metrics\n"
"\n"
"{\n"
"Sum of all jitter values sampled\n"
"Sum of all jitter (reported) values sampled\n"
"jitter_total\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter square values sampled\n"
"Sum of all jitter (reported) square values sampled\n"
"jitter2_total\n"
"0.000000\n"
"0.000000\n"
"Total number of jitter samples\n"
"Total number of jitter (reported) samples\n"
"jitter_samples_total\n"
"0\n"
"0\n"
"Average jitter\n"
"Average jitter (reported)\n"
"jitter_average\n"
"0.000000\n"
"0.000000\n"
"jitter standard deviation\n"
"jitter (reported) standard deviation\n"
"jitter_stddev\n"
"0.000000\n"
"0.000000\n"
@ -4948,6 +5028,26 @@ int main(void) {
"packetloss_stddev\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter (measured) values sampled\n"
"jitter_measured_total\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter (measured) square values sampled\n"
"jitter_measured2_total\n"
"0.000000\n"
"0.000000\n"
"Total number of jitter (measured) samples\n"
"jitter_measured_samples_total\n"
"0\n"
"0\n"
"Average jitter (measured)\n"
"jitter_measured_average\n"
"0.000000\n"
"0.000000\n"
"jitter (measured) standard deviation\n"
"jitter_measured_stddev\n"
"0.000000\n"
"0.000000\n"
"\n"
"\n"
"}\n"
@ -5856,23 +5956,23 @@ int main(void) {
"voip_metrics\n"
"\n"
"{\n"
"Sum of all jitter values sampled\n"
"Sum of all jitter (reported) values sampled\n"
"jitter_total\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter square values sampled\n"
"Sum of all jitter (reported) square values sampled\n"
"jitter2_total\n"
"0.000000\n"
"0.000000\n"
"Total number of jitter samples\n"
"Total number of jitter (reported) samples\n"
"jitter_samples_total\n"
"0\n"
"0\n"
"Average jitter\n"
"Average jitter (reported)\n"
"jitter_average\n"
"0.000000\n"
"0.000000\n"
"jitter standard deviation\n"
"jitter (reported) standard deviation\n"
"jitter_stddev\n"
"0.000000\n"
"0.000000\n"
@ -5936,6 +6036,26 @@ int main(void) {
"packetloss_stddev\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter (measured) values sampled\n"
"jitter_measured_total\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter (measured) square values sampled\n"
"jitter_measured2_total\n"
"0.000000\n"
"0.000000\n"
"Total number of jitter (measured) samples\n"
"jitter_measured_samples_total\n"
"0\n"
"0\n"
"Average jitter (measured)\n"
"jitter_measured_average\n"
"0.000000\n"
"0.000000\n"
"jitter (measured) standard deviation\n"
"jitter_measured_stddev\n"
"0.000000\n"
"0.000000\n"
"\n"
"\n"
"}\n"
@ -6846,23 +6966,23 @@ int main(void) {
"voip_metrics\n"
"\n"
"{\n"
"Sum of all jitter values sampled\n"
"Sum of all jitter (reported) values sampled\n"
"jitter_total\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter square values sampled\n"
"Sum of all jitter (reported) square values sampled\n"
"jitter2_total\n"
"0.000000\n"
"0.000000\n"
"Total number of jitter samples\n"
"Total number of jitter (reported) samples\n"
"jitter_samples_total\n"
"0\n"
"0\n"
"Average jitter\n"
"Average jitter (reported)\n"
"jitter_average\n"
"0.000000\n"
"0.000000\n"
"jitter standard deviation\n"
"jitter (reported) standard deviation\n"
"jitter_stddev\n"
"0.000000\n"
"0.000000\n"
@ -6926,6 +7046,26 @@ int main(void) {
"packetloss_stddev\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter (measured) values sampled\n"
"jitter_measured_total\n"
"0.000000\n"
"0.000000\n"
"Sum of all jitter (measured) square values sampled\n"
"jitter_measured2_total\n"
"0.000000\n"
"0.000000\n"
"Total number of jitter (measured) samples\n"
"jitter_measured_samples_total\n"
"0\n"
"0\n"
"Average jitter (measured)\n"
"jitter_measured_average\n"
"0.000000\n"
"0.000000\n"
"jitter (measured) standard deviation\n"
"jitter_measured_stddev\n"
"0.000000\n"
"0.000000\n"
"\n"
"\n"
"}\n"


Loading…
Cancel
Save