diff --git a/TODO-RELEASE b/TODO-RELEASE index 746808e53..e8029f947 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -24,4 +24,4 @@ # If any interfaces have been removed or changed since the last public release, a=0. # #library what description / commit summary line -libosmo-netif >1.2.0 OSMUX_DEFAULT_PORT +libosmo-netif >1.2.0 OSMUX_DEFAULT_PORT, osmux_xfrm_output_alloc, osmux_xfrm_output_set_rtp_* diff --git a/include/osmocom/mgcp/mgcp_conn.h b/include/osmocom/mgcp/mgcp_conn.h index 7338027ec..a08c0897d 100644 --- a/include/osmocom/mgcp/mgcp_conn.h +++ b/include/osmocom/mgcp/mgcp_conn.h @@ -84,10 +84,10 @@ struct mgcp_conn_rtp { bool cid_allocated; /* Allocated Osmux circuit ID for this conn */ uint8_t cid; - /* handle to batch messages */ + /* handle to batch messages, shared (refcounted) among several conns */ struct osmux_in_handle *in; - /* handle to unbatch messages */ - struct osmux_out_handle out; + /* handle to unbatch messages, one allocated and owned per conn */ + struct osmux_out_handle *out; /* statistics */ struct { uint32_t chunks; diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index abc3f0eb4..5ce850da7 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -403,7 +403,7 @@ static int osmux_read_fd_cb(struct osmo_fd *ofd, unsigned int what) if (endp_osmux_state_check(conn_src->conn->endp, conn_src, false) == 0) { conn_src->osmux.stats.octets += osmux_chunk_length(msg, rem); conn_src->osmux.stats.chunks++; - osmux_xfrm_output_sched(&conn_src->osmux.out, osmuxh); + osmux_xfrm_output_sched(conn_src->osmux.out, osmuxh); } rem = msg->len; } @@ -494,12 +494,12 @@ int osmux_enable_conn(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn, return -1; } - osmux_xfrm_output_init2(&conn->osmux.out, - (conn->osmux.cid * rtp_ssrc_winlen) + - (random() % rtp_ssrc_winlen), - conn->end.codec->payload_type); - - osmux_xfrm_output_set_tx_cb(&conn->osmux.out, + conn->osmux.out = osmux_xfrm_output_alloc(osmux); + osmux_xfrm_output_set_rtp_ssrc(conn->osmux.out, + (conn->osmux.cid * rtp_ssrc_winlen) + + (random() % rtp_ssrc_winlen)); + osmux_xfrm_output_set_rtp_pl_type(conn->osmux.out, conn->end.codec->payload_type); + osmux_xfrm_output_set_tx_cb(conn->osmux.out, scheduled_from_osmux_tx_rtp_cb, conn); conn->osmux.state = OSMUX_STATE_ENABLED; @@ -519,8 +519,8 @@ void conn_osmux_disable(struct mgcp_conn_rtp *conn) if (conn->osmux.state == OSMUX_STATE_ENABLED) { /* We are closing, we don't need pending RTP packets to be transmitted */ - osmux_xfrm_output_set_tx_cb(&conn->osmux.out, NULL, NULL); - osmux_xfrm_output_flush(&conn->osmux.out); + osmux_xfrm_output_set_tx_cb(conn->osmux.out, NULL, NULL); + TALLOC_FREE(conn->osmux.out); osmux_xfrm_input_close_circuit(conn->osmux.in, conn->osmux.cid); conn->osmux.state = OSMUX_STATE_DISABLED;