Revert "stats: use libosmocore rate counter for in/out_stream.err_ts_counter"
This reverts commit 7181cc1f02
.
The tests are broken on i686, arm (non 64bit systems).
Change-Id: I15f3c78f8410d709733ed5692ba94ba17559d7e1
This commit is contained in:
parent
7181cc1f02
commit
8d064dfd24
|
@ -28,7 +28,6 @@
|
|||
#include <osmocom/mgcp/mgcp.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include <osmocom/core/counter.h>
|
||||
#include <osmocom/core/rate_ctr.h>
|
||||
|
||||
#define CI_UNUSED 0
|
||||
|
||||
|
@ -46,7 +45,7 @@ struct mgcp_rtp_stream_state {
|
|||
uint32_t ssrc;
|
||||
uint16_t last_seq;
|
||||
uint32_t last_timestamp;
|
||||
struct rate_ctr *err_ts_ctr;
|
||||
uint32_t err_ts_counter;
|
||||
int32_t last_tsdelta;
|
||||
uint32_t last_arrival_time;
|
||||
};
|
||||
|
@ -203,8 +202,6 @@ struct mgcp_conn_rtp {
|
|||
uint32_t octets;
|
||||
} stats;
|
||||
} osmux;
|
||||
|
||||
struct rate_ctr_group *rate_ctr_group;
|
||||
};
|
||||
|
||||
/*! Connection type, specifies which member of the union "u" in mgcp_conn
|
||||
|
|
|
@ -26,28 +26,8 @@
|
|||
#include <osmocom/mgcp/mgcp_common.h>
|
||||
#include <osmocom/mgcp/mgcp_endp.h>
|
||||
#include <osmocom/gsm/gsm_utils.h>
|
||||
#include <osmocom/core/rate_ctr.h>
|
||||
#include <ctype.h>
|
||||
|
||||
const static struct rate_ctr_desc rate_ctr_desc[] = {
|
||||
{
|
||||
.name = "in_stream_err_ts_ctr",
|
||||
.description = "inbound rtp-stream timestamp errors",
|
||||
},{
|
||||
.name = "out_stream_err_ts_ctr",
|
||||
.description = "outbound rtp-stream timestamp errors",
|
||||
}
|
||||
};
|
||||
|
||||
const static struct rate_ctr_group_desc rate_ctr_group_desc = {
|
||||
.group_name_prefix = "conn_rtp",
|
||||
.group_description = "rtp connection statistics",
|
||||
.class_id = 1,
|
||||
.num_ctr = 2,
|
||||
.ctr_desc = rate_ctr_desc
|
||||
};
|
||||
|
||||
|
||||
/* Allocate a new connection identifier. According to RFC3435, they must
|
||||
* be unique only within the scope of the endpoint. (Caller must provide
|
||||
* memory for id) */
|
||||
|
@ -107,10 +87,6 @@ static void mgcp_rtp_codec_init(struct mgcp_rtp_codec *codec)
|
|||
static void mgcp_rtp_conn_init(struct mgcp_conn_rtp *conn_rtp, struct mgcp_conn *conn)
|
||||
{
|
||||
struct mgcp_rtp_end *end = &conn_rtp->end;
|
||||
/* FIXME: Each new rate counter group requires an unique index. At the
|
||||
* moment we generate this index using this counter, but perhaps there
|
||||
* is a more concious way to assign the indexes. */
|
||||
static unsigned int rate_ctr_index = 0;
|
||||
|
||||
conn_rtp->type = MGCP_RTP_DEFAULT;
|
||||
conn_rtp->osmux.allocated_cid = -1;
|
||||
|
@ -132,15 +108,6 @@ static void mgcp_rtp_conn_init(struct mgcp_conn_rtp *conn_rtp, struct mgcp_conn
|
|||
|
||||
mgcp_rtp_codec_init(&end->codec);
|
||||
mgcp_rtp_codec_init(&end->alt_codec);
|
||||
|
||||
conn_rtp->rate_ctr_group =
|
||||
rate_ctr_group_alloc(conn, &rate_ctr_group_desc,
|
||||
rate_ctr_index);
|
||||
conn_rtp->state.in_stream.err_ts_ctr =
|
||||
&conn_rtp->rate_ctr_group->ctr[0];
|
||||
conn_rtp->state.out_stream.err_ts_ctr =
|
||||
&conn_rtp->rate_ctr_group->ctr[1];
|
||||
rate_ctr_index++;
|
||||
}
|
||||
|
||||
/* Cleanup rtp connection struct */
|
||||
|
@ -149,7 +116,6 @@ static void mgcp_rtp_conn_cleanup(struct mgcp_conn_rtp *conn_rtp)
|
|||
osmux_disable_conn(conn_rtp);
|
||||
osmux_release_cid(conn_rtp);
|
||||
mgcp_free_rtp_port(&conn_rtp->end);
|
||||
rate_ctr_group_free(conn_rtp->rate_ctr_group);
|
||||
}
|
||||
|
||||
/*! allocate a new connection list entry.
|
||||
|
|
|
@ -222,7 +222,7 @@ static int check_rtp_timestamp(struct mgcp_endpoint *endp,
|
|||
|
||||
if (seq == sstate->last_seq) {
|
||||
if (timestamp != sstate->last_timestamp) {
|
||||
rate_ctr_inc(sstate->err_ts_ctr);
|
||||
sstate->err_ts_counter += 1;
|
||||
LOGP(DRTP, LOGL_ERROR,
|
||||
"The %s timestamp delta is != 0 but the sequence "
|
||||
"number %d is the same, "
|
||||
|
@ -272,7 +272,7 @@ static int check_rtp_timestamp(struct mgcp_endpoint *endp,
|
|||
ts_alignment_error(sstate, state->packet_duration, timestamp);
|
||||
|
||||
if (timestamp_error) {
|
||||
rate_ctr_inc(sstate->err_ts_ctr);
|
||||
sstate->err_ts_counter += 1;
|
||||
LOGP(DRTP, LOGL_NOTICE,
|
||||
"The %s timestamp has an alignment error of %d "
|
||||
"on 0x%x SSRC: %u "
|
||||
|
@ -505,16 +505,13 @@ void mgcp_patch_and_count(struct mgcp_endpoint *endp,
|
|||
mgcp_rtp_annex_count(endp, state, seq, transit, ssrc);
|
||||
|
||||
if (!state->initialized) {
|
||||
/* FIXME: Move this initialization to mgcp.conn.c */
|
||||
state->initialized = 1;
|
||||
state->in_stream.last_seq = seq - 1;
|
||||
state->in_stream.ssrc = state->patch.orig_ssrc = ssrc;
|
||||
state->in_stream.last_tsdelta = 0;
|
||||
state->packet_duration =
|
||||
mgcp_rtp_packet_duration(endp, rtp_end);
|
||||
state->out_stream.last_seq = seq - 1;
|
||||
state->out_stream.ssrc = state->patch.orig_ssrc = ssrc;
|
||||
state->out_stream.last_tsdelta = 0;
|
||||
state->out_stream = state->in_stream;
|
||||
state->out_stream.last_timestamp = timestamp;
|
||||
state->out_stream.ssrc = ssrc - 1; /* force output SSRC change */
|
||||
LOGP(DRTP, LOGL_INFO,
|
||||
|
|
|
@ -87,9 +87,9 @@ static void mgcp_format_stats_rtp(char *str, size_t str_len,
|
|||
if (conn->conn->endp->cfg->osmux != OSMUX_USAGE_OFF) {
|
||||
/* Error Counter */
|
||||
nchars = snprintf(str, str_len,
|
||||
"\r\nX-Osmo-CP: EC TI=%lu, TO=%lu",
|
||||
conn->state.in_stream.err_ts_ctr->current,
|
||||
conn->state.out_stream.err_ts_ctr->current);
|
||||
"\r\nX-Osmo-CP: EC TI=%u, TO=%u",
|
||||
conn->state.in_stream.err_ts_counter,
|
||||
conn->state.out_stream.err_ts_counter);
|
||||
if (nchars < 0 || nchars >= str_len)
|
||||
goto truncate;
|
||||
|
||||
|
|
|
@ -160,16 +160,15 @@ static void dump_rtp_end(struct vty *vty, struct mgcp_rtp_state *state,
|
|||
struct mgcp_rtp_codec *codec = &end->codec;
|
||||
|
||||
vty_out(vty,
|
||||
" Timestamp Errs: %lu->%lu%s"
|
||||
" Timestamp Errs: %d->%d%s"
|
||||
" Dropped Packets: %d%s"
|
||||
" Payload Type: %d Rate: %u Channels: %d %s"
|
||||
" Frame Duration: %u Frame Denominator: %u%s"
|
||||
" FPP: %d Packet Duration: %u%s"
|
||||
" FMTP-Extra: %s Audio-Name: %s Sub-Type: %s%s"
|
||||
" Output-Enabled: %d Force-PTIME: %d%s",
|
||||
state->in_stream.err_ts_ctr->current,
|
||||
state->out_stream.err_ts_ctr->current,
|
||||
VTY_NEWLINE,
|
||||
state->in_stream.err_ts_counter,
|
||||
state->out_stream.err_ts_counter, VTY_NEWLINE,
|
||||
end->stats.dropped_packets, VTY_NEWLINE,
|
||||
codec->payload_type, codec->rate, codec->channels, VTY_NEWLINE,
|
||||
codec->frame_duration_num, codec->frame_duration_den,
|
||||
|
|
|
@ -1133,8 +1133,6 @@ static void test_packet_error_detection(int patch_ssrc, int patch_ts)
|
|||
int last_out_ts_err_cnt = 0;
|
||||
struct mgcp_conn_rtp *conn = NULL;
|
||||
struct mgcp_conn *_conn = NULL;
|
||||
struct rate_ctr test_ctr_in;
|
||||
struct rate_ctr test_ctr_out;
|
||||
|
||||
printf("Testing packet error detection%s%s.\n",
|
||||
patch_ssrc ? ", patch SSRC" : "",
|
||||
|
@ -1144,11 +1142,6 @@ static void test_packet_error_detection(int patch_ssrc, int patch_ts)
|
|||
memset(&endp, 0, sizeof(endp));
|
||||
memset(&state, 0, sizeof(state));
|
||||
|
||||
test_ctr_in.current = 0;
|
||||
test_ctr_out.current = 0;
|
||||
state.in_stream.err_ts_ctr = &test_ctr_in;
|
||||
state.out_stream.err_ts_ctr = &test_ctr_out;
|
||||
|
||||
endp.type = &ep_typeset.rtp;
|
||||
|
||||
trunk.vty_number_endpoints = 1;
|
||||
|
@ -1193,18 +1186,18 @@ static void test_packet_error_detection(int patch_ssrc, int patch_ts)
|
|||
state.in_stream.last_tsdelta, state.in_stream.last_seq);
|
||||
|
||||
printf("Out TS change: %d, dTS: %d, Seq change: %d, "
|
||||
"TS Err change: in +%lu, out +%lu\n",
|
||||
"TS Err change: in %+d, out %+d\n",
|
||||
state.out_stream.last_timestamp - last_timestamp,
|
||||
state.out_stream.last_tsdelta,
|
||||
state.out_stream.last_seq - last_seqno,
|
||||
state.in_stream.err_ts_ctr->current - last_in_ts_err_cnt,
|
||||
state.out_stream.err_ts_ctr->current - last_out_ts_err_cnt);
|
||||
state.in_stream.err_ts_counter - last_in_ts_err_cnt,
|
||||
state.out_stream.err_ts_counter - last_out_ts_err_cnt);
|
||||
|
||||
printf("Stats: Jitter = %u, Transit = %d\n",
|
||||
calc_jitter(&state), state.stats.transit);
|
||||
|
||||
last_in_ts_err_cnt = state.in_stream.err_ts_ctr->current;
|
||||
last_out_ts_err_cnt = state.out_stream.err_ts_ctr->current;
|
||||
last_in_ts_err_cnt = state.in_stream.err_ts_counter;
|
||||
last_out_ts_err_cnt = state.out_stream.err_ts_counter;
|
||||
last_timestamp = state.out_stream.last_timestamp;
|
||||
last_seqno = state.out_stream.last_seq;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue