osmux: Use new osmux APIs to let libosmo-netif alloc struct osmux_out_handle

This way we don't need to worry about implementation details (struct
size) in the future in case they change (they will).

Related: OS#5987
Requires: libosmo-netif.git Change-Id Ie8df581f375c9a183a7af60b431561bda82f6e34
Change-Id: I2d0d8c152b8f1234ddfcd74d6cb04b1818b41510
This commit is contained in:
Pau Espin 2022-08-31 17:46:11 +02:00 committed by pespin
parent 709aad28ed
commit 33639166a2
3 changed files with 13 additions and 13 deletions

View File

@ -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_*

View File

@ -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;

View File

@ -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;