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
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':