From 58542a7c2756ee329e66389fcac087fa0fa93102 Mon Sep 17 00:00:00 2001 From: Matthew Jordan Date: Tue, 22 Oct 2013 22:36:45 +0000 Subject: [PATCH] res_rtp_asterisk: Fix crash when RTCP is not available during SSRC change In r400089, a patch was put in to correct erroneous RTCP statistic resets. Unfortunately, ast_rtp_read can be called on an RTP instance that does not have RTCP information. This patch prevents that crash by only resetting the statistics if we do actually have an RTCP instance. (issue AST-1174) (closes issue ASTERISK-22667) Reported by: John Bigelow git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@401445 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_rtp_asterisk.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 50cbfc8d94..10f982ed41 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -2279,10 +2279,12 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc rtp->rxcount = 0; rtp->cycles = 0; rtp->lastrxseqno = 0; - rtp->rtcp->expected_prior = 0; - rtp->rtcp->received_prior = 0; rtp->last_seqno = 0; rtp->last_end_timestamp = 0; + if (rtp->rtcp) { + rtp->rtcp->expected_prior = 0; + rtp->rtcp->received_prior = 0; + } } rtp->rxssrc = ssrc; -- 2.47.3