laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/36357?usp=email )
(
1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: simplify unused transcoding/processing call-back ......................................................................
simplify unused transcoding/processing call-back
the processing call-back is working with a raw buffer + length, while we actually work with struct msgb. Let's simply pass the msgb into the call-back, and the call-back can then do what they want with the contents of that msgb.
Change-Id: I002624f9008726e3d754d48aa2282c38e3b42953 --- M include/osmocom/mgcp/mgcp.h M include/osmocom/mgcp/mgcp_network.h M src/libosmo-mgcp/mgcp_network.c 3 files changed, 20 insertions(+), 13 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve
diff --git a/include/osmocom/mgcp/mgcp.h b/include/osmocom/mgcp/mgcp.h index 42d67cf..bfb412b 100644 --- a/include/osmocom/mgcp/mgcp.h +++ b/include/osmocom/mgcp/mgcp.h @@ -70,12 +70,10 @@ /** * Return: * < 0 in case no audio was processed - * >= 0 in case audio was processed. The remaining payload - * length will be returned. + * >= 0 in case audio was processed. */ typedef int (*mgcp_processing)(struct mgcp_endpoint *endp, - struct mgcp_rtp_end *dst_end, - char *data, int *len, int buf_size); + struct mgcp_rtp_end *dst_end, struct msgb *msg);
struct mgcp_conn_rtp;
diff --git a/include/osmocom/mgcp/mgcp_network.h b/include/osmocom/mgcp/mgcp_network.h index a7bd333..1ec8979 100644 --- a/include/osmocom/mgcp/mgcp_network.h +++ b/include/osmocom/mgcp/mgcp_network.h @@ -159,8 +159,7 @@ int mgcp_get_local_addr(char *addr, struct mgcp_conn_rtp *conn);
/* payload processing default functions */ -int mgcp_rtp_processing_default(struct mgcp_endpoint *endp, struct mgcp_rtp_end *dst_end, - char *data, int *len, int buf_size); +int mgcp_rtp_processing_default(struct mgcp_endpoint *endp, struct mgcp_rtp_end *dst_end, struct msgb *msg);
int mgcp_setup_rtp_processing_default(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn_dst, diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c index 19fcd9f..ee25f74 100644 --- a/src/libosmo-mgcp/mgcp_network.c +++ b/src/libosmo-mgcp/mgcp_network.c @@ -404,13 +404,11 @@ /*! dummy callback to disable transcoding (see also cfg->rtp_processing_cb). * \param[in] associated endpoint. * \param[in] destination RTP end. - * \param[in,out] pointer to buffer with voice data. - * \param[in] voice data length. - * \param[in] maximum size of caller provided voice data buffer. + * \param[in,out] msg message bufffer containing data. Function might change length. * \returns ignores input parameters, return always 0. */ int mgcp_rtp_processing_default(struct mgcp_endpoint *endp, struct mgcp_rtp_end *dst_end, - char *data, int *len, int buf_size) + struct msgb *msg) { return 0; } @@ -1167,14 +1165,12 @@ osmo_sockaddr_port(&rtp_end->addr.u.sa), ntohs(rtp_end->rtcp_port) ); } else if (is_rtp) { - int buflen = msgb_length(msg); - /* Make sure we have a valid RTP header, in cases where no RTP * header is present, we will generate one. */ gen_rtp_header(msg, rtp_end, rtp_state);
/* Run transcoder */ - rc = endp->trunk->cfg->rtp_processing_cb(endp, rtp_end, (char *)msgb_data(msg), &buflen, RTP_BUF_SIZE); + rc = endp->trunk->cfg->rtp_processing_cb(endp, rtp_end, msg); if (rc < 0) { LOGPENDP(endp, DRTP, LOGL_ERROR, "Error %d during transcoding\n", rc); return rc;