[asterisk-commits] oej: trunk r376998 - in /trunk: channels/chan_sip.c res/res_rtp_asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 3 03:36:00 CST 2012


Author: oej
Date: Mon Dec  3 03:35:55 2012
New Revision: 376998

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376998
Log:
Formatting changes

Found a large amount of missing {} in the code before patching in another branch

Modified:
    trunk/channels/chan_sip.c
    trunk/res/res_rtp_asterisk.c

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=376998&r1=376997&r2=376998
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Dec  3 03:35:55 2012
@@ -6078,41 +6078,49 @@
 			}
 		}
 	}
-	if (!ast_strlen_zero(peer->fromuser))
+	if (!ast_strlen_zero(peer->fromuser)) {
 		ast_string_field_set(dialog, fromuser, peer->fromuser);
-	if (!ast_strlen_zero(peer->language))
+	}
+	if (!ast_strlen_zero(peer->language)) {
 		ast_string_field_set(dialog, language, peer->language);
+	}
 	/* Set timer T1 to RTT for this peer (if known by qualify=) */
 	/* Minimum is settable or default to 100 ms */
 	/* If there is a maxms and lastms from a qualify use that over a manual T1
 	   value. Otherwise, use the peer's T1 value. */
-	if (peer->maxms && peer->lastms)
+	if (peer->maxms && peer->lastms) {
 		dialog->timer_t1 = peer->lastms < global_t1min ? global_t1min : peer->lastms;
-	else
+	} else {
 		dialog->timer_t1 = peer->timer_t1;
+	}
 
 	/* Set timer B to control transaction timeouts, the peer setting is the default and overrides
 	   the known timer */
-	if (peer->timer_b)
+	if (peer->timer_b) {
 		dialog->timer_b = peer->timer_b;
-	else
+	} else {
 		dialog->timer_b = 64 * dialog->timer_t1;
+	}
 
 	if ((ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833) ||
-	    (ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_AUTO))
+	    (ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_AUTO)) {
 		dialog->noncodeccapability |= AST_RTP_DTMF;
-	else
+	} else {
 		dialog->noncodeccapability &= ~AST_RTP_DTMF;
+	}
 
 	dialog->directmediaacl = ast_duplicate_acl_list(peer->directmediaacl);
 
-	if (peer->call_limit)
+	if (peer->call_limit) {
 		ast_set_flag(&dialog->flags[0], SIP_CALL_LIMIT);
-	if (!dialog->portinuri)
+	}
+	if (!dialog->portinuri) {
 		dialog->portinuri = peer->portinuri;
+	}
 	dialog->chanvars = copy_vars(peer->chanvars);
-	if (peer->fromdomainport)
+	if (peer->fromdomainport) {
 		dialog->fromdomainport = peer->fromdomainport;
+	}
 
 	return 0;
 }

Modified: trunk/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_rtp_asterisk.c?view=diff&rev=376998&r1=376997&r2=376998
==============================================================================
--- trunk/res/res_rtp_asterisk.c (original)
+++ trunk/res/res_rtp_asterisk.c Mon Dec  3 03:35:55 2012
@@ -2995,8 +2995,9 @@
 		f = create_dtmf_frame(instance, AST_FRAME_DTMF_END, ast_rtp_instance_get_prop(instance, AST_RTP_PROPERTY_DTMF_COMPENSATE));
 		f->samples = rtp->dtmfsamples * (rtp->lastrxformat.id ? (rtp_get_rate(&rtp->lastrxformat) / 1000) : 8);
 		rtp->resp = 0;
-	} else if (rtp->resp == resp)
+	} else if (rtp->resp == resp) {
 		rtp->dtmfsamples += 20 * (rtp->lastrxformat.id ? (rtp_get_rate(&rtp->lastrxformat) / 1000) : 8);
+	}
 
 	rtp->dtmf_timeout = 0;
 
@@ -3010,8 +3011,9 @@
 	/* Convert comfort noise into audio with various codecs.  Unfortunately this doesn't
 	   totally help us out becuase we don't have an engine to keep it going and we are not
 	   guaranteed to have it every 20ms or anything */
-	if (rtpdebug)
+	if (rtpdebug) {
 		ast_debug(0, "- RTP 3389 Comfort noise event: Level %d (len = %d)\n", (int) rtp->lastrxformat.id, len);
+	}
 
 	if (ast_test_flag(rtp, FLAG_3389_WARNING)) {
 		struct ast_sockaddr remote_address = { {0,} };
@@ -3024,8 +3026,9 @@
 	}
 
 	/* Must have at least one byte */
-	if (!len)
+	if (!len) {
 		return NULL;
+	}
 	if (len < 24) {
 		rtp->f.data.ptr = rtp->rawdata + AST_FRIENDLY_OFFSET;
 		rtp->f.datalen = len - 1;
@@ -3099,9 +3102,10 @@
 		/* Send to whoever sent to us */
 		if (ast_sockaddr_cmp(&rtp->rtcp->them, &addr)) {
 			ast_sockaddr_copy(&rtp->rtcp->them, &addr);
-			if (rtpdebug)
+			if (rtpdebug) {
 				ast_debug(0, "RTCP NAT: Got RTCP from other end. Now sending to address %s\n",
 					  ast_sockaddr_stringify(&rtp->rtcp->them));
+			}
 		}
 	}
 
@@ -3121,8 +3125,9 @@
 		length &= 0xffff;
 
 		if ((i + length) > packetwords) {
-			if (rtpdebug)
+			if (rtpdebug) {
 				ast_debug(1, "RTCP Read too short\n");
+			}
 			return &ast_null_frame;
 		}
 
@@ -3153,8 +3158,9 @@
 				ast_verbose("SPC: %lu\tSOC: %lu\n", (unsigned long) ntohl(rtcpheader[i + 3]), (unsigned long) ntohl(rtcpheader[i + 4]));
 			}
 			i += 5;
-			if (rc < 1)
+			if (rc < 1) {
 				break;
+			}
 			/* Intentional fall through */
 		case RTCP_PT_RR:
 			/* Don't handle multiple reception reports (rc > 1) yet */
