pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39216?usp=email )
Change subject: mgw: Cleanup rtp_endp fields in its own function ......................................................................
mgw: Cleanup rtp_endp fields in its own function
Change-Id: I0b2ccb94129dc7aed6fe13bb20f9910a53d8a41e --- 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, 11 insertions(+), 6 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve daniel: Looks good to me, approved Jenkins Builder: Verified
diff --git a/include/osmocom/mgcp/mgcp_rtp_end.h b/include/osmocom/mgcp/mgcp_rtp_end.h index 69208e5..c08f00d 100644 --- a/include/osmocom/mgcp/mgcp_rtp_end.h +++ b/include/osmocom/mgcp/mgcp_rtp_end.h @@ -46,5 +46,6 @@ };
void mgcp_rtp_end_init(struct mgcp_rtp_end *end); +void mgcp_rtp_end_cleanup(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 68b6b39..088d3e3 100644 --- a/src/libosmo-mgcp/mgcp_conn.c +++ b/src/libosmo-mgcp/mgcp_conn.c @@ -113,10 +113,6 @@ 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_codecset_reset(&conn_rtp->end.cset); - return 0; }
@@ -127,9 +123,8 @@ conn_osmux_disable(conn_rtp); if (mgcp_conn_rtp_is_iuup(conn_rtp)) mgcp_conn_iuup_cleanup(conn_rtp); - mgcp_rtp_end_free_port(&conn_rtp->end); + mgcp_rtp_end_cleanup(&conn_rtp->end); rate_ctr_group_free(conn_rtp->ctrg); - mgcp_codecset_reset(&conn_rtp->end.cset); }
void mgcp_conn_watchdog_cb(void *data) diff --git a/src/libosmo-mgcp/mgcp_rtp_end.c b/src/libosmo-mgcp/mgcp_rtp_end.c index 422c199..e48eaeb 100644 --- a/src/libosmo-mgcp/mgcp_rtp_end.c +++ b/src/libosmo-mgcp/mgcp_rtp_end.c @@ -47,6 +47,15 @@ end->packet_duration_ms = DEFAULT_RTP_AUDIO_PACKET_DURATION_MS; end->output_enabled = false; end->maximum_packet_time = -1; + + /* Make sure codec table is reset */ + mgcp_codecset_reset(&end->cset); +} + +void mgcp_rtp_end_cleanup(struct mgcp_rtp_end *end) +{ + mgcp_rtp_end_free_port(end); + mgcp_codecset_reset(&end->cset); }
bool mgcp_rtp_end_remote_addr_available(const struct mgcp_rtp_end *rtp_end)