Added configurable option to disable rtp receiving invalid sequence warn and put a message at level 9 instead.

git-svn-id: http://voip.null.ro/svn/yate@5665 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2013-10-10 14:38:42 +00:00
parent 153334dac8
commit 69a4fcca27
4 changed files with 43 additions and 11 deletions

View File

@ -65,6 +65,12 @@
; minsleep: int: Minimum allowed in-loop sleep time in milliseconds
;minsleep=1
; rtp_warn_seq: bool: Warn on receiving invalid RTP sequence number
; If disabled the log message will be put at level 9
; This parameter is applied on reload for new sessions only
; It can be overridden in initial chan.rtp message or chan.attach message
;rtp_warn_seq=enable
[timeouts]
; This section controls the behaviour when RTP and RTCP data is missing

View File

@ -231,7 +231,10 @@ void RTPReceiver::rtpData(const void* data, int len)
m_seq = seq;
m_ts = ts - m_tsLast;
m_seqCount = 0;
m_warn = true;
if (m_warnSeq > 0)
m_warn = true;
else
m_warnSeq = -1;
m_syncLost++;
if (m_dejitter)
m_dejitter->clear();
@ -245,9 +248,15 @@ void RTPReceiver::rtpData(const void* data, int len)
else
m_seqSync = seq;
}
if (m_warn) {
m_warn = false;
Debug(DebugWarn,"RTP received SEQ %u while current is %u [%p]",seq,m_seq,this);
if (m_warnSeq > 0) {
if (m_warn) {
m_warn = false;
Debug(DebugWarn,"RTP received SEQ %u while current is %u [%p]",seq,m_seq,this);
}
}
else if (m_warnSeq < 0) {
m_warnSeq = 0;
Debug(DebugInfo,"RTP received SEQ %u while current is %u [%p]",seq,m_seq,this);
}
return;
}
@ -656,7 +665,8 @@ RTPSession::RTPSession()
: Mutex(true,"RTPSession"),
m_direction(FullStop),
m_send(0), m_recv(0), m_secure(0),
m_reportTime(0), m_reportInterval(0)
m_reportTime(0), m_reportInterval(0),
m_warnSeq(1)
{
DDebug(DebugInfo,"RTPSession::RTPSession() [%p]",this);
}
@ -799,6 +809,8 @@ void RTPSession::receiver(RTPReceiver* recv)
m_recv = recv;
if (tmp)
delete tmp;
if (m_recv)
m_recv->m_warnSeq = m_warnSeq;
}
void RTPSession::security(RTPSecure* secure)

View File

@ -612,7 +612,7 @@ public:
inline RTPReceiver(RTPSession* session = 0)
: RTPBaseIO(session),
m_ioLostPkt(0), m_dejitter(0),
m_seqSync(0), m_seqCount(0), m_warn(true),
m_seqSync(0), m_seqCount(0), m_warn(true), m_warnSeq(1),
m_seqLost(0), m_wrongSSRC(0), m_syncLost(0)
{ }
@ -747,6 +747,7 @@ private:
u_int16_t m_seqSync;
u_int16_t m_seqCount;
bool m_warn;
int m_warnSeq; // Warn on invalid sequence (1: DebugWarn, -1: DebugInfo)
unsigned int m_seqLost;
unsigned int m_wrongSSRC;
unsigned int m_syncLost;
@ -1295,6 +1296,14 @@ public:
*/
virtual void incWrongSrc();
/**
* Set the packet with invalid sequence warn mode
* @param on True to show a message at DebugWarn level,
* false to show at DebugInfo level
*/
inline void setWarnSeq(bool on)
{ m_warnSeq = on ? 1 : -1; }
protected:
/**
* Method called periodically to push any asynchronous data or statistics
@ -1320,6 +1329,7 @@ private:
RTPSecure* m_secure;
u_int64_t m_reportTime;
u_int64_t m_reportInterval;
int m_warnSeq; // Warn on invalid sequence (1: DebugWarn, -1: DebugInfo)
};
/**

View File

@ -159,7 +159,7 @@ public:
static YRTPWrapper* find(const String& id);
static void guessLocal(const char* remoteip, String& localip);
private:
void setupRTP(const char* localip, bool rtcp);
void setupRTP(const char* localip, bool rtcp, bool warnSeq);
void setupUDPTL(const char* localip, u_int16_t maxLen = 250, u_int8_t maxSec = 2);
bool bindLocal(const char* localip, bool rtcp);
bool startRTP(const char* raddr, unsigned int rport, Message& msg);
@ -389,6 +389,7 @@ static ObjList s_mirrors;
static Mutex s_mutex(false,"YRTPChan");
static Mutex s_refMutex(false,"YRTPChan::reflect");
static Mutex s_srcMutex(false,"YRTPChan::source");
static bool s_rtpWarnSeq = true; // Warn on invalid rtp sequence number
YRTPWrapper::YRTPWrapper(const char* localip, CallEndpoint* conn, const char* media, RTPSession::Direction direction, Message& msg, bool udptl)
@ -422,7 +423,8 @@ YRTPWrapper::YRTPWrapper(const char* localip, CallEndpoint* conn, const char* me
setupUDPTL(localip,md,ms);
}
else
setupRTP(localip,msg.getBoolValue(YSTRING("rtcp"),s_rtcp));
setupRTP(localip,msg.getBoolValue(YSTRING("rtcp"),s_rtcp),
msg.getBoolValue(YSTRING("rtp_warn_seq"),s_rtpWarnSeq));
splugin.changed();
s_mutex.unlock();
}
@ -502,11 +504,12 @@ YRTPWrapper* YRTPWrapper::find(const String& id)
return 0;
}
void YRTPWrapper::setupRTP(const char* localip, bool rtcp)
void YRTPWrapper::setupRTP(const char* localip, bool rtcp, bool warnSeq)
{
Debug(&splugin,DebugAll,"YRTPWrapper::setupRTP(\"%s\",%s) [%p]",
localip,String::boolText(rtcp),this);
Debug(&splugin,DebugAll,"YRTPWrapper::setupRTP(\"%s\",%s,%s) [%p]",
localip,String::boolText(rtcp),String::boolText(warnSeq),this);
m_rtp = new YRTPSession(this);
m_rtp->setWarnSeq(warnSeq);
m_rtp->initTransport();
bindLocal(localip,rtcp);
}
@ -1853,6 +1856,7 @@ void YRTPPlugin::initialize()
s_sleep = cfg.getIntValue("general","defsleep",5);
RTPGroup::setMinSleep(cfg.getIntValue("general","minsleep"));
s_priority = Thread::priority(cfg.getValue("general","thread"));
s_rtpWarnSeq = cfg.getBoolValue("general","rtp_warn_seq",true);
s_timeout = cfg.getIntValue("timeouts","timeout",3000);
s_udptlTimeout = cfg.getIntValue("timeouts","udptl_timeout",25000);
s_notifyMsg = cfg.getValue("timeouts","notifymsg");