opalvoip-svn Mailing List for OpalVOIP (Page 13)
Brought to you by:
csoutheren,
rjongbloed
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(71) |
Nov
(241) |
Dec
(143) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(210) |
Feb
(263) |
Mar
(214) |
Apr
(290) |
May
(203) |
Jun
(160) |
Jul
(128) |
Aug
(158) |
Sep
(376) |
Oct
(234) |
Nov
(227) |
Dec
(216) |
2009 |
Jan
(99) |
Feb
(151) |
Mar
(234) |
Apr
(143) |
May
(271) |
Jun
(244) |
Jul
(173) |
Aug
(124) |
Sep
(246) |
Oct
(178) |
Nov
(85) |
Dec
(77) |
2010 |
Jan
(101) |
Feb
(79) |
Mar
(92) |
Apr
(134) |
May
(125) |
Jun
(121) |
Jul
(61) |
Aug
(70) |
Sep
(86) |
Oct
(81) |
Nov
(65) |
Dec
(75) |
2011 |
Jan
(110) |
Feb
(119) |
Mar
(267) |
Apr
(154) |
May
(296) |
Jun
(177) |
Jul
(149) |
Aug
(124) |
Sep
(120) |
Oct
(116) |
Nov
(99) |
Dec
(121) |
2012 |
Jan
(78) |
Feb
(161) |
Mar
(323) |
Apr
(154) |
May
(190) |
Jun
(207) |
Jul
(176) |
Aug
(165) |
Sep
(137) |
Oct
(85) |
Nov
(112) |
Dec
(100) |
2013 |
Jan
(341) |
Feb
(102) |
Mar
(240) |
Apr
(216) |
May
(233) |
Jun
(226) |
Jul
(139) |
Aug
(192) |
Sep
(183) |
Oct
(211) |
Nov
(220) |
Dec
(110) |
2014 |
Jan
(203) |
Feb
(205) |
Mar
(100) |
Apr
(178) |
May
(194) |
Jun
(249) |
Jul
(136) |
Aug
(241) |
Sep
(226) |
Oct
(200) |
Nov
(94) |
Dec
(46) |
2015 |
Jan
(94) |
Feb
(74) |
Mar
(89) |
Apr
(78) |
May
(65) |
Jun
(70) |
Jul
(113) |
Aug
(176) |
Sep
(140) |
Oct
(154) |
Nov
(99) |
Dec
(115) |
2016 |
Jan
(102) |
Feb
(69) |
Mar
(97) |
Apr
(53) |
May
(42) |
Jun
(13) |
Jul
(42) |
Aug
(30) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <rjo...@us...> - 2016-02-16 10:06:33
|
Revision: 34626 http://sourceforge.net/p/opalvoip/code/34626 Author: rjongbloed Date: 2016-02-16 10:06:31 +0000 (Tue, 16 Feb 2016) Log Message: ----------- Export version number handling, including SVN/GIT info. Modified Paths: -------------- ptlib/trunk/include/ptlib/pprocess.h ptlib/trunk/src/ptlib/common/osutils.cxx Modified: ptlib/trunk/include/ptlib/pprocess.h =================================================================== --- ptlib/trunk/include/ptlib/pprocess.h 2016-02-14 16:00:42 UTC (rev 34625) +++ ptlib/trunk/include/ptlib/pprocess.h 2016-02-16 10:06:31 UTC (rev 34626) @@ -543,6 +543,20 @@ String for library version. */ static PString GetLibVersion(); + + /// Version information + struct VersionInfo + { + unsigned m_major; + unsigned m_minor; + CodeStatus m_status; + unsigned m_build; + unsigned m_svn; + const char * m_git; + + /// Build standard format string from version information + PString AsString(bool full = true); + }; //@} /**Internal initialisation function called directly from Modified: ptlib/trunk/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-14 16:00:42 UTC (rev 34625) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-16 10:06:31 UTC (rev 34626) @@ -2448,38 +2448,43 @@ } -static const char * const GetVersionStatus(PProcess::CodeStatus status) +PString PProcess::GetVersion(PBoolean full) const { - switch (status) { - case PProcess::AlphaCode : - return "alpha"; - case PProcess::BetaCode : - return "beta"; - default: - return "."; - } + VersionInfo ver = { MAJOR_VERSION, MINOR_VERSION, BUILD_TYPE, BUILD_NUMBER }; + return ver.AsString(full); } -PString PProcess::GetVersion(PBoolean full) const +PString PProcess::GetLibVersion() { - return psprintf(full ? "%u.%u%s%u" : "%u.%u", - majorVersion, minorVersion, GetVersionStatus(status), buildNumber); + VersionInfo ver = { MAJOR_VERSION, MINOR_VERSION, BUILD_TYPE, BUILD_NUMBER, SVN_REVISION, GIT_COMMIT }; + return ver.AsString(); } -PString PProcess::GetLibVersion() +PString PProcess::VersionInfo::AsString(bool full) { - PStringStream version; - version << MAJOR_VERSION << '.' << MINOR_VERSION << GetVersionStatus(BUILD_TYPE) << " ("; - static char const GitCommit[] = GIT_COMMIT; - if (GitCommit[0] != '\0') - version << "git:" << GitCommit; - else - version << "svn:" << SVN_REVISION; - version << ')'; - - return version; + PStringStream str; + str << m_major << '.' << m_minor; + + if (full) { + switch (m_status) { + case PProcess::AlphaCode : + str << "alpha"; + case PProcess::BetaCode : + str << "beta"; + default: + str << '.'; + } + str << " ("; + if (m_git != NULL && *m_git != '\0') + str << "git:" << m_git; + else if (m_svn > 0) + str << "svn:" << m_svn; + str << ')'; + } + + return str; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-14 16:00:44
|
Revision: 34625 http://sourceforge.net/p/opalvoip/code/34625 Author: rjongbloed Date: 2016-02-14 16:00:42 +0000 (Sun, 14 Feb 2016) Log Message: ----------- Merged revision(s) 34615-34624 from opal/branches/v3_16: --------------------- r34623 Fixed missing mutex in OpalAudioJitterBuffer::Restart() and removed redundant one in OpalAudioJitterBuffer::Reset(), then renamed Reset() to InternalReset() for tidiness sake. --------------------- r34620,r34621 Reset write unavailable errors when new media address is used. Prevents incorrect, early detection of errors to new host. --------------------- r34619 Allow for delay in getting remote address when NAT media mode is triggered during a transfer. --------------------- r34617 Added extra logging around closing media patch Revision Links: -------------- http://sourceforge.net/p/opalvoip/code/34623 http://sourceforge.net/p/opalvoip/code/34620 http://sourceforge.net/p/opalvoip/code/34621 http://sourceforge.net/p/opalvoip/code/34619 http://sourceforge.net/p/opalvoip/code/34617 Modified Paths: -------------- opal/trunk/include/rtp/jitter.h opal/trunk/src/opal/mediasession.cxx opal/trunk/src/opal/patch.cxx opal/trunk/src/rtp/jitter.cxx Property Changed: ---------------- opal/trunk/ Index: opal/trunk =================================================================== --- opal/trunk 2016-02-14 15:58:05 UTC (rev 34624) +++ opal/trunk 2016-02-14 16:00:42 UTC (rev 34625) Property changes on: opal/trunk ___________________________________________________________________ Modified: svn:mergeinfo ## -10,7 +10,7 ## /opal/branches/v3_10:25182-29485,30896,32927-32928,32933 /opal/branches/v3_12:28489-31709 /opal/branches/v3_14:31505-33613 -/opal/branches/v3_16:34090-34614 +/opal/branches/v3_16:34090-34624 /opal/branches/v3_2:21143,21220,21227,21253,21455 /opal/branches/v3_4:21060,21062,21088,21092,21111,21113,21115,21119,21143,21148,21151-21152,21155,21158,21184,21188,21253,21265-21266,21283-21284,21298,21300,21303,21307,21309,21311,21327,21331,21333,21359,21367,21369,21488,21556,21564-21565,21568,21570,21620,21625,21631,21748,21751,21756,21759,21761,21767,21770,22246,23044,23140,23143,23286 /opal/branches/v3_6:22169,22178,22184,22186,22197,22204,22216,22251,22253,22255,22258,22260,22291,22296,22300,22306,22308,22313,22319,22336,22353,22358,22436,22447,22449,22497,22511,22517,22519-22521,22527,22536,22538,22589,22596,22599,22617,22620,22622,22630,22640,22655,22675,22682,22726-22728,22730,22733,22738,22745-22746,22800,22820-22821,22842,22844-22845,22851,22853,22889,22896,22902,22904,22906,22918,22924,22928,22946,22965,22967,22976,22978,22980,22982,22994,23028,23123,23125-23126,23128,23157,23165,23173,23175,23183,23294,23341,23465,23467,23474,23521,23829,24346,24809 \ No newline at end of property Modified: opal/trunk/include/rtp/jitter.h =================================================================== --- opal/trunk/include/rtp/jitter.h 2016-02-14 15:58:05 UTC (rev 34624) +++ opal/trunk/include/rtp/jitter.h 2016-02-14 16:00:42 UTC (rev 34625) @@ -287,7 +287,7 @@ //@} protected: - void Reset(); + void InternalReset(); RTP_Timestamp CalculateRequiredTimestamp(RTP_Timestamp playOutTimestamp) const; bool AdjustCurrentJitterDelay(int delta); Modified: opal/trunk/src/opal/mediasession.cxx =================================================================== --- opal/trunk/src/opal/mediasession.cxx 2016-02-14 15:58:05 UTC (rev 34624) +++ opal/trunk/src/opal/mediasession.cxx 2016-02-14 16:00:42 UTC (rev 34625) @@ -948,6 +948,7 @@ socket->SetSendAddress(newAP); m_remoteAddressSet = true; + m_subchannels[subchannel].m_consecutiveUnavailableErrors = 0; // Prevent errors from previous address. if (m_localHasRestrictedNAT) { // If have Port Restricted NAT on local host then send a datagram @@ -1155,29 +1156,32 @@ if (PAssertNULL(socket) == NULL) return false; - bool writeSuccess = dest != NULL ? socket->WriteTo(data, length, *dest) : socket->Write(data, length); - // This insanity prevents a totally unbelievable CPU issue when under heavy load. - if (writeSuccess) - return true; + PIPSocketAddressAndPort sendAddr; + if (dest != NULL) + sendAddr = *dest; + else + socket->GetSendAddress(sendAddr); + if (sendAddr.IsValid()) { + if (socket->WriteTo(data, length, sendAddr)) + return true; + } + else { + PTRACE(4, "UDP write has no destination address."); + /* The following makes not having destination address yet be processed the + same as if the remote is not yet listening on the port (ICMP errors) so it + will keep trying for a while, then give up and close the media transport. */ + socket->SetErrorValues(PChannel::Unavailable, EINVAL, PChannel::LastWriteError); + } + if (socket->GetErrorCode(PChannel::LastWriteError) == PChannel::Unavailable && m_subchannels[subchannel].HandleUnavailableError()) return true; -#if PTRACING - if (PTrace::CanTrace(1)) { - ostream & trace = PTRACE_BEGIN(1); - trace << *this << "error writing to "; - if (dest != NULL) - trace << *dest; - else - trace << socket->GetSendAddress(); - trace << " (" << length << " bytes)" - " on " << subchannel << " subchannel" - " (" << socket->GetErrorNumber(PChannel::LastWriteError) << "):" - " " << socket->GetErrorText(PChannel::LastWriteError) - << PTrace::End; - } -#endif + PTRACE(1, *this << "error writing to " << sendAddr + << " (" << length << " bytes)" + " on " << subchannel << " subchannel" + " (" << socket->GetErrorNumber(PChannel::LastWriteError) << "):" + " " << socket->GetErrorText(PChannel::LastWriteError)); return false; } Modified: opal/trunk/src/opal/patch.cxx =================================================================== --- opal/trunk/src/opal/patch.cxx 2016-02-14 15:58:05 UTC (rev 34624) +++ opal/trunk/src/opal/patch.cxx 2016-02-14 16:00:42 UTC (rev 34625) @@ -814,10 +814,12 @@ m_source.OnStopMediaPatch(*this); - if (m_sinks.IsEmpty()) - m_source.GetConnection().GetEndPoint().GetManager().QueueDecoupledEvent( + if (m_sinks.IsEmpty()) { + PTRACE(4, "Closing source media stream as no sinks in " << *this); + m_source.GetConnection().GetEndPoint().GetManager().QueueDecoupledEvent( new PSafeWorkArg1<OpalConnection, OpalMediaStreamPtr, bool>(&m_source.GetConnection(), &m_source, &OpalConnection::CloseMediaStream)); + } PTRACE(4, "Thread ended for " << *this); } Modified: opal/trunk/src/rtp/jitter.cxx =================================================================== --- opal/trunk/src/rtp/jitter.cxx 2016-02-14 15:58:05 UTC (rev 34624) +++ opal/trunk/src/rtp/jitter.cxx 2016-02-14 16:00:42 UTC (rev 34625) @@ -295,7 +295,7 @@ , m_lastRemoveTick(m_lastInsertTick) #endif { - Reset(); + InternalReset(); PTRACE(std::min(sm_EveryPacketLogLevel,4U), "Audio buffer created:" << *this); } @@ -319,9 +319,12 @@ void OpalAudioJitterBuffer::Restart() { - m_frameCount.Reset(); - Reset(); + m_bufferMutex.Wait(); + + InternalReset(); m_closed = false; + + m_bufferMutex.Signal(); } @@ -362,16 +365,14 @@ PTRACE(std::min(sm_EveryPacketLogLevel,3U), "Delays set to " << *this); - Reset(); + InternalReset(); m_bufferMutex.Signal(); } -void OpalAudioJitterBuffer::Reset() +void OpalAudioJitterBuffer::InternalReset() { - m_bufferMutex.Wait(); - m_frameTimeCount = 0; m_frameTimeSum = 0; m_packetTime = 0; @@ -389,8 +390,7 @@ m_synchronisationState = e_SynchronisationStart; m_frames.clear(); - - m_bufferMutex.Signal(); + m_frameCount.Reset(); } @@ -415,7 +415,7 @@ PTRACE_IF(std::min(sm_EveryPacketLogLevel,4U), m_lastSyncSource != 0, "Buffer reset due to SSRC change from " << RTP_TRACE_SRC(m_lastSyncSource) << " to " << RTP_TRACE_SRC(newSyncSource) << " at sn=" << currentSequenceNum); - Reset(); + InternalReset(); m_packetsTooLate = m_bufferOverruns = 0; // Reset these stats for new SSRC m_lastSyncSource = newSyncSource; } @@ -427,7 +427,7 @@ if (m_consecutiveMarkerBits < m_maxConsecutiveMarkerBits) { if (frame.GetMarker()) { m_consecutiveMarkerBits++; - Reset(); + InternalReset(); // Have been told there is explicit silence by marker, take opportunity // to reduce the current jitter delay. @@ -454,7 +454,7 @@ if (timestamp < m_lastTimestamp) { PTRACE(std::min(sm_EveryPacketLogLevel,3U), "Timestamps abruptly changed from " << m_lastTimestamp << " to " << timestamp << ", resynching"); - Reset(); + InternalReset(); } else if (m_lastSequenceNum+1 == currentSequenceNum) { RTP_Timestamp delta = timestamp - m_lastTimestamp; @@ -506,7 +506,7 @@ PTRACE(std::min(sm_EveryPacketLogLevel,4U), "Buffer overflow : ts=" << timestamp << ", delta=" << delta << ", size=" << m_frames.size()); if (++m_consecutiveOverflows > (m_packetTime == 0 ? AverageFrameTimePackets : MaxConsecutiveOverflows)) { PTRACE(2, "Consecutive overflow packets, resynching"); - Reset(); + InternalReset(); } return true; } @@ -698,7 +698,7 @@ while (requiredTimestamp >= oldestFrame->first + m_packetTime) { if (++m_consecutiveLatePackets > 10) { PTRACE(std::min(sm_EveryPacketLogLevel,3U), "Too many late " COMMON_TRACE_INFO); - Reset(); + InternalReset(); return true; } @@ -764,7 +764,7 @@ if (requiredTimestamp < oldestFrame->first) { if (oldestFrame->first - requiredTimestamp > m_timeUnits*1000) { PTRACE(std::min(sm_EveryPacketLogLevel,3U), "Too far in ahead" COMMON_TRACE_INFO); - Reset(); + InternalReset(); } else { PTRACE(sm_EveryPacketLogLevel, "Packet not ready" COMMON_TRACE_INFO << ", oldest=" << oldestFrame->first); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-14 15:58:08
|
Revision: 34624 http://sourceforge.net/p/opalvoip/code/34624 Author: rjongbloed Date: 2016-02-14 15:58:05 +0000 (Sun, 14 Feb 2016) Log Message: ----------- Merged revision(s) 34578-34623 from ptlib/branches/v2_16: --------------------- r34622 FIxed incorrect assert when PSemaphire::Reset() called at sufficient thread load. --------------------- r34618 Added better error reporting if attempting to write to UDP port with illegal send address. --------------------- r34616 Allow VXML to accept data if get timeout with acceptable number of digits. Thanks Marco Rullo. Revision Links: -------------- http://sourceforge.net/p/opalvoip/code/34622 http://sourceforge.net/p/opalvoip/code/34618 http://sourceforge.net/p/opalvoip/code/34616 Modified Paths: -------------- ptlib/trunk/include/ptclib/vxml.h ptlib/trunk/src/ptclib/vxml.cxx ptlib/trunk/src/ptlib/common/sockets.cxx ptlib/trunk/src/ptlib/msos/win32.cxx Property Changed: ---------------- ptlib/trunk/ Index: ptlib/trunk =================================================================== --- ptlib/trunk 2016-02-14 15:55:59 UTC (rev 34623) +++ ptlib/trunk 2016-02-14 15:58:05 UTC (rev 34624) Property changes on: ptlib/trunk ___________________________________________________________________ Modified: svn:mergeinfo ## -6,7 +6,7 ## /ptlib/branches/v2_10:25177-29189,32921,32947 /ptlib/branches/v2_12:28485-31603 /ptlib/branches/v2_14:31501-33720 -/ptlib/branches/v2_16:34085-34577 +/ptlib/branches/v2_16:34085-34623 /ptlib/branches/v2_2:20746,20791,20827,22014,22942 /ptlib/branches/v2_4:21086,21094,21147,21160,21185,21281,21296,21305,21322,21337,21363,21467,21471-21472,21506,21508,21623,21695,21744,21746,21763,22241,22958,23045-23046,23061,23066,23712 /ptlib/branches/v2_6:22195,22243,22295,22304,22311,22317,22320,22356,22458,22509,22587,22601-22602,22611,22629,22633,22673,22681,22729,22731-22732,22736,22742,22848,22960,22992,23161,23163,23167,23169,23177,23239,23291,23298,23336,23429,23595,23823,23827,23873,24816 \ No newline at end of property Modified: ptlib/trunk/include/ptclib/vxml.h =================================================================== --- ptlib/trunk/include/ptclib/vxml.h 2016-02-14 15:55:59 UTC (rev 34623) +++ ptlib/trunk/include/ptclib/vxml.h 2016-02-14 15:58:05 UTC (rev 34624) @@ -87,6 +87,8 @@ protected: PDECLARE_NOTIFIER(PTimer, PVXMLGrammar, OnTimeout); + virtual bool IsFilled() { return false; } + PVXMLSession & m_session; PXMLElement & m_field; PString m_value; @@ -125,6 +127,8 @@ virtual void OnUserInput(const char ch); + virtual bool IsFilled(); + protected: PINDEX m_minDigits; PINDEX m_maxDigits; Modified: ptlib/trunk/src/ptclib/vxml.cxx =================================================================== --- ptlib/trunk/src/ptclib/vxml.cxx 2016-02-14 15:55:59 UTC (rev 34623) +++ ptlib/trunk/src/ptclib/vxml.cxx 2016-02-14 15:58:05 UTC (rev 34624) @@ -2377,11 +2377,11 @@ void PVXMLGrammar::OnTimeout(PTimer &, P_INT_PTR) { - PTRACE(3, "VXML\tTimeout for grammar " << *this); + PTRACE(3, "VXML\tTimeout for grammar " << *this ); m_mutex.Wait(); if (m_state == Started) { - m_state = NoInput; + m_state = IsFilled() ? Filled : NoInput; m_session.Trigger(); } @@ -2484,21 +2484,32 @@ if (m_state != Started) return; - PINDEX len = m_value.GetLength(); - // is this char the terminator? if (m_terminators.Find(ch) != P_MAX_INDEX) { - m_state = (len >= m_minDigits && len <= m_maxDigits) ? Filled : NoMatch; + m_state = IsFilled() ? Filled : NoMatch; return; } // Otherwise add to the grammar and check to see if we're done + PINDEX len = m_value.GetLength(); + m_value += ch; if (++len >= m_maxDigits) m_state = PVXMLGrammar::Filled; // the grammar is filled! } +bool PVXMLDigitsGrammar::IsFilled() +{ + PINDEX len = m_value.GetLength(); + bool filled = len >= m_minDigits && len <= m_maxDigits; + PTRACE(4, "VXML\t Grammar " << *this << + (filled ? " has been FILLED" : " has NOT yet been filled" ) + << ". Collected value=" << m_value << ", length: " << len << ", while min=" << m_minDigits << " max=" << m_maxDigits); + + return filled; +} + ////////////////////////////////////////////////////////////////// PVXMLChannel::PVXMLChannel(unsigned frameDelay, PINDEX frameSize) Modified: ptlib/trunk/src/ptlib/common/sockets.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/sockets.cxx 2016-02-14 15:55:59 UTC (rev 34623) +++ ptlib/trunk/src/ptlib/common/sockets.cxx 2016-02-14 15:58:05 UTC (rev 34624) @@ -2469,12 +2469,14 @@ { SetLastWriteCount(0); + if (CheckNotOpen()) + return false; + const PIPSocket::Address & addr = ipAndPort.GetAddress(); WORD port = ipAndPort.GetPort(); + if (!addr.IsValid() || port == 0) + return SetErrorValues(BadParameter, EINVAL, LastWriteError); - if (CheckNotOpen()) - return false; - PBoolean broadcast = addr.IsAny() || addr.IsBroadcast(); if (broadcast) { #ifdef P_BEOS Modified: ptlib/trunk/src/ptlib/msos/win32.cxx =================================================================== --- ptlib/trunk/src/ptlib/msos/win32.cxx 2016-02-14 15:55:59 UTC (rev 34623) +++ ptlib/trunk/src/ptlib/msos/win32.cxx 2016-02-14 15:58:05 UTC (rev 34624) @@ -1734,9 +1734,8 @@ void PSemaphore::Signal() { - if (!ReleaseSemaphore(m_handle, 1, NULL)) - PAssertOS(::GetLastError() != ERROR_INVALID_HANDLE); - SetLastError(ERROR_SUCCESS); + if (PAssertOS(ReleaseSemaphore(m_handle, 1, NULL) || ::GetLastError() == ERROR_INVALID_HANDLE)) + SetLastError(ERROR_SUCCESS); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-14 15:56:01
|
Revision: 34623 http://sourceforge.net/p/opalvoip/code/34623 Author: rjongbloed Date: 2016-02-14 15:55:59 +0000 (Sun, 14 Feb 2016) Log Message: ----------- Fixed missing mutex in OpalAudioJitterBuffer::Restart() and removed redundant one in OpalAudioJitterBuffer::Reset(), then renamed Reset() to InternalReset() for tidiness sake. Modified Paths: -------------- opal/branches/v3_16/include/rtp/jitter.h opal/branches/v3_16/src/rtp/jitter.cxx Modified: opal/branches/v3_16/include/rtp/jitter.h =================================================================== --- opal/branches/v3_16/include/rtp/jitter.h 2016-02-14 15:52:45 UTC (rev 34622) +++ opal/branches/v3_16/include/rtp/jitter.h 2016-02-14 15:55:59 UTC (rev 34623) @@ -287,7 +287,7 @@ //@} protected: - void Reset(); + void InternalReset(); RTP_Timestamp CalculateRequiredTimestamp(RTP_Timestamp playOutTimestamp) const; bool AdjustCurrentJitterDelay(int delta); Modified: opal/branches/v3_16/src/rtp/jitter.cxx =================================================================== --- opal/branches/v3_16/src/rtp/jitter.cxx 2016-02-14 15:52:45 UTC (rev 34622) +++ opal/branches/v3_16/src/rtp/jitter.cxx 2016-02-14 15:55:59 UTC (rev 34623) @@ -295,7 +295,7 @@ , m_lastRemoveTick(m_lastInsertTick) #endif { - Reset(); + InternalReset(); PTRACE(std::min(sm_EveryPacketLogLevel,4U), "Audio buffer created:" << *this); } @@ -319,9 +319,12 @@ void OpalAudioJitterBuffer::Restart() { - m_frameCount.Reset(); - Reset(); + m_bufferMutex.Wait(); + + InternalReset(); m_closed = false; + + m_bufferMutex.Signal(); } @@ -362,16 +365,14 @@ PTRACE(std::min(sm_EveryPacketLogLevel,3U), "Delays set to " << *this); - Reset(); + InternalReset(); m_bufferMutex.Signal(); } -void OpalAudioJitterBuffer::Reset() +void OpalAudioJitterBuffer::InternalReset() { - m_bufferMutex.Wait(); - m_frameTimeCount = 0; m_frameTimeSum = 0; m_packetTime = 0; @@ -389,8 +390,7 @@ m_synchronisationState = e_SynchronisationStart; m_frames.clear(); - - m_bufferMutex.Signal(); + m_frameCount.Reset(); } @@ -415,7 +415,7 @@ PTRACE_IF(std::min(sm_EveryPacketLogLevel,4U), m_lastSyncSource != 0, "Buffer reset due to SSRC change from " << RTP_TRACE_SRC(m_lastSyncSource) << " to " << RTP_TRACE_SRC(newSyncSource) << " at sn=" << currentSequenceNum); - Reset(); + InternalReset(); m_lastSyncSource = newSyncSource; } @@ -426,7 +426,7 @@ if (m_consecutiveMarkerBits < m_maxConsecutiveMarkerBits) { if (frame.GetMarker()) { m_consecutiveMarkerBits++; - Reset(); + InternalReset(); // Have been told there is explicit silence by marker, take opportunity // to reduce the current jitter delay. @@ -453,7 +453,7 @@ if (timestamp < m_lastTimestamp) { PTRACE(std::min(sm_EveryPacketLogLevel,3U), "Timestamps abruptly changed from " << m_lastTimestamp << " to " << timestamp << ", resynching"); - Reset(); + InternalReset(); } else if (m_lastSequenceNum+1 == currentSequenceNum) { RTP_Timestamp delta = timestamp - m_lastTimestamp; @@ -505,7 +505,7 @@ PTRACE(std::min(sm_EveryPacketLogLevel,4U), "Buffer overflow : ts=" << timestamp << ", delta=" << delta << ", size=" << m_frames.size()); if (++m_consecutiveOverflows > (m_packetTime == 0 ? AverageFrameTimePackets : MaxConsecutiveOverflows)) { PTRACE(2, "Consecutive overflow packets, resynching"); - Reset(); + InternalReset(); } return true; } @@ -697,7 +697,7 @@ while (requiredTimestamp >= oldestFrame->first + m_packetTime) { if (++m_consecutiveLatePackets > 10) { PTRACE(std::min(sm_EveryPacketLogLevel,3U), "Too many late " COMMON_TRACE_INFO); - Reset(); + InternalReset(); return true; } @@ -763,7 +763,7 @@ if (requiredTimestamp < oldestFrame->first) { if (oldestFrame->first - requiredTimestamp > m_timeUnits*1000) { PTRACE(std::min(sm_EveryPacketLogLevel,3U), "Too far in ahead" COMMON_TRACE_INFO); - Reset(); + InternalReset(); } else { PTRACE(sm_EveryPacketLogLevel, "Packet not ready" COMMON_TRACE_INFO << ", oldest=" << oldestFrame->first); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-14 15:52:48
|
Revision: 34622 http://sourceforge.net/p/opalvoip/code/34622 Author: rjongbloed Date: 2016-02-14 15:52:45 +0000 (Sun, 14 Feb 2016) Log Message: ----------- FIxed incorrect assert when PSemaphire::Reset() called at sufficient thread load. Modified Paths: -------------- ptlib/branches/v2_16/src/ptlib/msos/win32.cxx Modified: ptlib/branches/v2_16/src/ptlib/msos/win32.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/msos/win32.cxx 2016-02-14 15:51:31 UTC (rev 34621) +++ ptlib/branches/v2_16/src/ptlib/msos/win32.cxx 2016-02-14 15:52:45 UTC (rev 34622) @@ -1734,9 +1734,8 @@ void PSemaphore::Signal() { - if (!ReleaseSemaphore(m_handle, 1, NULL)) - PAssertOS(::GetLastError() != ERROR_INVALID_HANDLE); - SetLastError(ERROR_SUCCESS); + if (PAssertOS(ReleaseSemaphore(m_handle, 1, NULL) || ::GetLastError() == ERROR_INVALID_HANDLE)) + SetLastError(ERROR_SUCCESS); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-14 15:51:33
|
Revision: 34621 http://sourceforge.net/p/opalvoip/code/34621 Author: rjongbloed Date: 2016-02-14 15:51:31 +0000 (Sun, 14 Feb 2016) Log Message: ----------- Fixed stupid error in previous commit. Modified Paths: -------------- opal/branches/v3_16/src/opal/mediasession.cxx Modified: opal/branches/v3_16/src/opal/mediasession.cxx =================================================================== --- opal/branches/v3_16/src/opal/mediasession.cxx 2016-02-14 14:19:29 UTC (rev 34620) +++ opal/branches/v3_16/src/opal/mediasession.cxx 2016-02-14 15:51:31 UTC (rev 34621) @@ -1161,7 +1161,7 @@ else socket->GetSendAddress(sendAddr); - if (dest->IsValid()) { + if (sendAddr.IsValid()) { if (socket->WriteTo(data, length, sendAddr)) return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-14 14:19:32
|
Revision: 34620 http://sourceforge.net/p/opalvoip/code/34620 Author: rjongbloed Date: 2016-02-14 14:19:29 +0000 (Sun, 14 Feb 2016) Log Message: ----------- Reset write unavailable errors when new media address is used. Prevents incorrect, early detection of errors to new host. Modified Paths: -------------- opal/branches/v3_16/src/opal/mediasession.cxx Modified: opal/branches/v3_16/src/opal/mediasession.cxx =================================================================== --- opal/branches/v3_16/src/opal/mediasession.cxx 2016-02-14 14:04:19 UTC (rev 34619) +++ opal/branches/v3_16/src/opal/mediasession.cxx 2016-02-14 14:19:29 UTC (rev 34620) @@ -951,6 +951,7 @@ socket->SetSendAddress(newAP); m_remoteAddressSet = true; + m_subchannels[subchannel].m_consecutiveUnavailableErrors = 0; // Prevent errors from previous address. if (m_localHasRestrictedNAT) { // If have Port Restricted NAT on local host then send a datagram This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-14 14:04:22
|
Revision: 34619 http://sourceforge.net/p/opalvoip/code/34619 Author: rjongbloed Date: 2016-02-14 14:04:19 +0000 (Sun, 14 Feb 2016) Log Message: ----------- Allow for delay in getting remote address when NAT media mode is triggered during a transfer. Modified Paths: -------------- opal/branches/v3_16/src/opal/mediasession.cxx Modified: opal/branches/v3_16/src/opal/mediasession.cxx =================================================================== --- opal/branches/v3_16/src/opal/mediasession.cxx 2016-02-14 13:52:24 UTC (rev 34618) +++ opal/branches/v3_16/src/opal/mediasession.cxx 2016-02-14 14:04:19 UTC (rev 34619) @@ -1154,29 +1154,32 @@ if (PAssertNULL(socket) == NULL) return false; - bool writeSuccess = dest != NULL ? socket->WriteTo(data, length, *dest) : socket->Write(data, length); - // This insanity prevents a totally unbelievable CPU issue when under heavy load. - if (writeSuccess) - return true; + PIPSocketAddressAndPort sendAddr; + if (dest != NULL) + sendAddr = *dest; + else + socket->GetSendAddress(sendAddr); + if (dest->IsValid()) { + if (socket->WriteTo(data, length, sendAddr)) + return true; + } + else { + PTRACE(4, "UDP write has no destination address."); + /* The following makes not having destination address yet be processed the + same as if the remote is not yet listening on the port (ICMP errors) so it + will keep trying for a while, then give up and close the media transport. */ + socket->SetErrorValues(PChannel::Unavailable, EINVAL, PChannel::LastWriteError); + } + if (socket->GetErrorCode(PChannel::LastWriteError) == PChannel::Unavailable && m_subchannels[subchannel].HandleUnavailableError()) return true; -#if PTRACING - if (PTrace::CanTrace(1)) { - ostream & trace = PTRACE_BEGIN(1); - trace << *this << "error writing to "; - if (dest != NULL) - trace << *dest; - else - trace << socket->GetSendAddress(); - trace << " (" << length << " bytes)" - " on " << subchannel << " subchannel" - " (" << socket->GetErrorNumber(PChannel::LastWriteError) << "):" - " " << socket->GetErrorText(PChannel::LastWriteError) - << PTrace::End; - } -#endif + PTRACE(1, *this << "error writing to " << sendAddr + << " (" << length << " bytes)" + " on " << subchannel << " subchannel" + " (" << socket->GetErrorNumber(PChannel::LastWriteError) << "):" + " " << socket->GetErrorText(PChannel::LastWriteError)); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-14 13:52:27
|
Revision: 34618 http://sourceforge.net/p/opalvoip/code/34618 Author: rjongbloed Date: 2016-02-14 13:52:24 +0000 (Sun, 14 Feb 2016) Log Message: ----------- Added better error reporting if attempting to write to UDP port with illegal send address. Modified Paths: -------------- ptlib/branches/v2_16/src/ptlib/common/sockets.cxx Modified: ptlib/branches/v2_16/src/ptlib/common/sockets.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/common/sockets.cxx 2016-02-14 12:44:41 UTC (rev 34617) +++ ptlib/branches/v2_16/src/ptlib/common/sockets.cxx 2016-02-14 13:52:24 UTC (rev 34618) @@ -2467,12 +2467,14 @@ { lastWriteCount = 0; + if (CheckNotOpen()) + return false; + const PIPSocket::Address & addr = ipAndPort.GetAddress(); WORD port = ipAndPort.GetPort(); + if (!addr.IsValid() || port == 0) + return SetErrorValues(BadParameter, EINVAL, LastWriteError); - if (CheckNotOpen()) - return false; - PBoolean broadcast = addr.IsAny() || addr.IsBroadcast(); if (broadcast) { #ifdef P_BEOS This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-14 12:44:44
|
Revision: 34617 http://sourceforge.net/p/opalvoip/code/34617 Author: rjongbloed Date: 2016-02-14 12:44:41 +0000 (Sun, 14 Feb 2016) Log Message: ----------- Added extra logging around closing media patch Modified Paths: -------------- opal/branches/v3_16/src/opal/patch.cxx Modified: opal/branches/v3_16/src/opal/patch.cxx =================================================================== --- opal/branches/v3_16/src/opal/patch.cxx 2016-02-14 12:40:00 UTC (rev 34616) +++ opal/branches/v3_16/src/opal/patch.cxx 2016-02-14 12:44:41 UTC (rev 34617) @@ -818,10 +818,12 @@ m_source.OnStopMediaPatch(*this); - if (m_sinks.IsEmpty()) - m_source.GetConnection().GetEndPoint().GetManager().QueueDecoupledEvent( + if (m_sinks.IsEmpty()) { + PTRACE(4, "Closing source media stream as no sinks in " << *this); + m_source.GetConnection().GetEndPoint().GetManager().QueueDecoupledEvent( new PSafeWorkArg1<OpalConnection, OpalMediaStreamPtr, bool>(&m_source.GetConnection(), &m_source, &OpalConnection::CloseMediaStream)); + } PTRACE(4, "Thread ended for " << *this); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-14 12:40:03
|
Revision: 34616 http://sourceforge.net/p/opalvoip/code/34616 Author: rjongbloed Date: 2016-02-14 12:40:00 +0000 (Sun, 14 Feb 2016) Log Message: ----------- Allow VXML to accept data if get timeout with acceptable number of digits. Thanks Marco Rullo. Modified Paths: -------------- ptlib/branches/v2_16/include/ptclib/vxml.h ptlib/branches/v2_16/src/ptclib/vxml.cxx Modified: ptlib/branches/v2_16/include/ptclib/vxml.h =================================================================== --- ptlib/branches/v2_16/include/ptclib/vxml.h 2016-02-10 19:14:51 UTC (rev 34615) +++ ptlib/branches/v2_16/include/ptclib/vxml.h 2016-02-14 12:40:00 UTC (rev 34616) @@ -87,6 +87,8 @@ protected: PDECLARE_NOTIFIER(PTimer, PVXMLGrammar, OnTimeout); + virtual bool IsFilled() { return false; } + PVXMLSession & m_session; PXMLElement & m_field; PString m_value; @@ -125,6 +127,8 @@ virtual void OnUserInput(const char ch); + virtual bool IsFilled(); + protected: PINDEX m_minDigits; PINDEX m_maxDigits; Modified: ptlib/branches/v2_16/src/ptclib/vxml.cxx =================================================================== --- ptlib/branches/v2_16/src/ptclib/vxml.cxx 2016-02-10 19:14:51 UTC (rev 34615) +++ ptlib/branches/v2_16/src/ptclib/vxml.cxx 2016-02-14 12:40:00 UTC (rev 34616) @@ -2377,11 +2377,11 @@ void PVXMLGrammar::OnTimeout(PTimer &, P_INT_PTR) { - PTRACE(3, "VXML\tTimeout for grammar " << *this); + PTRACE(3, "VXML\tTimeout for grammar " << *this ); m_mutex.Wait(); if (m_state == Started) { - m_state = NoInput; + m_state = IsFilled() ? Filled : NoInput; m_session.Trigger(); } @@ -2484,21 +2484,32 @@ if (m_state != Started) return; - PINDEX len = m_value.GetLength(); - // is this char the terminator? if (m_terminators.Find(ch) != P_MAX_INDEX) { - m_state = (len >= m_minDigits && len <= m_maxDigits) ? Filled : NoMatch; + m_state = IsFilled() ? Filled : NoMatch; return; } // Otherwise add to the grammar and check to see if we're done + PINDEX len = m_value.GetLength(); + m_value += ch; if (++len >= m_maxDigits) m_state = PVXMLGrammar::Filled; // the grammar is filled! } +bool PVXMLDigitsGrammar::IsFilled() +{ + PINDEX len = m_value.GetLength(); + bool filled = len >= m_minDigits && len <= m_maxDigits; + PTRACE(4, "VXML\t Grammar " << *this << + (filled ? " has been FILLED" : " has NOT yet been filled" ) + << ". Collected value=" << m_value << ", length: " << len << ", while min=" << m_minDigits << " max=" << m_maxDigits); + + return filled; +} + ////////////////////////////////////////////////////////////////// PVXMLChannel::PVXMLChannel(unsigned frameDelay, PINDEX frameSize) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-10 19:14:54
|
Revision: 34615 http://sourceforge.net/p/opalvoip/code/34615 Author: rjongbloed Date: 2016-02-10 19:14:51 +0000 (Wed, 10 Feb 2016) Log Message: ----------- Merged revision(s) 34603-34614 from opal/branches/v3_16: Changed no media timeout so is no media on ANY transport and not for ALL transports. Part 2. ........ Modified Paths: -------------- opal/trunk/src/opal/mediasession.cxx Property Changed: ---------------- opal/trunk/ Index: opal/trunk =================================================================== --- opal/trunk 2016-02-10 10:43:37 UTC (rev 34614) +++ opal/trunk 2016-02-10 19:14:51 UTC (rev 34615) Property changes on: opal/trunk ___________________________________________________________________ Modified: svn:mergeinfo ## -10,7 +10,7 ## /opal/branches/v3_10:25182-29485,30896,32927-32928,32933 /opal/branches/v3_12:28489-31709 /opal/branches/v3_14:31505-33613 -/opal/branches/v3_16:34090-34602 +/opal/branches/v3_16:34090-34614 /opal/branches/v3_2:21143,21220,21227,21253,21455 /opal/branches/v3_4:21060,21062,21088,21092,21111,21113,21115,21119,21143,21148,21151-21152,21155,21158,21184,21188,21253,21265-21266,21283-21284,21298,21300,21303,21307,21309,21311,21327,21331,21333,21359,21367,21369,21488,21556,21564-21565,21568,21570,21620,21625,21631,21748,21751,21756,21759,21761,21767,21770,22246,23044,23140,23143,23286 /opal/branches/v3_6:22169,22178,22184,22186,22197,22204,22216,22251,22253,22255,22258,22260,22291,22296,22300,22306,22308,22313,22319,22336,22353,22358,22436,22447,22449,22497,22511,22517,22519-22521,22527,22536,22538,22589,22596,22599,22617,22620,22622,22630,22640,22655,22675,22682,22726-22728,22730,22733,22738,22745-22746,22800,22820-22821,22842,22844-22845,22851,22853,22889,22896,22902,22904,22906,22918,22924,22928,22946,22965,22967,22976,22978,22980,22982,22994,23028,23123,23125-23126,23128,23157,23165,23173,23175,23183,23294,23341,23465,23467,23474,23521,23829,24346,24809 \ No newline at end of property Modified: opal/trunk/src/opal/mediasession.cxx =================================================================== --- opal/trunk/src/opal/mediasession.cxx 2016-02-10 10:43:37 UTC (rev 34614) +++ opal/trunk/src/opal/mediasession.cxx 2016-02-10 19:14:51 UTC (rev 34615) @@ -689,7 +689,8 @@ case PChannel::Timeout: PTRACE(1, m_owner, *m_owner << m_subchannel << " timed out (" << m_channel->GetReadTimeout() << "s)"); - Close(); + if (!m_owner->m_mediaTimer.IsRunning()) + Close(); break; default: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-10 10:43:40
|
Revision: 34614 http://sourceforge.net/p/opalvoip/code/34614 Author: rjongbloed Date: 2016-02-10 10:43:37 +0000 (Wed, 10 Feb 2016) Log Message: ----------- Increase log level for when out of order delay is increased. Modified Paths: -------------- opal/trunk/src/rtp/rtp_session.cxx Modified: opal/trunk/src/rtp/rtp_session.cxx =================================================================== --- opal/trunk/src/rtp/rtp_session.cxx 2016-02-09 18:03:31 UTC (rev 34613) +++ opal/trunk/src/rtp/rtp_session.cxx 2016-02-10 10:43:37 UTC (rev 34614) @@ -572,7 +572,7 @@ if (running && ++m_lateOutOfOrderAdaptCount >= m_lateOutOfOrderAdaptMax) { PTimeInterval timeout = m_session.GetOutOfOrderWaitTime() + m_lateOutOfOrderAdaptBoost; m_session.SetOutOfOrderWaitTime(timeout); - PTRACE(3, &m_session, *this << " increased out of order packet timeout to " << timeout); + PTRACE(2, &m_session, *this << " increased out of order packet timeout to " << timeout); running = false; } if (!running) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-09 18:03:34
|
Revision: 34613 http://sourceforge.net/p/opalvoip/code/34613 Author: rjongbloed Date: 2016-02-09 18:03:31 +0000 (Tue, 09 Feb 2016) Log Message: ----------- Changed no media timeout so is no media on ANY transport and not for ALL transports. Part 2. Modified Paths: -------------- opal/branches/v3_16/src/opal/mediasession.cxx Modified: opal/branches/v3_16/src/opal/mediasession.cxx =================================================================== --- opal/branches/v3_16/src/opal/mediasession.cxx 2016-02-09 15:43:37 UTC (rev 34612) +++ opal/branches/v3_16/src/opal/mediasession.cxx 2016-02-09 18:03:31 UTC (rev 34613) @@ -694,7 +694,8 @@ case PChannel::Timeout: PTRACE(1, m_owner, *m_owner << m_subchannel << " timed out (" << m_channel->GetReadTimeout() << "s)"); - Close(); + if (!m_owner->m_mediaTimer.IsRunning()) + Close(); break; default: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-09 15:43:40
|
Revision: 34612 http://sourceforge.net/p/opalvoip/code/34612 Author: rjongbloed Date: 2016-02-09 15:43:37 +0000 (Tue, 09 Feb 2016) Log Message: ----------- Back ported missing other half of merged revision(s) 34581,34584 from ptlib/trunk: --------------------- Fixed race condition when stopping timer, especially form destructor, where if it times out and the callback function starts the timer again. --------------------- Added fail safe assert so PTimer::Stop() cannot possibly get into endless loop, no matter how unlikely. ........ Modified Paths: -------------- ptlib/branches/v2_16/src/ptlib/common/osutils.cxx Modified: ptlib/branches/v2_16/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-02-09 15:02:25 UTC (rev 34611) +++ ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-02-09 15:43:37 UTC (rev 34612) @@ -1148,6 +1148,7 @@ PTimer::PTimer(long millisecs, int seconds, int minutes, int hours, int days) : PTimeInterval(millisecs, seconds, minutes, hours, days) , m_handle(s_handleGenerator.Create()) + , m_running(false) { InternalStart(true, PTimeInterval::InternalGet()); } @@ -1156,6 +1157,7 @@ PTimer::PTimer(const PTimeInterval & time) : PTimeInterval(time) , m_handle(s_handleGenerator.Create()) + , m_running(false) { InternalStart(true, PTimeInterval::InternalGet()); } @@ -1164,6 +1166,7 @@ PTimer::PTimer(const PTimer & timer) : PTimeInterval(timer.GetResetTime()) , m_handle(s_handleGenerator.Create()) + , m_running(false) { InternalStart(true, PTimeInterval::InternalGet()); } @@ -1248,9 +1251,9 @@ if (resetTime > 0) { m_absoluteTime = Tick() + GetResetTime(); - m_running = true; list->m_timersMutex.Wait(); list->m_timers[m_handle] = this; + m_running = true; list->m_timersMutex.Signal(); PProcess::Current().SignalTimerChange(); @@ -1349,6 +1352,10 @@ if (!timer->m_callbackMutex.Try()) return false; // Try again + + // Remove the expired one shot timers from map + if (timer->m_oneshot && !timer->m_running) + m_timers.erase(it); } // Must be outside of m_timersMutex and timer->m_timerMutex mutexes @@ -1366,6 +1373,7 @@ PTimeInterval nextInterval(0, 1); m_timersMutex.Wait(); + for (TimerMap::iterator it = m_timers.begin(); it != m_timers.end(); ++it) { PTimer & timer = *it->second; if (timer.m_running) { @@ -1392,6 +1400,7 @@ } } } + m_timersMutex.Signal(); if (nextInterval < 10) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-09 15:02:27
|
Revision: 34611 http://sourceforge.net/p/opalvoip/code/34611 Author: rjongbloed Date: 2016-02-09 15:02:25 +0000 (Tue, 09 Feb 2016) Log Message: ----------- Allow possible deadlock detect timeout to adjustable on a mutex by mutex basis. Part 2. Modified Paths: -------------- ptlib/trunk/include/ptlib/mutex.h ptlib/trunk/include/ptlib/syncthrd.h ptlib/trunk/src/ptlib/common/osutils.cxx ptlib/trunk/src/ptlib/msos/win32.cxx ptlib/trunk/src/ptlib/unix/tlibthrd.cxx Modified: ptlib/trunk/include/ptlib/mutex.h =================================================================== --- ptlib/trunk/include/ptlib/mutex.h 2016-02-09 12:50:40 UTC (rev 34610) +++ ptlib/trunk/include/ptlib/mutex.h 2016-02-09 15:02:25 UTC (rev 34611) @@ -50,7 +50,7 @@ unsigned m_excessiveLockTimeout; mutable bool m_excessiveLockActive; - PMutexExcessiveLockInfo(const char * name, unsigned line); + PMutexExcessiveLockInfo(const char * name, unsigned line, unsigned timeout); PMutexExcessiveLockInfo(const PMutexExcessiveLockInfo & other); void PrintOn(ostream &strm) const; }; @@ -88,8 +88,9 @@ The name/line parameters are used for deadlock detection debugging. */ explicit PTimedMutex( - const char * name = NULL, ///< Arbitrary name, or filename of mutex variable declaration - unsigned line = 0 ///< Line number, if non zero, name is assumed to be a filename + const char * name = NULL, ///< Arbitrary name, or filename of mutex variable declaration + unsigned line = 0, ///< Line number, if non zero, name is assumed to be a filename + unsigned timeout = 0 ///< Timeout in ms, before declaring a possible deadlock. Zero is default. ); /**Copy constructor is allowed but does not copy, allocating a new mutex. @@ -149,10 +150,17 @@ typedef PTimedMutex PMutex; /// Declare a PReadWriteMutex with compiled file/line for deadlock debugging -#define PDECLARE_MUTEX(var) struct PTimedMutex_##var : PTimedMutex { PTimedMutex_##var() : PTimedMutex(__FILE__,__LINE__) { } } var -#define PDECLARE_MUTEX2(var, name) struct PTimedMutex_##var : PTimedMutex { PTimedMutex_##var() : PTimedMutex(#name) { } } var +#define PDECLARE_MUTEX_ARG_1(var) struct PTimedMutex_##var : PTimedMutex { PTimedMutex_##var() : PTimedMutex(__FILE__,__LINE__) { } } var +#define PDECLARE_MUTEX_ARG_2(var, name) struct PTimedMutex_##var : PTimedMutex { PTimedMutex_##var() : PTimedMutex(#name ) { } } var +#define PDECLARE_MUTEX_ARG_3(var, name, timeout) struct PTimedMutex_##var : PTimedMutex { PTimedMutex_##var() : PTimedMutex(#name, 0, timeout) { } } var +#define PDECLARE_MUTEX_PART1(narg, args) PDECLARE_MUTEX_PART2(narg, args) +#define PDECLARE_MUTEX_PART2(narg, args) PDECLARE_MUTEX_ARG_##narg args + +#define PDECLARE_MUTEX(...) PDECLARE_MUTEX_PART1(PARG_COUNT(__VA_ARGS__), (__VA_ARGS__)) + + /** This class implements critical section mutexes using the most efficient mechanism available on the host platform. For example in Windows, a CRITICAL_SECTION is used. Modified: ptlib/trunk/include/ptlib/syncthrd.h =================================================================== --- ptlib/trunk/include/ptlib/syncthrd.h 2016-02-09 12:50:40 UTC (rev 34610) +++ ptlib/trunk/include/ptlib/syncthrd.h 2016-02-09 15:02:25 UTC (rev 34611) @@ -264,8 +264,9 @@ /**@name Construction */ //@{ explicit PReadWriteMutex( - const char * name = NULL, ///< Arbitrary name, or filename of mutex variable declaration - unsigned line = 0 ///< Line number, if non zero, name is assumed to be a filename + const char * name = NULL, ///< Arbitrary name, or filename of mutex variable declaration + unsigned line = 0, ///< Line number, if non zero, name is assumed to be a filename + unsigned timeout = 0 ///< Timeout in ms, before declaring a possible deadlock. Zero is default. ); ~PReadWriteMutex(); //@} @@ -364,10 +365,16 @@ }; /// Declare a PReadWriteMutex with compiled file/line for deadlock debugging -#define PDECLARE_READ_WRITE_MUTEX(var) struct PReadWriteMutex_##var : PReadWriteMutex { PReadWriteMutex_##var() : PReadWriteMutex(__FILE__,__LINE__) { } } var -#define PDECLARE_READ_WRITE_MUTEX2(var, name) struct PReadWriteMutex_##var : PReadWriteMutex { PReadWriteMutex_##var() : PReadWriteMutex(#name) { } } var +#define PDECLARE_READ_WRITE_MUTEX_ARG_1(var) struct PReadWriteMutex_##var : PReadWriteMutex { PReadWriteMutex_##var() : PReadWriteMutex(__FILE__,__LINE__) { } } var +#define PDECLARE_READ_WRITE_MUTEX_ARG_2(var, name) struct PReadWriteMutex_##var : PReadWriteMutex { PReadWriteMutex_##var() : PReadWriteMutex(#name ) { } } var +#define PDECLARE_READ_WRITE_MUTEX_ARG_3(var, name, timeout) struct PReadWriteMutex_##var : PReadWriteMutex { PReadWriteMutex_##var() : PReadWriteMutex(#name, 0, timeout) { } } var +#define PDECLARE_READ_WRITE_MUTEX_PART1(narg, args) PDECLARE_READ_WRITE_MUTEX_PART2(narg, args) +#define PDECLARE_READ_WRITE_MUTEX_PART2(narg, args) PDECLARE_READ_WRITE_MUTEX_ARG_##narg args +#define PDECLARE_READ_WRITE_MUTEX(...) PDECLARE_READ_WRITE_MUTEX_PART1(PARG_COUNT(__VA_ARGS__), (__VA_ARGS__)) + + /**This class starts a read operation for the PReadWriteMutex on construction and automatically ends the read operation on destruction. Modified: ptlib/trunk/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-09 12:50:40 UTC (rev 34610) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-09 15:02:25 UTC (rev 34611) @@ -2928,10 +2928,10 @@ unsigned PTimedMutex::ExcessiveLockWaitTime = InitExcessiveLockWaitTime()*1000; -PMutexExcessiveLockInfo::PMutexExcessiveLockInfo(const char * name, unsigned line) +PMutexExcessiveLockInfo::PMutexExcessiveLockInfo(const char * name, unsigned line, unsigned timeout) : m_fileOrName(name) , m_fileLine(line) - , m_excessiveLockTimeout(PTimedMutex::ExcessiveLockWaitTime) + , m_excessiveLockTimeout(timeout > 0 ? timeout : PTimedMutex::ExcessiveLockWaitTime) , m_excessiveLockActive(false) { } @@ -3148,8 +3148,8 @@ ///////////////////////////////////////////////////////////////////////////// -PReadWriteMutex::PReadWriteMutex(const char * name, unsigned line) - : PMutexExcessiveLockInfo(name, line) +PReadWriteMutex::PReadWriteMutex(const char * name, unsigned line, unsigned timeout) + : PMutexExcessiveLockInfo(name, line, timeout) #if P_READ_WRITE_ALGO2 , m_inSemaphore(1, 1) , m_inCount(0) Modified: ptlib/trunk/src/ptlib/msos/win32.cxx =================================================================== --- ptlib/trunk/src/ptlib/msos/win32.cxx 2016-02-09 12:50:40 UTC (rev 34610) +++ ptlib/trunk/src/ptlib/msos/win32.cxx 2016-02-09 15:02:25 UTC (rev 34611) @@ -1743,8 +1743,8 @@ /////////////////////////////////////////////////////////////////////////////// // PTimedMutex -PTimedMutex::PTimedMutex(const char * name, unsigned line) - : PMutexExcessiveLockInfo(name, line) +PTimedMutex::PTimedMutex(const char * name, unsigned line, unsigned timeout) + : PMutexExcessiveLockInfo(name, line, timeout) , m_lockerId(PNullThreadIdentifier) , m_lastLockerId(PNullThreadIdentifier) , m_lastUniqueId(0) Modified: ptlib/trunk/src/ptlib/unix/tlibthrd.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2016-02-09 12:50:40 UTC (rev 34610) +++ ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2016-02-09 15:02:25 UTC (rev 34611) @@ -1215,8 +1215,8 @@ /////////////////////////////////////////////////////////////////////////////// -PTimedMutex::PTimedMutex(const char * name, unsigned line) - : PMutexExcessiveLockInfo(name, line) +PTimedMutex::PTimedMutex(const char * name, unsigned line, unsigned timeout) + : PMutexExcessiveLockInfo(name, line, timeout) { Construct(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-09 12:50:42
|
Revision: 34610 http://sourceforge.net/p/opalvoip/code/34610 Author: rjongbloed Date: 2016-02-09 12:50:40 +0000 (Tue, 09 Feb 2016) Log Message: ----------- Fixed GCC warning Modified Paths: -------------- ptlib/trunk/src/ptlib/common/osutils.cxx Modified: ptlib/trunk/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-09 12:48:22 UTC (rev 34609) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-09 12:50:40 UTC (rev 34610) @@ -2938,9 +2938,9 @@ PMutexExcessiveLockInfo::PMutexExcessiveLockInfo(const PMutexExcessiveLockInfo & other) - : m_excessiveLockTimeout(other.m_excessiveLockTimeout) - , m_fileOrName(other.m_fileOrName) + : m_fileOrName(other.m_fileOrName) , m_fileLine(other.m_fileLine) + , m_excessiveLockTimeout(other.m_excessiveLockTimeout) , m_excessiveLockActive(false) { } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-09 12:48:24
|
Revision: 34609 http://sourceforge.net/p/opalvoip/code/34609 Author: rjongbloed Date: 2016-02-09 12:48:22 +0000 (Tue, 09 Feb 2016) Log Message: ----------- Fix Linux compile Modified Paths: -------------- ptlib/trunk/src/ptlib/unix/tlibthrd.cxx Modified: ptlib/trunk/src/ptlib/unix/tlibthrd.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2016-02-09 12:41:26 UTC (rev 34608) +++ ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2016-02-09 12:48:22 UTC (rev 34609) @@ -1258,7 +1258,6 @@ m_lastLockerId = m_lockerId = PNullThreadIdentifier; m_lastUniqueId = 0; m_lockCount = 0; - m_excessiveLockTime = false; InitialiseRecursiveMutex(&m_mutex); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-09 12:41:29
|
Revision: 34608 http://sourceforge.net/p/opalvoip/code/34608 Author: rjongbloed Date: 2016-02-09 12:41:26 +0000 (Tue, 09 Feb 2016) Log Message: ----------- Allow possible deadlock detect timeout to adjustable on a mutex by mutex basis. PTimedMutex::ExcessiveLockWaitTime is still the default. Modified Paths: -------------- ptlib/trunk/include/ptlib/mutex.h ptlib/trunk/include/ptlib/syncthrd.h ptlib/trunk/src/ptlib/common/osutils.cxx ptlib/trunk/src/ptlib/msos/win32.cxx ptlib/trunk/src/ptlib/unix/tlibthrd.cxx Modified: ptlib/trunk/include/ptlib/mutex.h =================================================================== --- ptlib/trunk/include/ptlib/mutex.h 2016-02-08 17:55:44 UTC (rev 34607) +++ ptlib/trunk/include/ptlib/mutex.h 2016-02-09 12:41:26 UTC (rev 34608) @@ -41,6 +41,21 @@ #include <ptlib/atomic.h> #include <ptlib/semaphor.h> + +class PMutexExcessiveLockInfo +{ + protected: + const char * m_fileOrName; + unsigned m_fileLine; + unsigned m_excessiveLockTimeout; + mutable bool m_excessiveLockActive; + + PMutexExcessiveLockInfo(const char * name, unsigned line); + PMutexExcessiveLockInfo(const PMutexExcessiveLockInfo & other); + void PrintOn(ostream &strm) const; +}; + + /**This class defines a thread mutual exclusion object. A mutex is where a piece of code or data cannot be accessed by more than one thread at a time. To prevent this the PMutex is used in the following manner: @@ -62,7 +77,7 @@ <code>Signal()</code> function, releasing the second thread. */ -class PTimedMutex : public PSync +class PTimedMutex : public PSync, protected PMutexExcessiveLockInfo { PCLASSINFO(PTimedMutex, PSync) public: @@ -119,9 +134,6 @@ PThreadIdentifier m_lastLockerId; PUniqueThreadIdentifier m_lastUniqueId; unsigned m_lockCount; - bool m_excessiveLockTime; - const char * m_fileOrName; - unsigned m_line; void ExcessiveLockWait(); void CommonSignal(); Modified: ptlib/trunk/include/ptlib/syncthrd.h =================================================================== --- ptlib/trunk/include/ptlib/syncthrd.h 2016-02-08 17:55:44 UTC (rev 34607) +++ ptlib/trunk/include/ptlib/syncthrd.h 2016-02-09 12:41:26 UTC (rev 34608) @@ -257,7 +257,7 @@ http://arxiv.org/ftp/arxiv/papers/1309/1309.4507.pdf to improve efficiency. */ -class PReadWriteMutex : public PObject +class PReadWriteMutex : public PObject, protected PMutexExcessiveLockInfo { PCLASSINFO(PReadWriteMutex, PObject); public: @@ -360,10 +360,6 @@ void InternalEndWrite(Nest & nest); void InternalWait(Nest & nest, PSync & sync) const; - const char * m_fileOrName; - unsigned m_line; - mutable bool m_excessiveLockTime; - friend class PSafeObject; }; Modified: ptlib/trunk/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-08 17:55:44 UTC (rev 34607) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-09 12:41:26 UTC (rev 34608) @@ -2927,6 +2927,38 @@ unsigned PTimedMutex::ExcessiveLockWaitTime = InitExcessiveLockWaitTime()*1000; + +PMutexExcessiveLockInfo::PMutexExcessiveLockInfo(const char * name, unsigned line) + : m_fileOrName(name) + , m_fileLine(line) + , m_excessiveLockTimeout(PTimedMutex::ExcessiveLockWaitTime) + , m_excessiveLockActive(false) +{ +} + + +PMutexExcessiveLockInfo::PMutexExcessiveLockInfo(const PMutexExcessiveLockInfo & other) + : m_excessiveLockTimeout(other.m_excessiveLockTimeout) + , m_fileOrName(other.m_fileOrName) + , m_fileLine(other.m_fileLine) + , m_excessiveLockActive(false) +{ +} + + +void PMutexExcessiveLockInfo::PrintOn(ostream &strm) const +{ + if (m_fileOrName != NULL) { + strm << " ("; + if (m_fileLine != 0) + strm << PFilePath(m_fileOrName).GetFileName() << ':' << m_fileLine; + else + strm << m_fileOrName; + strm << ')'; + } +} + + void PTimedMutex::ExcessiveLockWait() { #if PTRACING @@ -2949,15 +2981,15 @@ PAssertAlways(PSTRSTRM("Possible deadlock in mutex " << *this)); #endif - m_excessiveLockTime = true; + m_excessiveLockActive = true; } void PTimedMutex::CommonSignal() { - if (m_excessiveLockTime) { + if (m_excessiveLockActive) { PTRACE(0, "Released phantom deadlock in mutex " << *this); - m_excessiveLockTime = false; + m_excessiveLockActive = false; } m_lockerId = PNullThreadIdentifier; @@ -2967,14 +2999,7 @@ void PTimedMutex::PrintOn(ostream &strm) const { strm << this; - if (m_fileOrName != NULL) { - strm << " ("; - if (m_line != 0) - strm << PFilePath(m_fileOrName).GetFileName() << ':' << m_line; - else - strm << m_fileOrName; - strm << ')'; - } + PMutexExcessiveLockInfo::PrintOn(strm); } @@ -3124,22 +3149,20 @@ ///////////////////////////////////////////////////////////////////////////// PReadWriteMutex::PReadWriteMutex(const char * name, unsigned line) + : PMutexExcessiveLockInfo(name, line) #if P_READ_WRITE_ALGO2 - : m_inSemaphore(1, 1) + , m_inSemaphore(1, 1) , m_inCount(0) , m_outSemaphore(1, 1) , m_outCount(0) , m_writeSemaphore(0, 1) , m_wait(false) #else - : m_readerSemaphore(1, 1) + , m_readerSemaphore(1, 1) , m_readerCount(0) , m_writerSemaphore(1, 1) , m_writerCount(0) #endif - , m_fileOrName(name) - , m_line(line) - , m_excessiveLockTime(false) { PTRACE(5, "Created read/write mutex " << *this); } @@ -3215,12 +3238,12 @@ nest.m_waiting = true; #if PTRACING - if (sync.Wait(PTimedMutex::ExcessiveLockWaitTime)) { + if (sync.Wait(m_excessiveLockTimeout)) { nest.m_waiting = false; return; } - m_excessiveLockTime = true; + m_excessiveLockActive = true; NestMap nestedThreadsToDump; { @@ -3228,21 +3251,23 @@ nestedThreadsToDump = m_nestedThreads; } - ostream & trace = PTRACE_BEGIN(0, "PTLib"); - trace << "Possible deadlock in read/write mutex " << *this << " :\n"; - for (NestMap::const_iterator it = nestedThreadsToDump.begin(); it != nestedThreadsToDump.end(); ++it) { - if (it != nestedThreadsToDump.begin()) - trace << '\n'; - trace << " thread-id=" << it->first << " (0x" << std::hex << it->first << std::dec << ")," - " unique-id=" << it->second.m_uniqueId << "," - " readers=" << it->second.m_readerCount << "," - " writers=" << it->second.m_writerCount; - if (!it->second.m_waiting) - trace << ", LOCKER"; - if (PTimedMutex::EnableDeadlockStackWalk) - PTrace::WalkStack(trace, it->first); + { + ostream & trace = PTRACE_BEGIN(0, "PTLib"); + trace << "Possible deadlock in read/write mutex " << *this << " :\n"; + for (NestMap::const_iterator it = nestedThreadsToDump.begin(); it != nestedThreadsToDump.end(); ++it) { + if (it != nestedThreadsToDump.begin()) + trace << '\n'; + trace << " thread-id=" << it->first << " (0x" << std::hex << it->first << std::dec << ")," + " unique-id=" << it->second.m_uniqueId << "," + " readers=" << it->second.m_readerCount << "," + " writers=" << it->second.m_writerCount; + if (!it->second.m_waiting) + trace << ", LOCKER"; + if (PTimedMutex::EnableDeadlockStackWalk) + PTrace::WalkStack(trace, it->first); + } + trace << PTrace::End; } - trace << PTrace::End; sync.Wait(); @@ -3277,9 +3302,9 @@ if (nest->m_readerCount > 0 || nest->m_writerCount > 0) return; - if (m_excessiveLockTime) { + if (m_excessiveLockActive) { PTRACE(0, "Released phantom deadlock in read/write mutex " << *this); - m_excessiveLockTime = false; + m_excessiveLockActive = false; } // Do text book read lock @@ -3305,9 +3330,9 @@ if (nest.m_writerCount > 1) return; - if (m_excessiveLockTime) { + if (m_excessiveLockActive) { PTRACE(0, "Released phantom deadlock in read/write mutex " << *this); - m_excessiveLockTime = false; + m_excessiveLockActive = false; } // If have a read lock already in this thread then do the "real" unlock code @@ -3444,14 +3469,7 @@ void PReadWriteMutex::PrintOn(ostream & strm) const { strm << this; - if (m_fileOrName != NULL) { - strm << " ("; - if (m_line != 0) - strm << PFilePath(m_fileOrName).GetFileName() << ':' << m_line; - else - strm << m_fileOrName; - strm << ')'; - } + PMutexExcessiveLockInfo::PrintOn(strm); } Modified: ptlib/trunk/src/ptlib/msos/win32.cxx =================================================================== --- ptlib/trunk/src/ptlib/msos/win32.cxx 2016-02-08 17:55:44 UTC (rev 34607) +++ ptlib/trunk/src/ptlib/msos/win32.cxx 2016-02-09 12:41:26 UTC (rev 34608) @@ -1744,26 +1744,22 @@ // PTimedMutex PTimedMutex::PTimedMutex(const char * name, unsigned line) - : m_lockerId(PNullThreadIdentifier) + : PMutexExcessiveLockInfo(name, line) + , m_lockerId(PNullThreadIdentifier) , m_lastLockerId(PNullThreadIdentifier) , m_lastUniqueId(0) , m_lockCount(0) - , m_excessiveLockTime(false) - , m_fileOrName(name) - , m_line(line) , m_handle(::CreateMutex(NULL, FALSE, NULL)) { } PTimedMutex::PTimedMutex(const PTimedMutex & other) - : m_lockerId(PNullThreadIdentifier) + : PMutexExcessiveLockInfo(other) + , m_lockerId(PNullThreadIdentifier) , m_lastLockerId(PNullThreadIdentifier) , m_lastUniqueId(0) , m_lockCount(0) - , m_excessiveLockTime(false) - , m_fileOrName(other.m_fileOrName) - , m_line(other.m_line) , m_handle(::CreateMutex(NULL, FALSE, NULL)) { } @@ -1771,7 +1767,7 @@ void PTimedMutex::Wait() { - if (!m_handle.Wait(ExcessiveLockWaitTime)) { + if (!m_handle.Wait(m_excessiveLockTimeout)) { ExcessiveLockWait(); m_handle.Wait(INFINITE); PTRACE(0, "PTLib", "Phantom deadlock in mutex " << *this); Modified: ptlib/trunk/src/ptlib/unix/tlibthrd.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2016-02-08 17:55:44 UTC (rev 34607) +++ ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2016-02-09 12:41:26 UTC (rev 34608) @@ -1216,15 +1216,13 @@ /////////////////////////////////////////////////////////////////////////////// PTimedMutex::PTimedMutex(const char * name, unsigned line) - : m_fileOrName(name) - , m_line(line) + : PMutexExcessiveLockInfo(name, line) { Construct(); } PTimedMutex::PTimedMutex(const PTimedMutex & other) - : m_fileOrName(other.m_fileOrName) - , m_line(other.m_line) + : PMutexExcessiveLockInfo(other) { Construct(); } @@ -1301,8 +1299,8 @@ struct timeval now; gettimeofday(&now, NULL); struct timespec absTime; - absTime.tv_sec = now.tv_sec + ExcessiveLockWaitTime/1000; - absTime.tv_nsec = now.tv_usec*1000 + (ExcessiveLockWaitTime%1000)*1000000; + absTime.tv_sec = now.tv_sec + m_excessiveLockTimeout/1000; + absTime.tv_nsec = now.tv_usec*1000 + (m_excessiveLockTimeout%1000)*1000000; if (absTime.tv_nsec >= 1000000000) { absTime.tv_nsec -= 1000000000; ++absTime.tv_sec; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-08 17:55:46
|
Revision: 34607 http://sourceforge.net/p/opalvoip/code/34607 Author: rjongbloed Date: 2016-02-08 17:55:44 +0000 (Mon, 08 Feb 2016) Log Message: ----------- Reduced noise on excessive latency trace logs. Modified Paths: -------------- ptlib/trunk/include/ptclib/threadpool.h Modified: ptlib/trunk/include/ptclib/threadpool.h =================================================================== --- ptlib/trunk/include/ptclib/threadpool.h 2016-02-08 15:54:32 UTC (rev 34606) +++ ptlib/trunk/include/ptclib/threadpool.h 2016-02-08 17:55:44 UTC (rev 34607) @@ -494,12 +494,14 @@ { PTime now; if (this->m_nextWorkerIncreaseTime > now) { - PTRACE(2, NULL, "ThreadPool", "Thread pool (group=\"" << group << "\") latency excessive" + PTRACE(3, NULL, "ThreadPool", "Thread pool (group=\"" << group << "\") latency excessive" " (" << latency << "s > " << this->m_workerIncreaseLatency << "s)," - " not increasing threads past " << this->m_workerIncreaseLimit << " due to recent adjustment"); + " not increasing threads past " << this->m_maxWorkerCount << " due to recent adjustment"); return; } + this->m_nextWorkerIncreaseTime = now + latency; // Don't increase again until oafter this blockage removed. + unsigned newMaxWorkers = std::min((this->m_maxWorkerCount*11+9)/10, this->m_workerIncreaseLimit); if (newMaxWorkers == this->m_maxWorkerCount) { PTRACE(2, NULL, "ThreadPool", "Thread pool (group=\"" << group << "\") latency excessive" @@ -512,7 +514,6 @@ " (" << latency << "s > " << this->m_workerIncreaseLatency << "s)," " increasing maximum threads from " << this->m_maxWorkerCount << " to " << newMaxWorkers); this->m_maxWorkerCount = newMaxWorkers; - this->m_nextWorkerIncreaseTime = now + latency; // Don't increase again until oafter this blockage removed. } virtual PThreadPoolBase::WorkerThreadBase * CreateWorkerThread() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-08 15:54:35
|
Revision: 34606 http://sourceforge.net/p/opalvoip/code/34606 Author: rjongbloed Date: 2016-02-08 15:54:32 +0000 (Mon, 08 Feb 2016) Log Message: ----------- Added dead band to thread pool size increase on excessive latency. So, doesn't ram up too fast. Also added the thread group name to the excessive latency trace logs. Modified Paths: -------------- ptlib/trunk/include/ptclib/threadpool.h Modified: ptlib/trunk/include/ptclib/threadpool.h =================================================================== --- ptlib/trunk/include/ptclib/threadpool.h 2016-02-08 09:51:42 UTC (rev 34605) +++ ptlib/trunk/include/ptclib/threadpool.h 2016-02-08 15:54:32 UTC (rev 34606) @@ -257,7 +257,7 @@ } public: - virtual void AddWork(Work_T * work) = 0; + virtual void AddWork(Work_T * work, const string & group) = 0; virtual void RemoveWork(Work_T * work) = 0; virtual void Main() = 0; @@ -344,7 +344,7 @@ m_externalToInternalWorkMap.insert(make_pair(work, internalWork)); // give the work to the worker - internalWork.m_worker->AddWork(work); + internalWork.m_worker->AddWork(work, internalWork.m_group); return true; } @@ -392,6 +392,7 @@ protected: PTimeInterval m_workerIncreaseLatency; unsigned m_workerIncreaseLimit; + PTime m_nextWorkerIncreaseTime; public: // @@ -433,10 +434,10 @@ { } - void AddWork(Work_T * work) + void AddWork(Work_T * work, const string & group) { if (PAssertNULL(work) != NULL) - this->m_queue.Enqueue(QueuedWork(work)); + this->m_queue.Enqueue(QueuedWork(work, group)); } void RemoveWork(Work_T * work) @@ -466,7 +467,7 @@ this->m_working = false; if (latency > pool.m_workerIncreaseLatency) - pool.OnMaxWaitTime(latency); + pool.OnMaxWaitTime(latency, item.m_group); } } @@ -480,28 +481,38 @@ struct QueuedWork { QueuedWork() : m_time(0), m_work(NULL) { } - explicit QueuedWork(Work_T * work) : m_work(work) { } + explicit QueuedWork(Work_T * work, const string & group) : m_work(work), m_group(group) { } PTime m_time; Work_T * m_work; + string m_group; }; PSyncQueue<QueuedWork> m_queue; bool m_working; }; - virtual void OnMaxWaitTime(const PTimeInterval & PTRACE_PARAM(latency)) + virtual void OnMaxWaitTime(const PTimeInterval & PTRACE_PARAM(latency), const string & PTRACE_PARAM(group)) { - unsigned newMaxWorkers = std::min((this->m_maxWorkerCount*11+9)/10, m_workerIncreaseLimit); - if (newMaxWorkers != this->m_maxWorkerCount) { - PTRACE(2, NULL, "ThreadPool", "Thread pool latency excessive" + PTime now; + if (this->m_nextWorkerIncreaseTime > now) { + PTRACE(2, NULL, "ThreadPool", "Thread pool (group=\"" << group << "\") latency excessive" " (" << latency << "s > " << this->m_workerIncreaseLatency << "s)," - " increasing maximum threads from " << this->m_maxWorkerCount << " to " << newMaxWorkers); - this->m_maxWorkerCount = newMaxWorkers; + " not increasing threads past " << this->m_workerIncreaseLimit << " due to recent adjustment"); + return; } - else { - PTRACE(2, NULL, "ThreadPool", "Thread pool latency excessive" + + unsigned newMaxWorkers = std::min((this->m_maxWorkerCount*11+9)/10, this->m_workerIncreaseLimit); + if (newMaxWorkers == this->m_maxWorkerCount) { + PTRACE(2, NULL, "ThreadPool", "Thread pool (group=\"" << group << "\") latency excessive" " (" << latency << "s > " << this->m_workerIncreaseLatency << "s)," - " cannot increase threads past " << m_workerIncreaseLimit); + " cannot increase threads past " << this->m_workerIncreaseLimit); + return; } + + PTRACE(2, NULL, "ThreadPool", "Thread pool (group=\"" << group << "\") latency excessive" + " (" << latency << "s > " << this->m_workerIncreaseLatency << "s)," + " increasing maximum threads from " << this->m_maxWorkerCount << " to " << newMaxWorkers); + this->m_maxWorkerCount = newMaxWorkers; + this->m_nextWorkerIncreaseTime = now + latency; // Don't increase again until oafter this blockage removed. } virtual PThreadPoolBase::WorkerThreadBase * CreateWorkerThread() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-08 09:51:44
|
Revision: 34605 http://sourceforge.net/p/opalvoip/code/34605 Author: rjongbloed Date: 2016-02-08 09:51:42 +0000 (Mon, 08 Feb 2016) Log Message: ----------- Fix race condition, that really isn't, detected by GCC thread sanitizer. Modified Paths: -------------- ptlib/trunk/include/ptlib/syslog.h Modified: ptlib/trunk/include/ptlib/syslog.h =================================================================== --- ptlib/trunk/include/ptlib/syslog.h 2016-02-08 09:50:46 UTC (rev 34604) +++ ptlib/trunk/include/ptlib/syslog.h 2016-02-08 09:51:42 UTC (rev 34605) @@ -159,7 +159,7 @@ //@} protected: - PSystemLog::Level m_thresholdLevel; + PAtomicEnum<PSystemLog::Level> m_thresholdLevel; private: PSystemLogTarget(const PSystemLogTarget & other); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-08 09:50:49
|
Revision: 34604 http://sourceforge.net/p/opalvoip/code/34604 Author: rjongbloed Date: 2016-02-08 09:50:46 +0000 (Mon, 08 Feb 2016) Log Message: ----------- Type to optimise local implementation of atomic<> for enumerations, when std::atomic<> not available. Modified Paths: -------------- ptlib/trunk/include/ptlib/atomic.h Modified: ptlib/trunk/include/ptlib/atomic.h =================================================================== --- ptlib/trunk/include/ptlib/atomic.h 2016-02-07 18:30:21 UTC (rev 34603) +++ ptlib/trunk/include/ptlib/atomic.h 2016-02-08 09:50:46 UTC (rev 34604) @@ -35,6 +35,8 @@ #include <atomic> +#define PAtomicEnum std::atomic + #else #ifdef P_ATOMICITY_HEADER @@ -222,6 +224,20 @@ #endif + template <typename Enum> struct PAtomicEnum + { + __inline PAtomicEnum() { } + __inline PAtomicEnum(Enum value) : m_enum(value) { } + __inline PAtomicEnum(const PAtomicEnum & other) : m_enum(other.m_enum) { } + __inline Enum operator=(const PAtomicEnum & other) { Enum value = other; this->store(value); return value; } + __inline operator Enum() const { return this->load(); } + __inline Enum load() const { return (Enum)this->m_enum.load(); } + __inline void store(Enum value) { this->m_enum.store(value); } + __inline Enum exchange(Enum value) { return (Enum)this->m_enum.exchange(value); } + __inline bool compare_exchange_strong(Enum & comp, Enum value) { return this->m_enum.compare_exchange_strong((int &)comp, value); } + private: + atomic<int> m_enum; + }; #endif // P_STD_ATOMIC This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-07 18:30:24
|
Revision: 34603 http://sourceforge.net/p/opalvoip/code/34603 Author: rjongbloed Date: 2016-02-07 18:30:21 +0000 (Sun, 07 Feb 2016) Log Message: ----------- Merged revision(s) 34579-34602 from opal/branches/v3_16: Fixed differentiation between timeout and system shut down in C# API OpalContext::GetMessage() ........ Changed no media timeout so is no media on ANY transport and not for ALL transports. Interoperability work around. ........ Modified Paths: -------------- opal/trunk/include/opal/mediasession.h opal/trunk/src/opal/mediasession.cxx opal/trunk/src/opal/opal_c.cxx Property Changed: ---------------- opal/trunk/ Index: opal/trunk =================================================================== --- opal/trunk 2016-02-07 18:26:43 UTC (rev 34602) +++ opal/trunk 2016-02-07 18:30:21 UTC (rev 34603) Property changes on: opal/trunk ___________________________________________________________________ Modified: svn:mergeinfo ## -10,7 +10,7 ## /opal/branches/v3_10:25182-29485,30896,32927-32928,32933 /opal/branches/v3_12:28489-31709 /opal/branches/v3_14:31505-33613 -/opal/branches/v3_16:34090-34578 +/opal/branches/v3_16:34090-34602 /opal/branches/v3_2:21143,21220,21227,21253,21455 /opal/branches/v3_4:21060,21062,21088,21092,21111,21113,21115,21119,21143,21148,21151-21152,21155,21158,21184,21188,21253,21265-21266,21283-21284,21298,21300,21303,21307,21309,21311,21327,21331,21333,21359,21367,21369,21488,21556,21564-21565,21568,21570,21620,21625,21631,21748,21751,21756,21759,21761,21767,21770,22246,23044,23140,23143,23286 /opal/branches/v3_6:22169,22178,22184,22186,22197,22204,22216,22251,22253,22255,22258,22260,22291,22296,22300,22306,22308,22313,22319,22336,22353,22358,22436,22447,22449,22497,22511,22517,22519-22521,22527,22536,22538,22589,22596,22599,22617,22620,22622,22630,22640,22655,22675,22682,22726-22728,22730,22733,22738,22745-22746,22800,22820-22821,22842,22844-22845,22851,22853,22889,22896,22902,22904,22906,22918,22924,22928,22946,22965,22967,22976,22978,22980,22982,22994,23028,23123,23125-23126,23128,23157,23165,23173,23175,23183,23294,23341,23465,23467,23474,23521,23829,24346,24809 \ No newline at end of property Modified: opal/trunk/include/opal/mediasession.h =================================================================== --- opal/trunk/include/opal/mediasession.h 2016-02-07 18:26:43 UTC (rev 34602) +++ opal/trunk/include/opal/mediasession.h 2016-02-07 18:30:21 UTC (rev 34603) @@ -460,6 +460,7 @@ bool m_remoteAddressSet; PINDEX m_packetSize; PTimeInterval m_mediaTimeout; + PSimpleTimer m_mediaTimer; PTimeInterval m_maxNoTransmitTime; atomic<bool> m_opened; bool m_started; Modified: opal/trunk/src/opal/mediasession.cxx =================================================================== --- opal/trunk/src/opal/mediasession.cxx 2016-02-07 18:26:43 UTC (rev 34602) +++ opal/trunk/src/opal/mediasession.cxx 2016-02-07 18:30:21 UTC (rev 34603) @@ -655,7 +655,6 @@ m_owner->InternalOnStart(m_subchannel); - PSimpleTimer noMediaTimer = m_owner->m_mediaTimeout; while (m_channel->IsOpen()) { PBYTEArray data(m_owner->m_packetSize); @@ -665,7 +664,6 @@ if (m_channel->Read(data.GetPointer(), data.GetSize())) { data.SetSize(m_channel->GetLastReadCount()); m_owner->InternalRxData(m_subchannel, data); - noMediaTimer = m_owner->m_mediaTimeout; } else { switch (m_channel->GetErrorCode(PChannel::LastReadError)) { @@ -683,7 +681,7 @@ break; case PChannel::Unavailable: - if (noMediaTimer.IsRunning()) { + if (m_owner->m_mediaTimer.IsRunning()) { HandleUnavailableError(); break; } @@ -759,6 +757,8 @@ UnlockReadOnly(); notifiers(*this, data); + + m_mediaTimer = m_mediaTimeout; } @@ -1132,8 +1132,7 @@ PUDPSocket & socket = *GetSubChannelAsSocket((SubChannels)subchannel); PTRACE_CONTEXT_ID_TO(socket); - if (subchannel != e_Control) - socket.SetReadTimeout(m_mediaTimeout); + socket.SetReadTimeout(m_mediaTimeout); // Increase internal buffer size on media UDP sockets SetMinBufferSize(socket, SO_RCVBUF, session.GetMediaType() == OpalMediaType::Audio() ? 0x4000 : 0x100000); Modified: opal/trunk/src/opal/opal_c.cxx =================================================================== --- opal/trunk/src/opal/opal_c.cxx 2016-02-07 18:26:43 UTC (rev 34602) +++ opal/trunk/src/opal/opal_c.cxx 2016-02-07 18:30:21 UTC (rev 34603) @@ -300,7 +300,7 @@ ~OpalManager_C(); void PostMessage(OpalMessageBuffer & message); - OpalMessage * GetMessage(unsigned timeout); + OpalMessage * GetMessage(unsigned timeout, const char * & error); OpalMessage * SendMessage(const OpalMessage * message); virtual void OnEstablishedCall(OpalCall & call); @@ -1140,16 +1140,21 @@ } -OpalMessage * OpalManager_C::GetMessage(unsigned timeout) +OpalMessage * OpalManager_C::GetMessage(unsigned timeout, const char * & error) { - if (m_shuttingDown) + if (m_shuttingDown) { + error = "System shut down"; return NULL; + } PTRACE(5, "GetMessage: timeout=" << timeout); OpalMessage * msg = NULL; if (m_messageQueue.Dequeue(msg, timeout)) { PTRACE(4, "Giving message " << msg->m_type << " to application"); + error = ""; } + else + error = "Timeout getting message."; return msg; } @@ -2922,7 +2927,8 @@ OpalMessage * OPAL_EXPORT OpalGetMessage(OpalHandle handle, unsigned timeout) { - return handle == NULL ? NULL : handle->m_manager->GetMessage(timeout); + const char * error; + return handle == NULL ? NULL : handle->m_manager->GetMessage(timeout, error); } @@ -2982,13 +2988,14 @@ return false; } - message.m_message = OpalGetMessage(m_handle, timeout); + const char * error; + message.m_message = m_handle->m_manager->GetMessage(timeout, error); if (message.m_message != NULL) return true; - PTRACE_IF(4, timeout > 0, "OpalContext::GetMessage() timeout"); + PTRACE_IF(4, timeout > 0, "OpalContext::GetMessage() " << error); message.SetType(OpalIndCommandError); - message.m_message->m_param.m_commandError = "Timeout getting message."; + message.m_message->m_param.m_commandError = error; return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-07 18:26:45
|
Revision: 34602 http://sourceforge.net/p/opalvoip/code/34602 Author: rjongbloed Date: 2016-02-07 18:26:43 +0000 (Sun, 07 Feb 2016) Log Message: ----------- Merged revision(s) 34588-34589 from opal/trunk: Fixed RTP round trip time calculation, checking SR to RR lsr field. ........ Fixed RTP NTP times in trace logs ........ Modified Paths: -------------- opal/branches/v3_16/include/rtp/rtp.h opal/branches/v3_16/include/rtp/rtp_session.h opal/branches/v3_16/src/rtp/rtp.cxx opal/branches/v3_16/src/rtp/rtp_session.cxx Property Changed: ---------------- opal/branches/v3_16/ Index: opal/branches/v3_16 =================================================================== --- opal/branches/v3_16 2016-02-07 18:20:16 UTC (rev 34601) +++ opal/branches/v3_16 2016-02-07 18:26:43 UTC (rev 34602) Property changes on: opal/branches/v3_16 ___________________________________________________________________ Modified: svn:mergeinfo ## -14,6 +14,6 ## /opal/branches/v3_4:21060,21062,21088,21092,21111,21113,21115,21119,21143,21148,21151-21152,21155,21158,21184,21188,21253,21265-21266,21283-21284,21298,21300,21303,21307,21309,21311,21327,21331,21333,21359,21367,21369,21488,21556,21564-21565,21568,21570,21620,21625,21631,21748,21751,21756,21759,21761,21767,21770,22246,23044,23140,23143,23286 /opal/branches/v3_6:22169,22178,22184,22186,22197,22204,22216,22251,22253,22255,22258,22260,22291,22296,22300,22306,22308,22313,22319,22336,22353,22358,22436,22447,22449,22497,22511,22517,22519-22521,22527,22536,22538,22589,22596,22599,22617,22620,22622,22630,22640,22655,22675,22682,22726-22728,22730,22733,22738,22745-22746,22800,22820-22821,22842,22844-22845,22851,22853,22889,22896,22902,22904,22906,22918,22924,22928,22946,22965,22967,22976,22978,22980,22982,22994,23028,23123,23125-23126,23128,23157,23165,23173,23175,23183,23294,23341,23465,23467,23474,23521,23829,24346,24809 /opal/branches/v3_8:24025,24027,24029,24036,24038,24040,24042,24048,24050,24058,24061,24068,24071,24074,24076,24080,24082,24086-24087,24092,24099,24101,24105,24107,24109,24111,24114,24116-24117,24120-24121,24125,24127,24130,24132,24134,24138,24140,24144,24146,24148,24150-24151,24154,24156,24158,24162,24170,24218,24245,24257,24261,24340,24362-24363,24365,24369,24373,24422,24440,24442,24447,24489,24504,24506,24532,24536,24545,24547,24552,24554,24614,24678,24687,24699,24705,24775,24833,24861,24903,25146 -/opal/trunk:34112-34116,34118-34120,34122,34137-34139,34155-34156,34161-34165,34168,34170,34173,34177,34187-34190,34208,34218,34222,34237-34238,34246-34252,34269-34271,34281-34288,34297,34300,34303-34316,34333,34346,34365,34375,34377,34382-34384,34390,34393-34394,34399,34417-34421,34424,34430,34432,34435-34437,34440,34442,34455-34456,34480,34483-34484,34487-34488,34490-34491,34502-34503,34506 +/opal/trunk:34112-34116,34118-34120,34122,34137-34139,34155-34156,34161-34165,34168,34170,34173,34177,34187-34190,34208,34218,34222,34237-34238,34246-34252,34269-34271,34281-34288,34297,34300,34303-34316,34333,34346,34365,34375,34377,34382-34384,34390,34393-34394,34399,34417-34421,34424,34430,34432,34435-34437,34440,34442,34455-34456,34480,34483-34484,34487-34488,34490-34491,34502-34503,34506,34588-34589 /ptlib/branches/v2_8:24136 /ptlib/trunk:20820 \ No newline at end of property Modified: opal/branches/v3_16/include/rtp/rtp.h =================================================================== --- opal/branches/v3_16/include/rtp/rtp.h 2016-02-07 18:20:16 UTC (rev 34601) +++ opal/branches/v3_16/include/rtp/rtp.h 2016-02-07 18:26:43 UTC (rev 34602) @@ -453,7 +453,7 @@ #endif RTP_SyncSourceId sourceIdentifier; - uint32_t ntpPassThrough; + uint64_t ntpPassThrough; PTime realTimestamp; RTP_Timestamp rtpTimestamp; unsigned packetsSent; @@ -465,7 +465,7 @@ { PCLASSINFO(RTP_ReceiverReport, PObject); public: - RTP_ReceiverReport(const RTP_ControlFrame::ReceiverReport & report); + RTP_ReceiverReport(const RTP_ControlFrame::ReceiverReport & report, uint64_t ntpPassThru); #if PTRACING void PrintOn(ostream &) const; #endif @@ -475,7 +475,7 @@ unsigned totalLost; /* cumulative number of packets lost (signed!) */ unsigned lastSequenceNumber; /* extended last sequence number received */ unsigned jitter; /* interarrival jitter */ - PTime lastTimestamp; /* last SR packet from this source */ + PTime lastTimestamp; /* last SR time from this source */ PTimeInterval delay; /* delay since last SR packet */ }; Modified: opal/branches/v3_16/include/rtp/rtp_session.h =================================================================== --- opal/branches/v3_16/include/rtp/rtp_session.h 2016-02-07 18:20:16 UTC (rev 34601) +++ opal/branches/v3_16/include/rtp/rtp_session.h 2016-02-07 18:26:43 UTC (rev 34602) @@ -220,6 +220,7 @@ virtual SendReceiveStatus OnOutOfOrderPacket(RTP_DataFrame & frame); virtual void OnRxSenderReport(const RTP_SenderReport & sender); + virtual void OnRxReceiverReport(RTP_SyncSourceId src, const RTP_ControlFrame::ReceiverReport & rr); virtual void OnRxReceiverReport(RTP_SyncSourceId src, const RTP_ReceiverReport & report); virtual void OnRxSourceDescription(const RTP_SourceDescriptionArray & descriptions); virtual void OnRxGoodbye(const RTP_SyncSourceArray & sources, const PString & reason); @@ -723,8 +724,8 @@ // Things to remember for filling in fields of sent SR/RR/DLRR unsigned m_packetsLostSinceLastRR; uint32_t m_lastRRSequenceNumber; - uint32_t m_ntpPassThrough; - PTime m_lastSenderReportTime; + uint64_t m_ntpPassThrough; // The NTP time from SR + PTime m_lastSenderReportTime; // Local time that SR was sent/received PTime m_referenceReportTime; PTime m_referenceReportNTP; Modified: opal/branches/v3_16/src/rtp/rtp.cxx =================================================================== --- opal/branches/v3_16/src/rtp/rtp.cxx 2016-02-07 18:20:16 UTC (rev 34601) +++ opal/branches/v3_16/src/rtp/rtp.cxx 2016-02-07 18:26:43 UTC (rev 34602) @@ -590,7 +590,7 @@ << " lost=" << totalLost << " last_seq=" << lastSequenceNumber << " jitter=" << jitter - << " lsr=" << lastTimestamp + << " lsr=" << lastTimestamp.AsString(PTime::TodayFormat) << " dlsr=" << delay; } @@ -598,7 +598,7 @@ void RTP_SenderReport::PrintOn(ostream & strm) const { strm << "SSRC=" << RTP_TRACE_SRC(sourceIdentifier) - << " ntp=" << realTimestamp.AsString("yyyy/M/d hh:mm:ss.uuuu") + << " ntp=" << realTimestamp.AsString(PTime::TodayFormat) << " (" << (realTimestamp - PTime()) << ")" " rtp=" << rtpTimestamp << " psent=" << packetsSent @@ -826,17 +826,17 @@ RTP_SenderReport::RTP_SenderReport(const RTP_ControlFrame::SenderReport & sr) : sourceIdentifier(sr.ssrc) - , ntpPassThrough((uint32_t)(((uint64_t)sr.ntp_ts)>>16)) + , ntpPassThrough(sr.ntp_ts) , realTimestamp(0) , rtpTimestamp(sr.rtp_ts) , packetsSent(sr.psent) , octetsSent(sr.osent) { - realTimestamp.SetNTP(sr.ntp_ts); + realTimestamp.SetNTP(ntpPassThrough); } -RTP_ReceiverReport::RTP_ReceiverReport(const RTP_ControlFrame::ReceiverReport & rr) +RTP_ReceiverReport::RTP_ReceiverReport(const RTP_ControlFrame::ReceiverReport & rr, uint64_t ntpPassThru) : sourceIdentifier(rr.ssrc) , fractionLost(rr.fraction) , totalLost(rr.GetLostPackets()) @@ -845,7 +845,8 @@ , lastTimestamp(0) , delay(((uint32_t)rr.dlsr*1000LL)/65536) // units of 1/65536 seconds { - lastTimestamp.SetNTP((uint64_t)(uint32_t)rr.lsr << 16); + if ((uint32_t)(ntpPassThru>>16) == rr.lsr) + lastTimestamp.SetNTP(ntpPassThru); } Modified: opal/branches/v3_16/src/rtp/rtp_session.cxx =================================================================== --- opal/branches/v3_16/src/rtp/rtp_session.cxx 2016-02-07 18:20:16 UTC (rev 34601) +++ opal/branches/v3_16/src/rtp/rtp_session.cxx 2016-02-07 18:26:43 UTC (rev 34602) @@ -1013,9 +1013,9 @@ report->jitter = m_jitterAccum >> JitterRoundingGuardBits; // Allow for rounding protection bits /* Time remote sent us in SR. Note this has to be IDENTICAL to what we - received in SR as some implementations (WebRTC!) do not use it as a NTP - time, but as a lookup key in a table to find the NTP value. Why? Why? Why? */ - report->lsr = m_ntpPassThrough; + received in SR as it is used as a de-facto sequence number for the + SR that was sent. We match RR's to SR's this way. */ + report->lsr = (uint32_t)(m_ntpPassThrough >> 16); // Delay since last received SR report->dlsr = m_lastSenderReportTime.IsValid() ? (uint32_t)((PTime() - m_lastSenderReportTime).GetMilliSeconds()*65536/1000) : 0; @@ -1083,22 +1083,25 @@ void OpalRTPSession::SyncSource::CalculateRTT(const PTime & reportTime, const PTimeInterval & reportDelay) { - if (reportTime.IsValid()) { - PTimeInterval myDelay = PTime() - reportTime; - if (m_session.m_roundTripTime > 0 && myDelay <= reportDelay) - PTRACE(4, &m_session, *this << "not calculating round trip time, RR arrived too soon after SR."); - else if (myDelay <= reportDelay) { - m_session.m_roundTripTime = 1; - PTRACE(4, &m_session, *this << "very small round trip time, using 1ms"); - } - else if (myDelay > 1000) { - PTRACE(4, &m_session, *this << "very large round trip time, ignoring"); - } - else { - m_session.m_roundTripTime = (myDelay - reportDelay).GetInterval(); - PTRACE(4, &m_session, *this << "determined round trip time: " << m_session.m_roundTripTime << "ms"); - } + if (!reportTime.IsValid()) { + PTRACE(4, &m_session, *this << "not calculating round trip time, NTP in RR does not match SR."); + return; } + + PTimeInterval myDelay = PTime() - reportTime; + if (m_session.m_roundTripTime > 0 && myDelay <= reportDelay) + PTRACE(4, &m_session, *this << "not calculating round trip time, RR arrived too soon after SR."); + else if (myDelay <= reportDelay) { + m_session.m_roundTripTime = 1; + PTRACE(4, &m_session, *this << "very small round trip time, using 1ms"); + } + else if (myDelay > 2000) { + PTRACE(4, &m_session, *this << "very large round trip time, ignoring"); + } + else { + m_session.m_roundTripTime = (myDelay - reportDelay).GetInterval(); + PTRACE(4, &m_session, *this << "determined round trip time: " << m_session.m_roundTripTime << "ms"); + } } @@ -1260,10 +1263,12 @@ sender.m_octets, receivers); + sender.m_ntpPassThrough = sender.m_reportAbsoluteTime.GetNTP(); sender.m_lastSenderReportTime.SetCurrentTime(); PTRACE(logLevel, sender << "sending " << forcedStr << "SenderReport:" " ntp=" << sender.m_reportAbsoluteTime.AsString(PTime::TodayFormat) + << " 0x" << hex << sender.m_ntpPassThrough << dec << " rtp=" << sender.m_reportTimestamp << " psent=" << sender.m_packets << " osent=" << sender.m_octets @@ -1855,18 +1860,23 @@ } -void OpalRTPSession::OnRxReceiverReport(RTP_SyncSourceId, const RTP_ReceiverReport & report) +void OpalRTPSession::OnRxReceiverReport(RTP_SyncSourceId ssrc, const RTP_ControlFrame::ReceiverReport & rr) { - PTRACE(m_throttleRxRR, *this << "OnReceiverReport: " << report << m_throttleRxSR); - - SyncSource * sender; - if (GetSyncSource(report.sourceIdentifier, e_Sender, sender)) { + SyncSource * sender = NULL; + if (CheckControlSSRC(ssrc, rr.ssrc, sender PTRACE_PARAM(, "RR"))) { + RTP_ReceiverReport report(rr, sender->m_ntpPassThrough); sender->OnRxReceiverReport(report); - m_connection.ExecuteMediaCommand(OpalMediaPacketLoss(report.fractionLost*100/255, m_mediaType, m_sessionId, report.sourceIdentifier), true); + OnRxReceiverReport(ssrc, report); } } +void OpalRTPSession::OnRxReceiverReport(RTP_SyncSourceId, const RTP_ReceiverReport & report) +{ + m_connection.ExecuteMediaCommand(OpalMediaPacketLoss(report.fractionLost * 100 / 255, m_mediaType, m_sessionId, report.sourceIdentifier), true); +} + + void OpalRTPSession::OnRxSourceDescription(const RTP_SourceDescriptionArray & PTRACE_PARAM(description)) { PTRACE(m_throttleRxSDES, *this << "OnSourceDescription: " << description.GetSize() << " entries" << description); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |