[asterisk-commits] tilghman: branch 1.4 r91637 - /branches/1.4/main/rtp.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 6 18:52:17 CST 2007


Author: tilghman
Date: Thu Dec  6 18:52:17 2007
New Revision: 91637

URL: http://svn.digium.com/view/asterisk?view=rev&rev=91637
Log:
At the end of a call, when we're reporting, RTCP may already be partially torn down, so check for NULL dereference
Reported by: blitzrage
Patch by: tilghman
(Closes issue #11450)

Modified:
    branches/1.4/main/rtp.c

Modified: branches/1.4/main/rtp.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/rtp.c?view=diff&rev=91637&r1=91636&r2=91637
==============================================================================
--- branches/1.4/main/rtp.c (original)
+++ branches/1.4/main/rtp.c Thu Dec  6 18:52:17 2007
@@ -2078,20 +2078,34 @@
 	*rtt           round trip time
 	*/
 
-	if (qual) {
+	if (qual && rtp) {
 		qual->local_ssrc = rtp->ssrc;
-		qual->local_lostpackets = rtp->rtcp->expected_prior - rtp->rtcp->received_prior;
 		qual->local_jitter = rtp->rxjitter;
 		qual->local_count = rtp->rxcount;
 		qual->remote_ssrc = rtp->themssrc;
-		qual->remote_lostpackets = rtp->rtcp->reported_lost;
-		qual->remote_jitter = rtp->rtcp->reported_jitter / 65536.0;
 		qual->remote_count = rtp->txcount;
-		qual->rtt = rtp->rtcp->rtt;
-	}
-	snprintf(rtp->rtcp->quality, sizeof(rtp->rtcp->quality), "ssrc=%u;themssrc=%u;lp=%u;rxjitter=%f;rxcount=%u;txjitter=%f;txcount=%u;rlp=%u;rtt=%f", rtp->ssrc, rtp->themssrc, rtp->rtcp->expected_prior - rtp->rtcp->received_prior, rtp->rxjitter, rtp->rxcount, (double)rtp->rtcp->reported_jitter/65536., rtp->txcount, rtp->rtcp->reported_lost, rtp->rtcp->rtt);
-	
-	return rtp->rtcp->quality;
+		if (rtp->rtcp) {
+			qual->local_lostpackets = rtp->rtcp->expected_prior - rtp->rtcp->received_prior;
+			qual->remote_lostpackets = rtp->rtcp->reported_lost;
+			qual->remote_jitter = rtp->rtcp->reported_jitter / 65536.0;
+			qual->rtt = rtp->rtcp->rtt;
+		}
+	}
+	if (rtp->rtcp) {
+		snprintf(rtp->rtcp->quality, sizeof(rtp->rtcp->quality),
+			"ssrc=%u;themssrc=%u;lp=%u;rxjitter=%f;rxcount=%u;txjitter=%f;txcount=%u;rlp=%u;rtt=%f",
+			rtp->ssrc,
+			rtp->themssrc,
+			rtp->rtcp->expected_prior - rtp->rtcp->received_prior,
+			rtp->rxjitter,
+			rtp->rxcount,
+			(double)rtp->rtcp->reported_jitter / 65536.0,
+			rtp->txcount,
+			rtp->rtcp->reported_lost,
+			rtp->rtcp->rtt);
+		return rtp->rtcp->quality;
+	} else
+		return "<Unknown> - RTP/RTCP has already been destroyed";
 }
 
 void ast_rtp_destroy(struct ast_rtp *rtp)




More information about the asterisk-commits mailing list