pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/26686 )
Change subject: Define mgcp_rtp_end.output_enabled as bool ......................................................................
Define mgcp_rtp_end.output_enabled as bool
Change-Id: I55f7796ef774f86050041f2c5e3a2f8f7d1f56df --- M include/osmocom/mgcp/mgcp_network.h M src/libosmo-mgcp/mgcp_conn.c M src/libosmo-mgcp/mgcp_msg.c M tests/mgcp/mgcp_test.c 4 files changed, 6 insertions(+), 7 deletions(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved
diff --git a/include/osmocom/mgcp/mgcp_network.h b/include/osmocom/mgcp/mgcp_network.h index b9cf5e3..e3fa3b1 100644 --- a/include/osmocom/mgcp/mgcp_network.h +++ b/include/osmocom/mgcp/mgcp_network.h @@ -110,8 +110,8 @@ uint32_t packet_duration_ms; int maximum_packet_time; /* -1: not set */ char *fmtp_extra; - /* are we transmitting packets (1) or dropping (0) outbound packets */ - int output_enabled; + /* are we transmitting packets (true) or dropping (false) outbound packets */ + bool output_enabled; /* FIXME: This parameter can be set + printed, but is nowhere used! */ int force_output_ptime;
diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c index 5c3c60e..9c2fb0f 100644 --- a/src/libosmo-mgcp/mgcp_conn.c +++ b/src/libosmo-mgcp/mgcp_conn.c @@ -108,7 +108,7 @@ /* Set default values */ end->frames_per_packet = 0; /* unknown */ end->packet_duration_ms = DEFAULT_RTP_AUDIO_PACKET_DURATION_MS; - end->output_enabled = 0; + end->output_enabled = false; end->maximum_packet_time = -1;
conn_rtp->rate_ctr_group = rate_ctr_group_alloc(conn, &rate_ctr_group_desc, rate_ctr_index++); diff --git a/src/libosmo-mgcp/mgcp_msg.c b/src/libosmo-mgcp/mgcp_msg.c index f36fa71..4581b76 100644 --- a/src/libosmo-mgcp/mgcp_msg.c +++ b/src/libosmo-mgcp/mgcp_msg.c @@ -110,8 +110,7 @@
/* Special handling for RTP connections */ if (conn->type == MGCP_CONN_TYPE_RTP) { - conn->u.rtp.end.output_enabled = - conn->mode & MGCP_CONN_SEND_ONLY ? 1 : 0; + conn->u.rtp.end.output_enabled = !!(conn->mode & MGCP_CONN_SEND_ONLY); }
LOGPENDP(endp, DLMGCP, LOGL_DEBUG, "conn:%s\n", mgcp_conn_dump(conn)); @@ -121,7 +120,7 @@
/* Special handling für RTP connections */ if (conn->type == MGCP_CONN_TYPE_RTP) { - LOGPCONN(conn, DLMGCP, LOGL_DEBUG, "output_enabled %d\n", + LOGPCONN(conn, DLMGCP, LOGL_DEBUG, "output_enabled %u\n", conn->u.rtp.end.output_enabled); }
diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c index a8aad14..9b4933c 100644 --- a/tests/mgcp/mgcp_test.c +++ b/tests/mgcp/mgcp_test.c @@ -868,7 +868,7 @@ printf("Connection mode not set\n");
OSMO_ASSERT(conn->end.output_enabled - == (conn->conn->mode & MGCP_CONN_SEND_ONLY ? 1 : 0)); + == !!(conn->conn->mode & MGCP_CONN_SEND_ONLY));
conn->conn->mode |= CONN_UNMODIFIED;