pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-mgw/+/39214?usp=email )
Change subject: mgw: Introduce mgcp_rtp_end_init()
......................................................................
mgw: Introduce mgcp_rtp_end_init()
Change-Id: I29f57dfde60e3134f1db422dc63e7c58d3db7d54
---
M include/osmocom/mgcp/mgcp_rtp_end.h
M src/libosmo-mgcp/mgcp_conn.c
M src/libosmo-mgcp/mgcp_rtp_end.c
3 files changed, 18 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/14/39214/1
diff --git a/include/osmocom/mgcp/mgcp_rtp_end.h b/include/osmocom/mgcp/mgcp_rtp_end.h
index 9c3bb4d..2ab300a 100644
--- a/include/osmocom/mgcp/mgcp_rtp_end.h
+++ b/include/osmocom/mgcp/mgcp_rtp_end.h
@@ -52,5 +52,6 @@
char local_addr[INET6_ADDRSTRLEN];
};
+void mgcp_rtp_end_init(struct mgcp_rtp_end *end);
bool mgcp_rtp_end_remote_addr_available(const struct mgcp_rtp_end *rtp_end);
void mgcp_rtp_end_free_port(struct mgcp_rtp_end *end);
diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c
index e7ff30b..8682e4b 100644
--- a/src/libosmo-mgcp/mgcp_conn.c
+++ b/src/libosmo-mgcp/mgcp_conn.c
@@ -88,7 +88,6 @@
/* Initialize rtp connection struct with default values */
static int 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. */
@@ -106,17 +105,6 @@
/* backpointer to the generic part of the connection */
conn->u.rtp.conn = conn;
- end->rtp = NULL;
- end->rtcp = NULL;
- memset(&end->addr, 0, sizeof(end->addr));
- end->rtcp_port = 0;
-
- /* Set default values */
- end->frames_per_packet = 0; /* unknown */
- end->packet_duration_ms = DEFAULT_RTP_AUDIO_PACKET_DURATION_MS;
- end->output_enabled = false;
- end->maximum_packet_time = -1;
-
conn_rtp->ctrg = rate_ctr_group_alloc(conn, &rate_ctr_group_desc,
rate_ctr_index++);
if (!conn_rtp->ctrg)
return -1;
@@ -124,6 +112,8 @@
conn_rtp->state.in_stream.err_ts_ctr = rate_ctr_group_get_ctr(conn_rtp->ctrg,
IN_STREAM_ERR_TSTMP_CTR);
conn_rtp->state.out_stream.err_ts_ctr = rate_ctr_group_get_ctr(conn_rtp->ctrg,
OUT_STREAM_ERR_TSTMP_CTR);
+ mgcp_rtp_end_init(&conn_rtp->end);
+
/* Make sure codec table is reset */
mgcp_codec_reset_all(conn_rtp);
diff --git a/src/libosmo-mgcp/mgcp_rtp_end.c b/src/libosmo-mgcp/mgcp_rtp_end.c
index ddc1533..422c199 100644
--- a/src/libosmo-mgcp/mgcp_rtp_end.c
+++ b/src/libosmo-mgcp/mgcp_rtp_end.c
@@ -29,11 +29,26 @@
#include <osmocom/core/socket.h>
#include <osmocom/core/osmo_io.h>
#include <osmocom/mgcp/mgcp_rtp_end.h>
+#include <osmocom/mgcp/mgcp_codec.h>
/***********************
* mgcp_rtp_end
**********************/
+void mgcp_rtp_end_init(struct mgcp_rtp_end *end)
+{
+ end->rtp = NULL;
+ end->rtcp = NULL;
+ memset(&end->addr, 0, sizeof(end->addr));
+ end->rtcp_port = 0;
+
+ /* Set default values */
+ end->frames_per_packet = 0; /* unknown */
+ end->packet_duration_ms = DEFAULT_RTP_AUDIO_PACKET_DURATION_MS;
+ end->output_enabled = false;
+ end->maximum_packet_time = -1;
+}
+
bool mgcp_rtp_end_remote_addr_available(const struct mgcp_rtp_end *rtp_end)
{
return (osmo_sockaddr_port(&rtp_end->addr.u.sa) != 0) &&
--
To view, visit
https://gerrit.osmocom.org/c/osmo-mgw/+/39214?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I29f57dfde60e3134f1db422dc63e7c58d3db7d54
Gerrit-Change-Number: 39214
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>