[svn-commits] branch oej/rtcp r11276 - in /team/oej/rtcp:
include/asterisk/rtp.h rtp.c
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Mon Feb 27 02:46:09 MST 2006
Author: oej
Date: Mon Feb 27 03:46:06 2006
New Revision: 11276
URL: http://svn.digium.com/view/asterisk?rev=11276&view=rev
Log:
Cleanup of forward declarations, static declarations and whitespace
Modified:
team/oej/rtcp/include/asterisk/rtp.h
team/oej/rtcp/rtp.c
Modified: team/oej/rtcp/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/team/oej/rtcp/include/asterisk/rtp.h?rev=11276&r1=11275&r2=11276&view=diff
==============================================================================
--- team/oej/rtcp/include/asterisk/rtp.h (original)
+++ team/oej/rtcp/include/asterisk/rtp.h Mon Feb 27 03:46:06 2006
@@ -158,6 +158,12 @@
void ast_rtp_stop(struct ast_rtp *rtp);
+/*! \brief Return RTCP quality string */
+char *ast_rtp_get_qualify(struct ast_rtp *rtp);
+
+/*! \brief Send an H.261 fast update request. Some devices need this rather than the XML message in SIP */
+int ast_rtcp_send_h261fur(void *data);
+
void ast_rtp_init(void);
int ast_rtp_reload(void);
Modified: team/oej/rtcp/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/rtcp/rtp.c?rev=11276&r1=11275&r2=11276&view=diff
==============================================================================
--- team/oej/rtcp/rtp.c (original)
+++ team/oej/rtcp/rtp.c Mon Feb 27 03:46:06 2006
@@ -88,7 +88,12 @@
#endif
/* Forward declarations */
-int ast_rtcp_write(void *data);
+static int ast_rtcp_write(void *data);
+static void timeval2ntp(struct timeval tv, unsigned int *msw, unsigned int *lsw);
+static int ast_rtcp_write_sr(void *data);
+static int ast_rtcp_write_rr(void *data);
+static void ast_rtp_offered_from_local(struct ast_rtp* rtp, int local);
+static unsigned int ast_rtcp_calc_interval(struct ast_rtp *rtp);
/*! \brief The value of each payload format mapping: */
struct rtpPayloadType {
@@ -197,7 +202,7 @@
/*! \brief List of current sessions */
static AST_LIST_HEAD_STATIC(protos, ast_rtp_protocol);
-void timeval2ntp(struct timeval tv, unsigned int *msw, unsigned int *lsw)
+static void timeval2ntp(struct timeval tv, unsigned int *msw, unsigned int *lsw)
{
unsigned int sec, usec, frac;
sec = tv.tv_sec + 2208988800u; /* Sec between 1900 and 1970 */
@@ -1152,7 +1157,7 @@
/* Check the dynamic list first */
for (pt = 0; pt < MAX_RTP_PT; ++pt) {
- if (rtp->current_RTP_PT[pt].code == code && rtp->current_RTP_PT[pt].isAstFormat == isAstFormat) {
+ if (rtp->current_RTP_PT[pt].code == code && rtp->current_RTP_PT[pt].isAstFormat == isAstFormat) {
rtp->rtp_lookup_code_cache_isAstFormat = isAstFormat;
rtp->rtp_lookup_code_cache_code = code;
rtp->rtp_lookup_code_cache_result = pt;
@@ -1568,7 +1573,7 @@
rtpheader[3] |= htonl((1 << 23));
}
}
- /* Increment the digit timestamp by 120ms, to ensure that digits
+ /*! \note Increment the digit timestamp by 120ms, to ensure that digits
sent sequentially with no intervening non-digit packets do not
get sent with the same timestamp, and that sequential digits
have some 'dead air' in between them
@@ -1581,19 +1586,20 @@
return 0;
}
-/* Send an H.261 fast update request, some devices need this rather than SIP XML */
+/* \brief Public function: Send an H.261 fast update request, some devices need this rather than SIP XML */
int ast_rtcp_send_h261fur(void *data)
{
struct ast_rtp *rtp = data;
int res;
- rtp->rtcp->sendfur = 1;
+ rtp->rtcp->sendfur = 1;
res = ast_rtcp_write(data);
return res;
}
-int ast_rtcp_write_sr(void *data)
+/*! \brief Send RTCP sender's report */
+static int ast_rtcp_write_sr(void *data)
{
struct ast_rtp *rtp = data;
int res;
@@ -1669,14 +1675,14 @@
/* Insert SDES here. Probably should make SDES text equal to mimetypes[code].type (not subtype 'cos */
/* it can change mid call, and SDES can't) */
- rtcpheader[len/4] = htonl((2 << 30) | (1 << 24) | (RTCP_PT_SDES << 16) | 2);
+ rtcpheader[len/4] = htonl((2 << 30) | (1 << 24) | (RTCP_PT_SDES << 16) | 2);
rtcpheader[(len/4)+1] = htonl(rtp->ssrc); /* Our SSRC */
rtcpheader[(len/4)+2] = htonl(0x01 << 24); /* Empty for the moment */
len += 12;
res = sendto(rtp->rtcp->s, (unsigned int *)rtcpheader, len, 0, (struct sockaddr *)&rtp->rtcp->them, sizeof(rtp->rtcp->them));
if(res<0){
- ast_verbose("RTCP SR transmission error to %s:%d, rtcp halted %s\n",ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port), strerror(errno));
+ ast_log(LOG_ERROR, "RTCP SR transmission error to %s:%d, rtcp halted %s\n",ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port), strerror(errno));
ast_sched_del(rtp->sched, rtp->rtcp->schedid);
rtp->rtcp->schedid = -1;
return 0;
@@ -1686,7 +1692,7 @@
gettimeofday(&rtp->rtcp->txlsr, NULL);
rtp->rtcp->sr_count++;
- rtp->rtcp->lastsrtxcount = rtp->txcount;
+ rtp->rtcp->lastsrtxcount = rtp->txcount;
if(rtcp_debug_test_addr(&rtp->rtcp->them)){
ast_verbose("Sent RTCP SR to %s:%d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port));
@@ -1705,7 +1711,8 @@
return res;
}
-int ast_rtcp_write_rr(void *data)
+/*! \brief Send RTCP recepient's report */
+static int ast_rtcp_write_rr(void *data)
{
struct ast_rtp *rtp = data;
int res;
@@ -1724,10 +1731,10 @@
int fraction;
if(!rtp || !rtp->rtcp || (&rtp->rtcp->them.sin_addr == 0))
- return 0;
+ return 0;
if(!rtp->rtcp->them.sin_addr.s_addr){
- ast_verbose("RTCP RR transmission error to, rtcp halted %s\n",strerror(errno));
+ ast_log(LOG_ERROR, "RTCP RR transmission error to, rtcp halted %s\n",strerror(errno));
ast_sched_del(rtp->sched, rtp->rtcp->schedid);
rtp->rtcp->schedid = -1;
return 0;
@@ -1764,17 +1771,17 @@
rtp->rtcp->sendfur = 0;
}
- /* Insert SDES here. Probably should make SDES text equal to mimetypes[code].type (not subtype 'cos */
- /* it can change mid call, and SDES can't) */
- rtcpheader[len/4] = htonl((2 << 30) | (1 << 24) | (RTCP_PT_SDES << 16) | 2);
+ /*! \note Insert SDES here. Probably should make SDES text equal to mimetypes[code].type (not subtype 'cos
+ it can change mid call, and SDES can't) */
+ rtcpheader[len/4] = htonl((2 << 30) | (1 << 24) | (RTCP_PT_SDES << 16) | 2);
rtcpheader[(len/4)+1] = htonl(rtp->ssrc); /* Our SSRC */
rtcpheader[(len/4)+2] = htonl(0x01 << 24); /* Empty for the moment */
len += 12;
res = sendto(rtp->rtcp->s, (unsigned int *)rtcpheader, len, 0, (struct sockaddr *)&rtp->rtcp->them, sizeof(rtp->rtcp->them));
- if(res<0){
- ast_verbose("RTCP RR transmission error, rtcp halted: %s\n",strerror(errno));
+ if(res < 0){
+ ast_log(LOG_ERROR, "RTCP RR transmission error, rtcp halted: %s\n",strerror(errno));
/* Remove the scheduler */
ast_sched_del(rtp->sched, rtp->rtcp->schedid);
rtp->rtcp->schedid = -1;
@@ -1784,23 +1791,27 @@
rtp->rtcp->rr_count++;
if(rtcp_debug_test_addr(&rtp->rtcp->them)){
- ast_verbose("\nSending RTCP RR to %s:%d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port));
- ast_verbose("Our SSRC: %u\n", rtp->ssrc);
- ast_verbose("Their SSRC: %u\n", rtp->themssrc);
- ast_verbose("Fraction lost: %d\n", fraction);
- ast_verbose("Cumulative loss: %u\n", lost);
- ast_verbose("IA jitter: %.4f\n", rtp->rxjitter);
- ast_verbose("Their last SR: %u\n", rtp->rtcp->themrxlsr);
- ast_verbose("DLSR: %4.4f (sec)\n\n", (double)(ntohl(rtcpheader[7])/65536.0));
+ ast_verbose("\nSending RTCP RR to %s:%d\n"
+ "Our SSRC: %u\nTheir SSRC: %u\niFraction lost: %d\nCumulative loss: %u\n"
+ "IA jitter: %.4f\n"
+ "Their last SR: %u\n"
+ "DLSR: %4.4f (sec)\n\n",
+ ast_inet_ntoa(iabuf, sizeof(iabuf),
+ rtp->rtcp->them.sin_addr),
+ ntohs(rtp->rtcp->them.sin_port),
+ rtp->ssrc, rtp->themssrc, fraction, lost,
+ rtp->rxjitter,
+ rtp->rtcp->themrxlsr,
+ (double)(ntohl(rtcpheader[7])/65536.0));
}
return res;
}
-/* Write and RTCP packet to the far end */
-/* Decide if we are going to send an SR (with Reception Block) or RR */
-/* RR is sent if we have not sent any rtp packets in the previous interval */
-int ast_rtcp_write(void *data)
+/*! \brief Write and RTCP packet to the far end
+ * \note Decide if we are going to send an SR (with Reception Block) or RR
+ * RR is sent if we have not sent any rtp packets in the previous interval */
+static int ast_rtcp_write(void *data)
{
struct ast_rtp *rtp = data;
int res;
@@ -1813,6 +1824,7 @@
return res;
}
+/*! \brief generate comfort noice (CNG) */
int ast_rtp_sendcng(struct ast_rtp *rtp, int level)
{
unsigned int *rtpheader;
More information about the svn-commits
mailing list