Change in osmo-mgw[master]: mgcp_sdp: untangle parsing of a= parameters

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Mar 11 13:17:53 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13157 )

Change subject: mgcp_sdp: untangle parsing of a= parameters
......................................................................

mgcp_sdp: untangle parsing of a= parameters

The if construct that takes care for parsing the a= parameters is
unnecessary complex. Lets handle each of the possible parameters
seperately on the same level.

Change-Id: Ifc801a757e9beb6b3974863d5ee99fc7c194559e
Related: OS#3807
---
M src/libosmo-mgcp/mgcp_sdp.c
1 file changed, 11 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved



diff --git a/src/libosmo-mgcp/mgcp_sdp.c b/src/libosmo-mgcp/mgcp_sdp.c
index c84f32c..9252b98 100644
--- a/src/libosmo-mgcp/mgcp_sdp.c
+++ b/src/libosmo-mgcp/mgcp_sdp.c
@@ -208,19 +208,22 @@
 			/* skip these SDP attributes */
 			break;
 		case 'a':
-			if (sscanf(line, "a=rtpmap:%d %63s",
-				   &payload, audio_name) == 2) {
-				codecs_update(tmp_ctx, codecs,
-					      codecs_used, payload, audio_name);
-			} else
-			    if (sscanf
-				(line, "a=ptime:%d-%d", &ptime, &ptime2) >= 1) {
+			if (sscanf(line, "a=rtpmap:%d %63s", &payload, audio_name) == 2) {
+				codecs_update(tmp_ctx, codecs, codecs_used, payload, audio_name);
+				break;
+			}
+
+			if (sscanf(line, "a=ptime:%d-%d", &ptime, &ptime2) >= 1) {
 				if (ptime2 > 0 && ptime2 != ptime)
 					rtp->packet_duration_ms = 0;
 				else
 					rtp->packet_duration_ms = ptime;
-			} else if (sscanf(line, "a=maxptime:%d", &ptime2) == 1) {
+				break;
+			}
+
+			if (sscanf(line, "a=maxptime:%d", &ptime2) == 1) {
 				rtp->maximum_packet_time = ptime2;
+				break;
 			}
 			break;
 		case 'm':

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

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifc801a757e9beb6b3974863d5ee99fc7c194559e
Gerrit-Change-Number: 13157
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190311/7b11a552/attachment.htm>


More information about the gerrit-log mailing list