@@ -3182,13 +3188,16 @@
 				if (comp - dlsr >= lsr) {
 					rtp->rtcp->accumulated_transit += rttsec;
 
-					if (rtp->rtcp->rtt_count == 0)
+					if (rtp->rtcp->rtt_count == 0) {
 						rtp->rtcp->minrtt = rttsec;
-
-					if (rtp->rtcp->maxrtt<rttsec)
+					}
+
+					if (rtp->rtcp->maxrtt<rttsec) {
 						rtp->rtcp->maxrtt = rttsec;
-					if (rtp->rtcp->minrtt>rttsec)
+					}
+					if (rtp->rtcp->minrtt>rttsec) {
 						rtp->rtcp->minrtt = rttsec;
+					}
 
 					normdevrtt_current = normdev_compute(rtp->rtcp->normdevrtt, rttsec, rtp->rtcp->rtt_count);
 
@@ -3210,14 +3219,17 @@
 			rtp->rtcp->reported_jitter = ntohl(rtcpheader[i + 3]);
 			reported_jitter = (double) rtp->rtcp->reported_jitter;
 
-			if (rtp->rtcp->reported_jitter_count == 0)
+			if (rtp->rtcp->reported_jitter_count == 0) {
 				rtp->rtcp->reported_minjitter = reported_jitter;
-
-			if (reported_jitter < rtp->rtcp->reported_minjitter)
+			}
+
+			if (reported_jitter < rtp->rtcp->reported_minjitter) {
 				rtp->rtcp->reported_minjitter = reported_jitter;
-
-			if (reported_jitter > rtp->rtcp->reported_maxjitter)
+			}
+
+			if (reported_jitter > rtp->rtcp->reported_maxjitter) {
 				rtp->rtcp->reported_maxjitter = reported_jitter;
+			}
 
 			reported_normdev_jitter_current = normdev_compute(rtp->rtcp->reported_normdev_jitter, reported_jitter, rtp->rtcp->reported_jitter_count);
 
@@ -3230,14 +3242,17 @@
 			reported_lost = (double) rtp->rtcp->reported_lost;
 
 			/* using same counter as for jitter */
-			if (rtp->rtcp->reported_jitter_count == 0)
+			if (rtp->rtcp->reported_jitter_count == 0) {
 				rtp->rtcp->reported_minlost = reported_lost;
-
-			if (reported_lost < rtp->rtcp->reported_minlost)
+			}
+
+			if (reported_lost < rtp->rtcp->reported_minlost) {
 				rtp->rtcp->reported_minlost = reported_lost;
-
-			if (reported_lost > rtp->rtcp->reported_maxlost)
+			}
+
+			if (reported_lost > rtp->rtcp->reported_maxlost) {
 				rtp->rtcp->reported_maxlost = reported_lost;
+			}
 			reported_normdev_lost_current = normdev_compute(rtp->rtcp->reported_normdev_lost, reported_lost, rtp->rtcp->reported_jitter_count);
 
 			rtp->rtcp->reported_stdev_lost = stddev_compute(rtp->rtcp->reported_stdev_lost, reported_lost, rtp->rtcp->reported_normdev_lost, reported_normdev_lost_current, rtp->rtcp->reported_jitter_count);
@@ -3254,8 +3269,9 @@
 				ast_verbose("  Interarrival jitter: %u\n", rtp->rtcp->reported_jitter);
 				ast_verbose("  Last SR(our NTP): %lu.%010lu\n",(unsigned long) ntohl(rtcpheader[i + 4]) >> 16,((unsigned long) ntohl(rtcpheader[i + 4]) << 16) * 4096);
 				ast_verbose("  DLSR: %4.4f (sec)\n",ntohl(rtcpheader[i + 5])/65536.0);
-				if (rtt)
+				if (rtt) {
 					ast_verbose("  RTT: %lu(sec)\n", (unsigned long) rtt);
+				}
 			}
 			if (rtt) {
 				manager_event(EVENT_FLAG_REPORTING, "RTCPReceived", "From: %s\r\n"
@@ -3309,8 +3325,9 @@
 			}
 			break;
 		case RTCP_PT_FUR:
-			if (rtcp_debug_test_addr(&addr))
+			if (rtcp_debug_test_addr(&addr)) {
 				ast_verbose("Received an RTCP Fast Update Request\n");
+			}
 			rtp->f.frametype = AST_FRAME_CONTROL;
 			rtp->f.subclass.integer = AST_CONTROL_VIDUPDATE;
 			rtp->f.datalen = 0;
@@ -3320,14 +3337,16 @@
 			f = &rtp->f;
 			break;
 		case RTCP_PT_SDES:
-			if (rtcp_debug_test_addr(&addr))
+			if (rtcp_debug_test_addr(&addr)) {
 				ast_verbose("Received an SDES from %s\n",
 					    ast_sockaddr_stringify(&rtp->rtcp->them));
+			}
 			break;
 		case RTCP_PT_BYE:
-			if (rtcp_debug_test_addr(&addr))
+			if (rtcp_debug_test_addr(&addr)) {
 				ast_verbose("Received a BYE from %s\n",
 					    ast_sockaddr_stringify(&rtp->rtcp->them));
+			}
 			break;
 		default:
 			ast_debug(1, "Unknown RTCP packet (pt=%d) received from %s\n",
@@ -3401,12 +3420,13 @@
 				ast_sockaddr_stringify(&remote_address),
 				strerror(errno));
 		} else if (((ast_test_flag(bridged, FLAG_NAT_ACTIVE) == FLAG_NAT_INACTIVE) || rtpdebug) && !ast_test_flag(bridged, FLAG_NAT_INACTIVE_NOWARN)) {
-			if (option_debug || rtpdebug)
+			if (option_debug || rtpdebug) {
 				ast_log(LOG_WARNING,
 					"RTP NAT: Can't write RTP to private "
 					"address %s, waiting for other end to "
 					"send audio...\n",
 					ast_sockaddr_stringify(&remote_address));
+			}
 			ast_set_flag(bridged, FLAG_NAT_INACTIVE_NOWARN);
 		}
 		return 0;




More information about the asterisk-commits mailing list