]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_rtp_asterisk: Fix crash when RTCP is not available during SSRC change
authorMatthew Jordan <mjordan@digium.com>
Tue, 22 Oct 2013 22:59:14 +0000 (22:59 +0000)
committerMatthew Jordan <mjordan@digium.com>
Tue, 22 Oct 2013 22:59:14 +0000 (22:59 +0000)
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
........

Merged revisions 401445 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.15@401448 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_rtp_asterisk.c

index 5bbde81c4fff85ceb19318f5c710260015fe70e6..d41441e5b56a038a109a388fcb9cef0338aa1f90 100644 (file)
@@ -2264,8 +2264,10 @@ 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;
+               if (rtp->rtcp) {
+                       rtp->rtcp->expected_prior = 0;
+                       rtp->rtcp->received_prior = 0;
+               }
        }
 
        rtp->rxssrc = ssrc;