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

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/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(-)



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

diff --git a/src/libosmo-mgcp/mgcp_sdp.c b/src/libosmo-mgcp/mgcp_sdp.c
index c84f32c..46baa10 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;
+			}
+
+			else 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;
+			}
+
+			else 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: newchange
Gerrit-Change-Id: Ifc801a757e9beb6b3974863d5ee99fc7c194559e
Gerrit-Change-Number: 13157
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/f235a1d7/attachment.html>


More information about the gerrit-log mailing list