[asterisk-commits] oej: branch group/pinefool-poor-mans-plc-1.4 r383504 - in /team/group/pinefoo...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Mar 21 03:57:26 CDT 2013
Author: oej
Date: Thu Mar 21 03:57:18 2013
New Revision: 383504
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383504
Log:
Make plc configurable from the channel
Modified:
team/group/pinefool-poor-mans-plc-1.4/include/asterisk/rtp.h
team/group/pinefool-poor-mans-plc-1.4/main/rtp.c
Modified: team/group/pinefool-poor-mans-plc-1.4/include/asterisk/rtp.h
URL: http://svnview.digium.com/svn/asterisk/team/group/pinefool-poor-mans-plc-1.4/include/asterisk/rtp.h?view=diff&rev=383504&r1=383503&r2=383504
==============================================================================
--- team/group/pinefool-poor-mans-plc-1.4/include/asterisk/rtp.h (original)
+++ team/group/pinefool-poor-mans-plc-1.4/include/asterisk/rtp.h Thu Mar 21 03:57:18 2013
@@ -271,6 +271,8 @@
void ast_rtp_set_rtpholdtimeout(struct ast_rtp *rtp, int timeout);
/*! \brief set RTP keepalive interval */
void ast_rtp_set_rtpkeepalive(struct ast_rtp *rtp, int period);
+/*! \brief Set PLC on or off */
+void ast_rtp_set_plc(struct ast_rtp *rtp, int state);
/*! \brief Get RTP keepalive interval */
int ast_rtp_get_rtpkeepalive(struct ast_rtp *rtp);
/*! \brief Get rtp hold timeout */
Modified: team/group/pinefool-poor-mans-plc-1.4/main/rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pinefool-poor-mans-plc-1.4/main/rtp.c?view=diff&rev=383504&r1=383503&r2=383504
==============================================================================
--- team/group/pinefool-poor-mans-plc-1.4/main/rtp.c (original)
+++ team/group/pinefool-poor-mans-plc-1.4/main/rtp.c Thu Mar 21 03:57:18 2013
@@ -200,6 +200,7 @@
#define FLAG_CALLBACK_MODE (1 << 6)
#define FLAG_DTMF_COMPENSATE (1 << 7)
#define FLAG_HAS_STUN (1 << 8)
+#define FLAG_POORMANSPLC (1 << 9)
/*!
* \brief Structure defining an RTCP session.
@@ -562,6 +563,16 @@
rtp->rtpholdtimeout = timeout;
}
+/*! \brief set RTP PLC status */
+void ast_rtp_set_plc(struct ast_rtp *rtp, int state)
+{
+ if (state) {
+ ast_set_flag(rtp, FLAG_POORMANSPLC);
+ } else {
+ ast_clear_flag(rtp, FLAG_POORMANSPLC);
+ }
+}
+
/*! \brief set RTP keepalive interval */
void ast_rtp_set_rtpkeepalive(struct ast_rtp *rtp, int period)
{
@@ -1333,7 +1344,7 @@
rtp->cycles += RTP_SEQ_MOD;
if (rtp->rxcount > 1) {
- if (poormansplc && seqno < rtp->lastrxseqno) {
+ if (ast_test_flag(rtp, FLAG_POORMANSPLC) && seqno < rtp->lastrxseqno) {
/* This is a latecome we've already replaced. A jitter buffer would have handled this
properly, but in many cases we can't afford a jitterbuffer and will have to live
with the face that the poor man's PLC already has replaced this frame and we can't
@@ -1344,10 +1355,10 @@
}
lostpackets = (int) seqno - (int) rtp->lastrxseqno - 1;
/* RTP sequence numbers are consecutive. Have we lost a packet? */
- if (lostpackets) {
+ if (lostpackets && option_debug > 2) {
ast_log(LOG_DEBUG, "**** Packet loss detected - # %d. Current Seqno %-6.6u\n", lostpackets, seqno);
}
- if (poormansplc && rtp->plcbuf != NULL) {
+ if (ast_test_flag(rtp, FLAG_POORMANSPLC) && rtp->plcbuf != NULL) {
int i;
for (i = 0; i < lostpackets; i++) {
AST_LIST_INSERT_TAIL(&frames, ast_frdup(rtp->plcbuf), frame_list);
@@ -1463,7 +1474,7 @@
rtp->f.subclass |= 0x1;
}
rtp->f.src = "RTP";
- if (poormansplc) {
+ if (ast_test_flag(rtp, FLAG_POORMANSPLC)) {
/* Copy this frame to buffer */
if (rtp->plcbuf) {
/* We have something here. Take it away, dear Henry. */
@@ -2038,6 +2049,9 @@
rtp->seqno = ast_random() & 0xffff;
ast_set_flag(rtp, FLAG_HAS_DTMF);
rtp->plcbuf = NULL;
+ if (poormansplc) {
+ ast_set_flag(rtp, FLAG_POORMANSPLC);
+ }
return;
}
More information about the asterisk-commits
mailing list