Change in osmo-mgw[master]: mgcp_network: use mgcp_rtp_codec in downlink format callback

dexter gerrit-no-reply at lists.osmocom.org
Thu Mar 7 10:34:44 UTC 2019


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/13158


Change subject: mgcp_network: use mgcp_rtp_codec in downlink format callback
......................................................................

mgcp_network: use mgcp_rtp_codec in downlink format callback

The callback function mgcp_get_format() is used to request the codec
parameters for a specific connection. This function returns the
parameters as idividual pointers. Since there is a struct that holds all
important codec information among the ones which are currently returned
by mgcp_get_format, lets just use this codec struct as single return
value.

Change-Id: I348f9141eb59ed1a986447b96ab4a24ddf326936
Related: OS#3807
---
M include/osmocom/mgcp/mgcp.h
M include/osmocom/mgcp/mgcp_internal.h
M src/libosmo-mgcp/mgcp_network.c
M src/libosmo-mgcp/mgcp_sdp.c
4 files changed, 14 insertions(+), 14 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/58/13158/1

diff --git a/include/osmocom/mgcp/mgcp.h b/include/osmocom/mgcp/mgcp.h
index 5886a65..35068c1 100644
--- a/include/osmocom/mgcp/mgcp.h
+++ b/include/osmocom/mgcp/mgcp.h
@@ -44,6 +44,7 @@
 struct mgcp_config;
 struct mgcp_trunk_config;
 struct mgcp_rtp_end;
+struct mgcp_conn_rtp;
 
 #define MGCP_ENDP_CRCX 1
 #define MGCP_ENDP_DLCX 2
@@ -75,16 +76,15 @@
 			       struct mgcp_rtp_end *dst_end,
 			       char *data, int *len, int buf_size);
 
-struct mgcp_conn_rtp;
-
 typedef int (*mgcp_processing_setup)(struct mgcp_endpoint *endp,
 				     struct mgcp_conn_rtp *conn_dst,
 				     struct mgcp_conn_rtp *conn_src);
 
+struct mgcp_rtp_codec;
+
 typedef void (*mgcp_get_format)(struct mgcp_endpoint *endp,
-				int *payload_type,
-				const char**subtype_name,
-				const char**fmtp_extra,
+				const struct mgcp_rtp_codec **codec,
+				const char **fmtp_extra,
 				struct mgcp_conn_rtp *conn);
 
 /**
diff --git a/include/osmocom/mgcp/mgcp_internal.h b/include/osmocom/mgcp/mgcp_internal.h
index a6239c2..35b535a 100644
--- a/include/osmocom/mgcp/mgcp_internal.h
+++ b/include/osmocom/mgcp/mgcp_internal.h
@@ -298,9 +298,8 @@
 				      struct mgcp_conn_rtp *conn_src);
 
 void mgcp_get_net_downlink_format_default(struct mgcp_endpoint *endp,
-					  int *payload_type,
-					  const char**audio_name,
-					  const char**fmtp_extra,
+					  const struct mgcp_rtp_codec **codec,
+					  const char **fmtp_extra,
 					  struct mgcp_conn_rtp *conn);
 
 /* internal RTP Annex A counting */
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index 30ed7fd..e4fd7c0 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -416,8 +416,7 @@
 }
 
 void mgcp_get_net_downlink_format_default(struct mgcp_endpoint *endp,
-					  int *payload_type,
-					  const char **audio_name,
+					  const struct mgcp_rtp_codec **codec,
 					  const char **fmtp_extra,
 					  struct mgcp_conn_rtp *conn)
 {
@@ -425,8 +424,7 @@
 	     "endpoint:0x%x conn:%s using format defaults\n",
 	     ENDPOINT_NUMBER(endp), mgcp_conn_dump(conn->conn));
 
-	*payload_type = conn->end.codec->payload_type;
-	*audio_name = conn->end.codec->audio_name;
+	*codec = conn->end.codec;
 	*fmtp_extra = conn->end.fmtp_extra;
 }
 
diff --git a/src/libosmo-mgcp/mgcp_sdp.c b/src/libosmo-mgcp/mgcp_sdp.c
index 46baa10..f5b7bdd 100644
--- a/src/libosmo-mgcp/mgcp_sdp.c
+++ b/src/libosmo-mgcp/mgcp_sdp.c
@@ -344,6 +344,7 @@
 			    const struct mgcp_conn_rtp *conn, struct msgb *sdp,
 			    const char *addr)
 {
+	const struct mgcp_rtp_codec *codec;
 	const char *fmtp_extra;
 	const char *audio_name;
 	int payload_type;
@@ -357,10 +358,12 @@
 
 	/* FIXME: constify endp and conn args in get_net_donwlink_format_cb() */
 	endp->cfg->get_net_downlink_format_cb((struct mgcp_endpoint *)endp,
-					      &payload_type, &audio_name,
-					      &fmtp_extra,
+					      &codec, &fmtp_extra,
 					      (struct mgcp_conn_rtp *)conn);
 
+	audio_name = codec->audio_name;
+	payload_type = codec->payload_type;
+
 	rc = msgb_printf(sdp,
 			 "v=0\r\n"
 			 "o=- %s 23 IN IP4 %s\r\n"

-- 
To view, visit https://gerrit.osmocom.org/13158
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I348f9141eb59ed1a986447b96ab4a24ddf326936
Gerrit-Change-Number: 13158
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190307/defa0bb4/attachment.html>


More information about the gerrit-log mailing list