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.orgHarald Welte has submitted this change and it was merged.
Change subject: cosmetic: fix coding style for mgcp_parse_sdp_data()
......................................................................
cosmetic: fix coding style for mgcp_parse_sdp_data()
move variable declaration to the top
remove brackets in case statement
correct whitespaces
Change-Id: I6dcf53ef8d3af5885b8b1f258d963949fa3ee93a
---
M src/libosmo-mgcp/mgcp_sdp.c
1 file changed, 38 insertions(+), 39 deletions(-)
Approvals:
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/libosmo-mgcp/mgcp_sdp.c b/src/libosmo-mgcp/mgcp_sdp.c
index 423153c..8575e86 100644
--- a/src/libosmo-mgcp/mgcp_sdp.c
+++ b/src/libosmo-mgcp/mgcp_sdp.c
@@ -213,6 +213,12 @@
void *tmp_ctx = talloc_new(NULL);
struct mgcp_rtp_end *rtp;
+ int payload;
+ int ptime, ptime2 = 0;
+ char audio_name[64];
+ int port, rc;
+ char ipv4[16];
+
OSMO_ASSERT(endp);
OSMO_ASSERT(conn);
OSMO_ASSERT(p);
@@ -228,41 +234,36 @@
case 'v':
/* skip these SDP attributes */
break;
- case 'a': {
- int payload;
- int ptime, ptime2 = 0;
- char audio_name[64];
-
-
+ 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) {
+ codecs_update(tmp_ctx, codecs,
+ codecs_used, payload, audio_name);
+ } 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) {
+ } else if (sscanf(line, "a=maxptime:%d", &ptime2)
+ == 1) {
maxptime = ptime2;
}
break;
- }
- case 'm': {
- int port, rc;
-
- rc = sscanf(line, "m=audio %d RTP/AVP %d %d %d %d %d %d %d %d %d %d",
- &port,
- &codecs[0].payload_type,
- &codecs[1].payload_type,
- &codecs[2].payload_type,
- &codecs[3].payload_type,
- &codecs[4].payload_type,
- &codecs[5].payload_type,
- &codecs[6].payload_type,
- &codecs[7].payload_type,
- &codecs[8].payload_type,
- &codecs[9].payload_type);
+ case 'm':
+ rc = sscanf(line,
+ "m=audio %d RTP/AVP %d %d %d %d %d %d %d %d %d %d",
+ &port, &codecs[0].payload_type,
+ &codecs[1].payload_type,
+ &codecs[2].payload_type,
+ &codecs[3].payload_type,
+ &codecs[4].payload_type,
+ &codecs[5].payload_type,
+ &codecs[6].payload_type,
+ &codecs[7].payload_type,
+ &codecs[8].payload_type,
+ &codecs[9].payload_type);
if (rc >= 2) {
rtp->rtp_port = htons(port);
rtp->rtcp_port = htons(port + 1);
@@ -270,20 +271,18 @@
codecs_initialize(tmp_ctx, codecs, codecs_used);
}
break;
- }
- case 'c': {
- char ipv4[16];
+ case 'c':
if (sscanf(line, "c=IN IP4 %15s", ipv4) == 1) {
inet_aton(ipv4, &rtp->addr);
}
break;
- }
default:
if (p->endp)
LOGP(DLMGCP, LOGL_NOTICE,
"Unhandled SDP option: '%c'/%d on 0x%x\n",
- line[0], line[0], ENDPOINT_NUMBER(p->endp));
+ line[0], line[0],
+ ENDPOINT_NUMBER(p->endp));
else
LOGP(DLMGCP, LOGL_NOTICE,
"Unhandled SDP option: '%c'/%d\n",
@@ -295,25 +294,24 @@
/* Now select the primary and alt_codec */
for (i = 0; i < codecs_used && codecs_assigned < 2; ++i) {
struct mgcp_rtp_codec *codec = codecs_assigned == 0 ?
- &rtp->codec : &rtp->alt_codec;
+ &rtp->codec : &rtp->alt_codec;
if (endp->tcfg->no_audio_transcoding &&
- !is_codec_compatible(endp, &codecs[i])) {
+ !is_codec_compatible(endp, &codecs[i])) {
LOGP(DLMGCP, LOGL_NOTICE, "Skipping codec %s\n",
- codecs[i].codec_name);
+ codecs[i].codec_name);
continue;
}
mgcp_set_audio_info(p->cfg, codec,
- codecs[i].payload_type,
- codecs[i].map_line);
+ codecs[i].payload_type, codecs[i].map_line);
codecs_assigned += 1;
}
if (codecs_assigned > 0) {
/* TODO/XXX: Store this per codec and derive it on use */
if (maxptime >= 0 && maxptime * rtp->codec.frame_duration_den >
- rtp->codec.frame_duration_num * 1500) {
+ rtp->codec.frame_duration_num * 1500) {
/* more than 1 frame */
rtp->packet_duration_ms = 0;
}
@@ -322,8 +320,9 @@
"Got media info via SDP: port %d, payload %d (%s), "
"duration %d, addr %s\n",
ntohs(rtp->rtp_port), rtp->codec.payload_type,
- rtp->codec.subtype_name ? rtp->codec.subtype_name : "unknown",
- rtp->packet_duration_ms, inet_ntoa(rtp->addr));
+ rtp->codec.subtype_name ? rtp->
+ codec.subtype_name : "unknown", rtp->packet_duration_ms,
+ inet_ntoa(rtp->addr));
}
talloc_free(tmp_ctx);
--
To view, visit https://gerrit.osmocom.org/4327
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6dcf53ef8d3af5885b8b1f258d963949fa3ee93a
Gerrit-PatchSet: 4
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder