From f6f7774b193fe05580f8c6044ddde69f52c3aa2c Mon Sep 17 00:00:00 2001 From: Automerge script <automerge@asterisk.org> Date: Mon, 3 Dec 2012 17:19:46 +0000 Subject: [PATCH] Merged revisions 377035,377040 via svnmerge from file:///srv/subversion/repos/asterisk/trunk ................ r377035 | oej | 2012-12-03 10:45:49 -0600 (Mon, 03 Dec 2012) | 2 lines Formatting fixes ................ r377040 | rmudgett | 2012-12-03 11:10:40 -0600 (Mon, 03 Dec 2012) | 16 lines Fix CCSS CLI commands and logger level not unregistered. (issue ASTERISK-20649) Reported by: Corey Farrell Patches: ccss-cleanup-all.patch (license #5909) patch uploaded by Corey Farrell ........ Merged revisions 377037 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 377038 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 377039 from http://svn.asterisk.org/svn/asterisk/branches/11 ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377047 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/ccss.c | 2 ++ res/res_rtp_asterisk.c | 46 +++++++++++++++++++++++++++--------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/main/ccss.c b/main/ccss.c index 11e3a008fe..6ce022ddf5 100644 --- a/main/ccss.c +++ b/main/ccss.c @@ -4536,6 +4536,8 @@ static void cc_shutdown(void) ast_cc_monitor_unregister(&generic_monitor_cbs); ast_unregister_application(cccancel_app); ast_unregister_application(ccreq_app); + ast_logger_unregister_level(CC_LOGGER_LEVEL_NAME); + ast_cli_unregister_multiple(cc_cli, ARRAY_LEN(cc_cli)); if (cc_sched_context) { ast_sched_context_destroy(cc_sched_context); diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index d362a29f1a..5f9d40fb10 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -671,8 +671,9 @@ static char *generate_random_string(char *buf, size_t size) long val[4]; int x; - for (x=0; x<4; x++) + for (x=0; x<4; x++) { val[x] = ast_random(); + } snprintf(buf, size, "%08lx%08lx%08lx%08lx", val[0], val[1], val[2], val[3]); return buf; @@ -2164,8 +2165,9 @@ static int ast_rtcp_write_rr(struct ast_rtp_instance *instance) double rxlost_current; struct ast_sockaddr remote_address = { {0,} }; - if (!rtp || !rtp->rtcp) + if (!rtp || !rtp->rtcp) { return 0; + } if (ast_sockaddr_isnull(&rtp->rtcp->them)) { /* @@ -2183,25 +2185,31 @@ static int ast_rtcp_write_rr(struct ast_rtp_instance *instance) rtp->rtcp->received_prior = rtp->rxcount; lost_interval = expected_interval - received_interval; - if (lost_interval <= 0) + if (lost_interval <= 0) { rtp->rtcp->rxlost = 0; - else rtp->rtcp->rxlost = rtp->rtcp->rxlost; - if (rtp->rtcp->rxlost_count == 0) + } else { + rtp->rtcp->rxlost = rtp->rtcp->rxlost; + } + if (rtp->rtcp->rxlost_count == 0) { rtp->rtcp->minrxlost = rtp->rtcp->rxlost; - if (lost_interval < rtp->rtcp->minrxlost) + } + if (lost_interval < rtp->rtcp->minrxlost) { rtp->rtcp->minrxlost = rtp->rtcp->rxlost; - if (lost_interval > rtp->rtcp->maxrxlost) + } + if (lost_interval > rtp->rtcp->maxrxlost) { rtp->rtcp->maxrxlost = rtp->rtcp->rxlost; + } rxlost_current = normdev_compute(rtp->rtcp->normdev_rxlost, rtp->rtcp->rxlost, rtp->rtcp->rxlost_count); rtp->rtcp->stdev_rxlost = stddev_compute(rtp->rtcp->stdev_rxlost, rtp->rtcp->rxlost, rtp->rtcp->normdev_rxlost, rxlost_current, rtp->rtcp->rxlost_count); rtp->rtcp->normdev_rxlost = rxlost_current; rtp->rtcp->rxlost_count++; - if (expected_interval == 0 || lost_interval <= 0) + if (expected_interval == 0 || lost_interval <= 0) { fraction = 0; - else + } else { fraction = (lost_interval << 8) / expected_interval; + } gettimeofday(&now, NULL); timersub(&now, &rtp->rtcp->rxlsr, &dlsr); rtcpheader = (unsigned int *)bdata; @@ -2274,8 +2282,9 @@ static int ast_rtcp_write_sr(struct ast_rtp_instance *instance) int ice; struct ast_sockaddr remote_address = { {0,} }; - if (!rtp || !rtp->rtcp) + if (!rtp || !rtp->rtcp) { return 0; + } if (ast_sockaddr_isnull(&rtp->rtcp->them)) { /* This'll stop rtcp for this rtp session */ /* @@ -2297,18 +2306,20 @@ static int ast_rtcp_write_sr(struct ast_rtp_instance *instance) extended = rtp->cycles + rtp->lastrxseqno; expected = extended - rtp->seedrxseqno + 1; - if (rtp->rxcount > expected) + if (rtp->rxcount > expected) { expected += rtp->rxcount - expected; + } lost = expected - rtp->rxcount; expected_interval = expected - rtp->rtcp->expected_prior; rtp->rtcp->expected_prior = expected; received_interval = rtp->rxcount - rtp->rtcp->received_prior; rtp->rtcp->received_prior = rtp->rxcount; lost_interval = expected_interval - received_interval; - if (expected_interval == 0 || lost_interval <= 0) + if (expected_interval == 0 || lost_interval <= 0) { fraction = 0; - else + } else { fraction = (lost_interval << 8) / expected_interval; + } timersub(&now, &rtp->rtcp->rxlsr, &dlsr); rtcpheader[7] = htonl(rtp->themssrc); rtcpheader[8] = htonl(((fraction & 0xff) << 24) | (lost & 0xffffff)); @@ -2567,16 +2578,18 @@ static struct ast_frame *red_t140_to_red(struct rtp_red *red) { /* write each generation length in red header */ len = red->hdrlen; - for (i = 0; i < red->num_gen; i++) + for (i = 0; i < red->num_gen; i++) { len += data[i*4+3] = red->len[i]; + } /* add primary data to buffer */ memcpy(&data[len], red->t140.data.ptr, red->t140.datalen); red->t140red.datalen = len + red->t140.datalen; /* no primary data and no generations to send */ - if (len == red->hdrlen && !red->t140.datalen) + if (len == red->hdrlen && !red->t140.datalen) { return NULL; + } /* reset t.140 buffer */ red->t140.datalen = 0; @@ -2735,8 +2748,9 @@ static void calc_rxstamp(struct timeval *tv, struct ast_rtp *rtp, unsigned int t transit = current_time - dtv; d = transit - rtp->rxtransit; rtp->rxtransit = transit; - if (d<0) + if (d<0) { d=-d; + } rtp->rxjitter += (1./16.) * (d - rtp->rxjitter); if (rtp->rtcp) { -- GitLab