opalvoip-svn Mailing List for OpalVOIP (Page 14)
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-07 18:20:18
|
Revision: 34601 http://sourceforge.net/p/opalvoip/code/34601 Author: rjongbloed Date: 2016-02-07 18:20:16 +0000 (Sun, 07 Feb 2016) Log Message: ----------- 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 Property Changed: ---------------- ptlib/branches/v2_16/ Index: ptlib/branches/v2_16 =================================================================== --- ptlib/branches/v2_16 2016-02-07 17:53:43 UTC (rev 34600) +++ ptlib/branches/v2_16 2016-02-07 18:20:16 UTC (rev 34601) Property changes on: ptlib/branches/v2_16 ___________________________________________________________________ Modified: svn:mergeinfo ## -10,4 +10,4 ## /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 /ptlib/branches/v2_8:24034,24044,24046,24054,24060,24065,24084,24090,24113,24136,24142,24165-24166,24168,24172,24367,24372,24410,24540,24992 -/ptlib/trunk:34109-34115,34121,34140,34142-34143,34146-34149,34152-34154,34169,34171-34172,34180,34182,34184,34194,34219,34221,34231-34232,34244-34245,34254,34267-34268,34280-34284,34298-34315,34335,34344-34345,34347,34354-34356,34366,34379,34398,34405-34411,34418-34423,34493-34508 +/ptlib/trunk:34109-34115,34121,34140,34142-34143,34146-34149,34152-34154,34169,34171-34172,34180,34182,34184,34194,34219,34221,34231-34232,34244-34245,34254,34267-34268,34280-34284,34298-34315,34335,34344-34345,34347,34354-34356,34366,34379,34398,34405-34411,34418-34423,34493-34508,34581,34584 \ No newline at end of property Modified: ptlib/branches/v2_16/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-02-07 17:53:43 UTC (rev 34600) +++ ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-02-07 18:20:16 UTC (rev 34601) @@ -1264,18 +1264,22 @@ if (list == NULL) return; - /* Take out of timer list first, so when callback is waited for it's - completion it cannot then be called again. */ - list->m_timersMutex.Wait(); - list->m_timers.erase(m_handle); - list->m_timersMutex.Signal(); + unsigned retry = 0; + do { + /* Take out of timer list first, so when callback is waited for it's + completion it cannot then be called again. */ + list->m_timersMutex.Wait(); + PAssert(list->m_timers.erase(m_handle) == 1 || !m_running, PLogicError); + m_running = false; + list->m_timersMutex.Signal(); - m_running = false; + if (wait) { + m_callbackMutex.Wait(); + m_callbackMutex.Signal(); + } - if (wait) { - m_callbackMutex.Wait(); - m_callbackMutex.Signal(); - } + // We loop in case the callback function restarted the timer. + } while (m_running && PAssert(++retry < 5, PLogicError)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-07 17:53:46
|
Revision: 34600 http://sourceforge.net/p/opalvoip/code/34600 Author: rjongbloed Date: 2016-02-07 17:53:43 +0000 (Sun, 07 Feb 2016) Log Message: ----------- Changed no media timeout so is no media on ANY transport and not for ALL transports. Interoperability work around. Modified Paths: -------------- opal/branches/v3_16/include/opal/mediasession.h opal/branches/v3_16/src/opal/mediasession.cxx Modified: opal/branches/v3_16/include/opal/mediasession.h =================================================================== --- opal/branches/v3_16/include/opal/mediasession.h 2016-02-07 17:15:54 UTC (rev 34599) +++ opal/branches/v3_16/include/opal/mediasession.h 2016-02-07 17:53:43 UTC (rev 34600) @@ -458,6 +458,7 @@ bool m_remoteAddressSet; PINDEX m_packetSize; PTimeInterval m_mediaTimeout; + PSimpleTimer m_mediaTimer; PTimeInterval m_maxNoTransmitTime; bool m_started; Modified: opal/branches/v3_16/src/opal/mediasession.cxx =================================================================== --- opal/branches/v3_16/src/opal/mediasession.cxx 2016-02-07 17:15:54 UTC (rev 34599) +++ opal/branches/v3_16/src/opal/mediasession.cxx 2016-02-07 17:53:43 UTC (rev 34600) @@ -660,7 +660,6 @@ m_owner->InternalOnStart(m_subchannel); - PSimpleTimer noMediaTimer = m_owner->m_mediaTimeout; while (m_channel->IsOpen()) { PBYTEArray data(m_owner->m_packetSize); @@ -670,7 +669,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)) { @@ -688,7 +686,7 @@ break; case PChannel::Unavailable: - if (noMediaTimer.IsRunning()) { + if (m_owner->m_mediaTimer.IsRunning()) { HandleUnavailableError(); break; } @@ -762,6 +760,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); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-07 17:15:56
|
Revision: 34599 http://sourceforge.net/p/opalvoip/code/34599 Author: rjongbloed Date: 2016-02-07 17:15:54 +0000 (Sun, 07 Feb 2016) Log Message: ----------- Fixed differentiation between timeout and system shut down in C# API OpalContext::GetMessage() Modified Paths: -------------- opal/branches/v3_16/src/opal/opal_c.cxx Modified: opal/branches/v3_16/src/opal/opal_c.cxx =================================================================== --- opal/branches/v3_16/src/opal/opal_c.cxx 2016-02-06 14:01:45 UTC (rev 34598) +++ opal/branches/v3_16/src/opal/opal_c.cxx 2016-02-07 17:15:54 UTC (rev 34599) @@ -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,20 @@ } -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"); } + else + error = "Timeout getting message."; return msg; } @@ -2922,7 +2926,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 +2987,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-06 14:01:47
|
Revision: 34598 http://sourceforge.net/p/opalvoip/code/34598 Author: rjongbloed Date: 2016-02-06 14:01:45 +0000 (Sat, 06 Feb 2016) Log Message: ----------- Increase gatekeeper UDP RAS retries to 3, heavily loaded Avaya server misses them. Modified Paths: -------------- opal/trunk/src/h323/h323ep.cxx Modified: opal/trunk/src/h323/h323ep.cxx =================================================================== --- opal/trunk/src/h323/h323ep.cxx 2016-02-06 13:59:38 UTC (rev 34597) +++ opal/trunk/src/h323/h323ep.cxx 2016-02-06 14:01:45 UTC (rev 34598) @@ -93,7 +93,7 @@ , roundTripDelayTimeout(0, 10) // Seconds , roundTripDelayRate(0, 0, 1) // Minutes , gatekeeperRequestTimeout(0, 5) // Seconds - , gatekeeperRequestRetries(2) + , gatekeeperRequestRetries(3) , rasRequestTimeout(0, 3) // Seconds , rasRequestRetries(2) , registrationTimeToLive(0, 0, 10) // Minutes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-06 13:59:40
|
Revision: 34597 http://sourceforge.net/p/opalvoip/code/34597 Author: rjongbloed Date: 2016-02-06 13:59:38 +0000 (Sat, 06 Feb 2016) Log Message: ----------- Compensate for Avaya server race condition Modified Paths: -------------- opal/trunk/src/h323/h323.cxx Modified: opal/trunk/src/h323/h323.cxx =================================================================== --- opal/trunk/src/h323/h323.cxx 2016-02-06 13:59:06 UTC (rev 34596) +++ opal/trunk/src/h323/h323.cxx 2016-02-06 13:59:38 UTC (rev 34597) @@ -1305,6 +1305,9 @@ || memcmp(data_ptr, ringerSetEventInbound, sizeof ringerSetEventInbound) == 0) { PTRACE(4, "Avaya", "Received NonStandard UU Information event - Ringer Set - Sending line button press"); + + PThread::Sleep(1000); //Avaya server race ondition means we have to wait a bit + // Select answer button (0t7) SendNonStandardControl(H323EndPoint::AvayaPhone().oid + ".10", PBYTEArray(select_button, sizeof(select_button), false)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-06 13:59:08
|
Revision: 34596 http://sourceforge.net/p/opalvoip/code/34596 Author: rjongbloed Date: 2016-02-06 13:59:06 +0000 (Sat, 06 Feb 2016) Log Message: ----------- Make the assert dialog for GUI apps application modal so things don't try and continue in other threads, meaning log information can disappear over time. Modified Paths: -------------- ptlib/trunk/src/ptlib/msos/assert.cxx Modified: ptlib/trunk/src/ptlib/msos/assert.cxx =================================================================== --- ptlib/trunk/src/ptlib/msos/assert.cxx 2016-02-05 16:29:24 UTC (rev 34595) +++ ptlib/trunk/src/ptlib/msos/assert.cxx 2016-02-06 13:59:06 UTC (rev 34596) @@ -435,7 +435,7 @@ if (PProcess::Current().IsGUIProcess()) { PVarString msg = str; PVarString name = PProcess::Current().GetName(); - AssertAction(MessageBox(NULL, msg, name, MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_TASKMODAL)); + AssertAction(MessageBox(NULL, msg, name, MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_APPLMODAL)); } else { do { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-05 16:29:28
|
Revision: 34595 http://sourceforge.net/p/opalvoip/code/34595 Author: rjongbloed Date: 2016-02-05 16:29:24 +0000 (Fri, 05 Feb 2016) Log Message: ----------- Removed redundant parameters in trace log, not needed with thread local storage streams. 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-05 12:14:25 UTC (rev 34594) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-05 16:29:24 UTC (rev 34595) @@ -148,8 +148,6 @@ PTimeInterval m_startTick; PString m_rolloverPattern; unsigned m_lastRotate; - ios::fmtflags m_oldStreamFlags; - std::streamsize m_oldPrecision; #if defined(_WIN32) @@ -209,8 +207,6 @@ , m_startTick(PTimer::Tick()) , m_rolloverPattern(DefaultRollOverPattern) , m_lastRotate(0) - , m_oldStreamFlags(ios::left) - , m_oldPrecision(0) { InitMutex(); @@ -747,9 +743,6 @@ // Before we do new trace, make sure we clear any errors on the stream stream.clear(); - m_oldStreamFlags = stream.flags(); - m_oldPrecision = stream.precision(); - if (!HasOption(SystemLogStream)) { if (HasOption(DateAndTime)) { PTime now; @@ -853,9 +846,6 @@ { PTraceInfo::ThreadLocalInfo * threadInfo = PProcess::IsInitialised() ? m_threadStorage.Get() : NULL; - paramStream.flags(m_oldStreamFlags); - paramStream.precision(m_oldPrecision); - unsigned currentLevel; if (threadInfo != NULL && !threadInfo->m_traceStreams.IsEmpty()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-05 12:14:28
|
Revision: 34594 http://sourceforge.net/p/opalvoip/code/34594 Author: rjongbloed Date: 2016-02-05 12:14:25 +0000 (Fri, 05 Feb 2016) Log Message: ----------- Added make level symbol for if building with GCC sanitizer enabled. Modified Paths: -------------- ptlib/trunk/configure ptlib/trunk/configure.ac ptlib/trunk/make/ptlib_config.mak.in Modified: ptlib/trunk/configure =================================================================== --- ptlib/trunk/configure 2016-02-04 19:30:41 UTC (rev 34593) +++ ptlib/trunk/configure 2016-02-05 12:14:25 UTC (rev 34594) @@ -825,6 +825,8 @@ CXXCPP PTLIB_EXCEPTIONS HAS_EXCEPTIONS +HAS_THREAD_SANITIZER +HAS_ADDRESS_SANITIZER BISON PTLIB_VERSION PTLIB_STAGE @@ -7583,6 +7585,8 @@ if test "x$usable" = "xyes"; then : + HAS_ADDRESS_SANITIZER=1 + CFLAGS="-fsanitize=address -fno-omit-frame-pointer $CFLAGS" CXXFLAGS="-fsanitize=address -fno-omit-frame-pointer $CXXFLAGS" LDFLAGS="-fsanitize=address $LDFLAGS" @@ -7631,6 +7635,8 @@ if test "x$usable" = "xyes"; then : + HAS_THREAD_SANITIZER=1 + CPPFLAGS="-D__SANITIZE_THREAD__ $CPPFLAGS" CFLAGS="-fsanitize=thread -fno-omit-frame-pointer $CFLAGS" CXXFLAGS="-fsanitize=thread -fno-omit-frame-pointer $CXXFLAGS" Modified: ptlib/trunk/configure.ac =================================================================== --- ptlib/trunk/configure.ac 2016-02-04 19:30:41 UTC (rev 34593) +++ ptlib/trunk/configure.ac 2016-02-05 12:14:25 UTC (rev 34594) @@ -317,6 +317,7 @@ [], [], [ + AC_SUBST(HAS_ADDRESS_SANITIZER, 1) CFLAGS="-fsanitize=address -fno-omit-frame-pointer $CFLAGS" CXXFLAGS="-fsanitize=address -fno-omit-frame-pointer $CXXFLAGS" LDFLAGS="-fsanitize=address $LDFLAGS" @@ -335,6 +336,7 @@ [], [], [ + AC_SUBST(HAS_THREAD_SANITIZER, 1) CPPFLAGS="-D__SANITIZE_THREAD__ $CPPFLAGS" CFLAGS="-fsanitize=thread -fno-omit-frame-pointer $CFLAGS" CXXFLAGS="-fsanitize=thread -fno-omit-frame-pointer $CXXFLAGS" Modified: ptlib/trunk/make/ptlib_config.mak.in =================================================================== --- ptlib/trunk/make/ptlib_config.mak.in 2016-02-04 19:30:41 UTC (rev 34593) +++ ptlib/trunk/make/ptlib_config.mak.in 2016-02-05 12:14:25 UTC (rev 34594) @@ -98,6 +98,8 @@ PTLIB_PLUGIN_DIR := @PTLIB_PLUGIN_DIR@ P_PROFILING := @P_PROFILING@ +HAS_ADDRESS_SANITIZER := @HAS_ADDRESS_SANITIZER@ +HAS_THREAD_SANITIZER := @HAS_THREAD_SANITIZER@ HAS_NETWORKING := @HAS_NETWORKING@ HAS_IPV6 := @HAS_IPV6@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-04 19:30:44
|
Revision: 34593 http://sourceforge.net/p/opalvoip/code/34593 Author: rjongbloed Date: 2016-02-04 19:30:41 +0000 (Thu, 04 Feb 2016) Log Message: ----------- Applied patch #323 Fix ptlib and opal build without PTRACE, thanks Alexander Sverdlin 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-04 19:29:02 UTC (rev 34592) +++ ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2016-02-04 19:30:41 UTC (rev 34593) @@ -1316,7 +1316,9 @@ else { ExcessiveLockWait(); PAssertPTHREAD(pthread_mutex_lock, (&m_mutex)); +#if PTRACING PTRACE_BEGIN(0, "PTLib") << "Phantom deadlock in mutex " << *this << PTrace::End; +#endif } PPROFILE_POST_SYSTEM(); #else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-04 19:29:04
|
Revision: 34592 http://sourceforge.net/p/opalvoip/code/34592 Author: rjongbloed Date: 2016-02-04 19:29:02 +0000 (Thu, 04 Feb 2016) Log Message: ----------- Applied patches: #320 Use SetLastWriteCount() and SetLastReadCount() #321 sound_alsa: Drop memory zeroing in Read() #322 sound_alsa: Tracing improvements thanks Alexander Sverdlin Modified Paths: -------------- ptlib/trunk/plugins/sound_alsa/sound_alsa.cxx ptlib/trunk/plugins/sound_esd/sound_esd.cxx ptlib/trunk/plugins/sound_oss/sound_oss.cxx ptlib/trunk/plugins/sound_pulse/sound_pulse.cxx ptlib/trunk/plugins/sound_shm/sound_shm.cxx ptlib/trunk/plugins/sound_sunaudio/sound_sunaudio.cxx ptlib/trunk/src/ptclib/portaudio.cxx ptlib/trunk/src/ptlib/Nucleus++/NucleusConChan.cxx ptlib/trunk/src/ptlib/unix/beaudio.cxx Modified: ptlib/trunk/plugins/sound_alsa/sound_alsa.cxx =================================================================== --- ptlib/trunk/plugins/sound_alsa/sound_alsa.cxx 2016-02-04 19:21:30 UTC (rev 34591) +++ ptlib/trunk/plugins/sound_alsa/sound_alsa.cxx 2016-02-04 19:29:02 UTC (rev 34592) @@ -339,7 +339,7 @@ PBoolean PSoundChannelALSA::Write(const void *buf, PINDEX len) { - lastWriteCount = 0; + SetLastWriteCount(0); PWaitAndSignal m(device_mutex); @@ -348,6 +348,7 @@ int pos = 0, max_try = 0; const char * buf2 = (const char *)buf; + PINDEX ilen = len; do { /* the number of frames to read is the buffer length divided by the size of one frame */ @@ -356,11 +357,10 @@ if (r >= 0) { pos += r * frameBytes; len -= r * frameBytes; - lastWriteCount += r * frameBytes; } else { - PTRACE(5, "ALSA\tBuffer underrun detected. Recovering... "); if (r == -EPIPE) { /* under-run */ + PTRACE(5, "ALSA\tBuffer underrun detected. Recovering... "); r = snd_pcm_prepare(pcm_handle); PTRACE_IF(1, r < 0, "ALSA\tCould not prepare device: " << snd_strerror(r)); } @@ -379,29 +379,30 @@ } max_try++; - if (max_try > 5) + if (max_try > 5) { + SetLastWriteCount(ilen - len); return false; + } } } while (len > 0); + SetLastWriteCount(ilen); return true; } PBoolean PSoundChannelALSA::Read(void * buf, PINDEX len) { - lastReadCount = 0; + SetLastReadCount(0); PWaitAndSignal m(device_mutex); if (!SetHardwareParams()) return false; - memset((char *) buf, 0, len); - int pos = 0, max_try = 0; char * buf2 = (char *)buf; - + PINDEX ilen = len; do { /* the number of frames to read is the buffer length divided by the size of one frame */ @@ -410,29 +411,36 @@ if (r >= 0) { pos += r * frameBytes; len -= r * frameBytes; - lastReadCount += r * frameBytes; } else { - if (r == -EPIPE) { /* under-run */ + if (r == -EPIPE) { /* overrun */ + PTRACE(5, "ALSA\tBuffer overrun detected. Recovering..."); snd_pcm_prepare(pcm_handle); } else if (r == -ESTRPIPE) { + PTRACE(5, "ALSA\tInput suspended. Resuming... "); while ((r = snd_pcm_resume(pcm_handle)) == -EAGAIN) sleep(1); /* wait until the suspend flag is released */ - if (r < 0) + if (r < 0) { snd_pcm_prepare(pcm_handle); + PTRACE_IF(1, r < 0, "ALSA\tCould not prepare device: " << snd_strerror(r)); + } } + else { + PTRACE(1, "ALSA\tCould not read " << max_try << " " << len << " " << snd_strerror(r)); + } - PTRACE(1, "ALSA\tCould not read " << max_try << " " << len << " " << snd_strerror(r)); - max_try++; - if (max_try > 5) + if (max_try > 5) { + SetLastReadCount(ilen - len); return false; + } } } while (len > 0); + SetLastReadCount(ilen); return true; } Modified: ptlib/trunk/plugins/sound_esd/sound_esd.cxx =================================================================== --- ptlib/trunk/plugins/sound_esd/sound_esd.cxx 2016-02-04 19:21:30 UTC (rev 34591) +++ ptlib/trunk/plugins/sound_esd/sound_esd.cxx 2016-02-04 19:29:02 UTC (rev 34592) @@ -226,14 +226,18 @@ if (os_handle < 0) return false; - lastReadCount = 0; + PINDEX lastReadCount = 0; // keep looping until we have read 'len' bytes while (lastReadCount < len) { int retval = ::read(os_handle, ((char *)buf)+lastReadCount, len-lastReadCount); - if (retval <= 0) return false; + if (retval <= 0) { + SetLastReadCount(lastReadCount); + return false; + } lastReadCount += retval; } - return (true); + SetLastReadCount(len); + return true; } Modified: ptlib/trunk/plugins/sound_oss/sound_oss.cxx =================================================================== --- ptlib/trunk/plugins/sound_oss/sound_oss.cxx 2016-02-04 19:21:30 UTC (rev 34591) +++ ptlib/trunk/plugins/sound_oss/sound_oss.cxx 2016-02-04 19:29:02 UTC (rev 34592) @@ -480,7 +480,7 @@ PBoolean PSoundChannelOSS::Write(const void * buf, PINDEX len) { - lastWriteCount = 0; + SetLastWriteCount(0); if (!Setup() || os_handle < 0) return false; @@ -489,12 +489,10 @@ while (!ConvertOSError(::write(os_handle, (void *)buf, len))) if (GetErrorCode() != Interrupted) return false; - lastWriteCount += len; } else { // cut the data into 1K blocks and upsample it - lastWriteCount = 0; BYTE resampleBuffer[1024]; const BYTE * src = (const BYTE *)buf; const BYTE * srcEnd = src + len; @@ -512,21 +510,23 @@ } src += 2; } - lastWriteCount += src - srcStart; while (!ConvertOSError(::write(os_handle, resampleBuffer, dst - resampleBuffer))) { - if (GetErrorCode() != Interrupted) + if (GetErrorCode() != Interrupted) { + SetLastWriteCount(len - srcEnd + src); return false; + } } } } + SetLastWriteCount(len); return true; } PBoolean PSoundChannelOSS::Read(void * buf, PINDEX len) { - lastReadCount = 0; + SetLastReadCount(0); if (!Setup() || os_handle < 0) return false; @@ -548,7 +548,6 @@ PTRACE(6, "OSS\tRead completed short - " << total << " vs " << len << ". Reading more data"); } } - lastReadCount = total; } else { @@ -557,7 +556,6 @@ BYTE * dst = (BYTE *)buf; BYTE * dstEnd = dst + len; - lastReadCount = 0; PBYTEArray resampleBuffer((1024 / resampleRate) * resampleRate); @@ -572,8 +570,11 @@ { PINDEX bufLen = PMIN(resampleBuffer.GetSize(), srcBytes); while (!ConvertOSError(bytes = ::read(os_handle, resampleBuffer.GetPointer(), bufLen))) { - if (GetErrorCode() != Interrupted) + if (GetErrorCode() != Interrupted) { + SetLastReadCount(len - dstEnd + dst); + PTRACE(6, "OSS\tRead completed short - " << len - dstEnd + dst << " vs " << len); return false; + } } } @@ -588,16 +589,12 @@ } *(PUInt16l *)dst = sample / resampleRate; dst +=2 ; - lastReadCount += 2; } } } - if (lastReadCount != len) - PTRACE(6, "OSS\tRead completed short - " << lastReadCount << " vs " << len); - else - PTRACE(6, "OSS\tRead completed"); - + SetLastReadCount(len); + PTRACE(6, "OSS\tRead completed"); return true; } Modified: ptlib/trunk/plugins/sound_pulse/sound_pulse.cxx =================================================================== --- ptlib/trunk/plugins/sound_pulse/sound_pulse.cxx 2016-02-04 19:21:30 UTC (rev 34591) +++ ptlib/trunk/plugins/sound_pulse/sound_pulse.cxx 2016-02-04 19:29:02 UTC (rev 34592) @@ -317,7 +317,7 @@ buff+=ws; } - lastWriteCount = len; + SetLastWriteCount(len); PTRACE(6, "Pulse\tWrite completed"); return true; @@ -352,7 +352,7 @@ if (!record_len) pa_stream_drop(s); } - lastReadCount = len; + SetLastReadCount(len); PTRACE(6, "Pulse\tRead completed of " <<len << " bytes"); return true; Modified: ptlib/trunk/plugins/sound_shm/sound_shm.cxx =================================================================== --- ptlib/trunk/plugins/sound_shm/sound_shm.cxx 2016-02-04 19:21:30 UTC (rev 34591) +++ ptlib/trunk/plugins/sound_shm/sound_shm.cxx 2016-02-04 19:29:02 UTC (rev 34592) @@ -267,7 +267,7 @@ DPRINT(("ashm write %d len=%d fb=%d delay=%d\n", prinCounter, len, frameBytes, delay)); } - lastWriteCount = 0; + SetLastWriteCount(0); PWaitAndSignal m(device_mutex); if ((!isInitialised && !Setup()) || !len || !os_handle) @@ -275,8 +275,8 @@ writeSample( (void*)buf, len ); - m_Pacing.Delay(delay); - lastWriteCount = 640; //len; + m_Pacing.Delay(delay); + SetLastWriteCount(640); return true; } Modified: ptlib/trunk/plugins/sound_sunaudio/sound_sunaudio.cxx =================================================================== --- ptlib/trunk/plugins/sound_sunaudio/sound_sunaudio.cxx 2016-02-04 19:21:30 UTC (rev 34591) +++ ptlib/trunk/plugins/sound_sunaudio/sound_sunaudio.cxx 2016-02-04 19:29:02 UTC (rev 34592) @@ -268,7 +268,7 @@ PTRACE(6, "SunAudio\tWrite completed short - " << total << " vs " << length << ". Write more data"); } - lastWriteCount = total; + SetLastWriteCount(total); // Reset all the errors. return ConvertOSError(0, LastWriteError); @@ -355,6 +355,7 @@ while (!ConvertOSError(bytes = ::read(os_handle, (void *)(((unsigned char *)buffer) + total), length-total))) { if ((GetErrorCode() != Interrupted) || (os_handle < 0)) { + SetLastReadCount(total); PTRACE(6, "SunAudio\tRead failed"); return false; } @@ -366,13 +367,8 @@ PTRACE(6, "SunAudio\tRead completed short - " << total << " vs " << length << ". Reading more data"); } - lastReadCount = total; - - if (lastReadCount != length) - PTRACE(6, "SunAudio\tRead completed short - " << lastReadCount << " vs " << length); - else - PTRACE(6, "SunAudio\tRead completed"); - + SetLastReadCount(total); + PTRACE(6, "SunAudio\tRead completed"); return true; } Modified: ptlib/trunk/src/ptclib/portaudio.cxx =================================================================== --- ptlib/trunk/src/ptclib/portaudio.cxx 2016-02-04 19:21:30 UTC (rev 34591) +++ ptlib/trunk/src/ptclib/portaudio.cxx 2016-02-04 19:29:02 UTC (rev 34592) @@ -382,9 +382,9 @@ PTRACE(1, "PortAudio\tWrite error - not started"); return false; } - - lastWriteCount = size; + SetLastWriteCount(size); + #ifndef P_PORT_MIXER if (m_mute || (m_volume == 0)) { if (m_muteBuffer == NULL) { @@ -434,9 +434,9 @@ PTRACE(1, "PortAudio\tRead error - not started"); return false; } - - lastReadCount = size; + SetLastReadCount(size); + int err = Pa_ReadStream(m_stream, data, size / m_bytesPerSample); if (err != paNoError) { PTRACE(1, "PortAudio\tRead error " << Pa_GetErrorText(err)); Modified: ptlib/trunk/src/ptlib/Nucleus++/NucleusConChan.cxx =================================================================== --- ptlib/trunk/src/ptlib/Nucleus++/NucleusConChan.cxx 2016-02-04 19:21:30 UTC (rev 34591) +++ ptlib/trunk/src/ptlib/Nucleus++/NucleusConChan.cxx 2016-02-04 19:29:02 UTC (rev 34592) @@ -88,7 +88,8 @@ { flush(); cin >> (char *)buffer; - PINDEX buflen =lastReadCount = strlen((char *)buffer); + PINDEX buflen = strlen((char *)buffer); + SetLastReadCount(buflen); return buflen < length ? buflen : length; } Modified: ptlib/trunk/src/ptlib/unix/beaudio.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/beaudio.cxx 2016-02-04 19:21:30 UTC (rev 34591) +++ ptlib/trunk/src/ptlib/unix/beaudio.cxx 2016-02-04 19:29:02 UTC (rev 34592) @@ -1513,10 +1513,7 @@ // Wait until there is space mBuffer->WaitForState(CircularBuffer::EmptyEnough); - // This function needs to update the last write count - // Store len before it gets modified - lastWriteCount=len; - + PINDEX ilen = len; #ifdef FILEDUMP if (playwriter) { @@ -1527,13 +1524,11 @@ // Store data into the buffer mBuffer->Fill((const BYTE **)&buf, (size_t*) &len); - // Update last write count - lastWriteCount-=len; - - return true; - } - - return false; + SetLastWriteCount(ilen - len); + return true; + } + + 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-04 19:21:32
|
Revision: 34591 http://sourceforge.net/p/opalvoip/code/34591 Author: rjongbloed Date: 2016-02-04 19:21:30 +0000 (Thu, 04 Feb 2016) Log Message: ----------- Applied patch #323 Fix ptlib and opal build without PTRACE, thanks Alexander Sverdlin Modified Paths: -------------- opal/trunk/src/opal/manager.cxx Modified: opal/trunk/src/opal/manager.cxx =================================================================== --- opal/trunk/src/opal/manager.cxx 2016-02-04 11:54:52 UTC (rev 34590) +++ opal/trunk/src/opal/manager.cxx 2016-02-04 19:21:30 UTC (rev 34591) @@ -1443,13 +1443,10 @@ #endif // OPAL_SCRIPT -#if OPAL_SCRIPT void OpalManager::OnStartMediaPatch(OpalConnection & connection, OpalMediaPatch & patch) { +#if OPAL_SCRIPT OnStartStopMediaPatch(m_script, "OnStartMedia", connection, patch); -#else -void OpalManager::OnStartMediaPatch(OpalConnection & PTRACE_PARAM(connection), OpalMediaPatch & PTRACE_PARAM(patch)) -{ #endif PTRACE(3, "OnStartMediaPatch " << patch << " on " << connection); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-04 11:54:54
|
Revision: 34590 http://sourceforge.net/p/opalvoip/code/34590 Author: rjongbloed Date: 2016-02-04 11:54:52 +0000 (Thu, 04 Feb 2016) Log Message: ----------- Fixed string option indicating that we should accept any Sender SSRC in RTCP packets over SRTP. Now only accepts the first one, as others are correctly indicated in SDP and should not cross pollinate audio/video. This was primarily a workaround for Chrome WebRTC. Modified Paths: -------------- opal/trunk/include/rtp/srtp_session.h opal/trunk/src/rtp/rtp_session.cxx opal/trunk/src/rtp/srtp_session.cxx Modified: opal/trunk/include/rtp/srtp_session.h =================================================================== --- opal/trunk/include/rtp/srtp_session.h 2016-02-03 18:18:43 UTC (rev 34589) +++ opal/trunk/include/rtp/srtp_session.h 2016-02-04 11:54:52 UTC (rev 34590) @@ -51,9 +51,10 @@ /**String option key to a boolean indicating that we should accept - any Sender SSRC in RTCP packets over SRTP. This is primarily a - workaround for Chrome WebRTC, but leaves the system open to DoS - attack. Default false. + any Sender SSRC in the first RTCP packets when over SRTP. This is + primarily a workaround for Chrome WebRTC, which fails to put this in + the SDP. Note, this leaves the system open to possible DoS attack. + Default false. */ #define OPAL_OPT_SRTP_RTCP_ANY_SSRC "SRTP-RTCP-Any-SSRC" Modified: opal/trunk/src/rtp/rtp_session.cxx =================================================================== --- opal/trunk/src/rtp/rtp_session.cxx 2016-02-03 18:18:43 UTC (rev 34589) +++ opal/trunk/src/rtp/rtp_session.cxx 2016-02-04 11:54:52 UTC (rev 34590) @@ -207,7 +207,7 @@ return it->second; if ((force || m_allowAnySyncSource) && AddSyncSource(ssrc, dir) == ssrc) { - PTRACE(4, *this << "automatically added " << dir << " SSRC=" << RTP_TRACE_SRC(ssrc)); + PTRACE(4, *this << "automatically added " << GetMediaType() << ' ' << dir << " SSRC=" << RTP_TRACE_SRC(ssrc)); return m_SSRC.find(ssrc)->second; } Modified: opal/trunk/src/rtp/srtp_session.cxx =================================================================== --- opal/trunk/src/rtp/srtp_session.cxx 2016-02-03 18:18:43 UTC (rev 34589) +++ opal/trunk/src/rtp/srtp_session.cxx 2016-02-04 11:54:52 UTC (rev 34590) @@ -550,7 +550,7 @@ m_consecutiveErrors[i][j] = 0; } - m_anyRTCP_SSRC = m_stringOptions.GetBoolean(OPAL_OPT_SRTP_RTCP_ANY_SSRC, m_anyRTCP_SSRC); + m_anyRTCP_SSRC = GetSyncSourceIn() == 0 && m_stringOptions.GetBoolean(OPAL_OPT_SRTP_RTCP_ANY_SSRC, m_anyRTCP_SSRC); return OpalRTPSession::Open(localInterface, remoteAddress); } @@ -775,12 +775,26 @@ return OpalRTPSession::e_IgnorePacket; } + RTP_SyncSourceId ssrc = encoded.GetSenderSyncSource(); + bool force = false; + /* Need to have a receiver SSRC (their sender) or we can't decrypt the RTCP packet. Generally, the SSRC info created on the fly, unless we are using - later SDP and that is disabled. However, for Chrome, we have a special - case of SSRC=1 which they send even though never indicated in SDP. */ - RTP_SyncSourceId ssrc = encoded.GetSenderSyncSource(); - if (UseSyncSource(ssrc, e_Receiver, m_anyRTCP_SSRC) == NULL) + later SDP and that is disabled. This case is handed within useSyncSource. + However, for Chrome, we have a special cases of SSRC=1 for video and a + random number for audio, neither of which they indicate in the SDP when + in recvonly mode. So, we try and compensate. */ + if (m_anyRTCP_SSRC) { + if ((ssrc == 1) != (GetMediaType() == OpalMediaType::Video())) { + PTRACE(4, *this << "not automatically adding SSRC=" << RTP_TRACE_SRC(ssrc) << " for " << GetMediaType()); + return e_IgnorePacket; + } + + m_anyRTCP_SSRC = false; + force = true; + } + + if (UseSyncSource(ssrc, e_Receiver, force) == NULL) return e_IgnorePacket; RTP_ControlFrame decoded(encoded); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-03 18:18:45
|
Revision: 34589 http://sourceforge.net/p/opalvoip/code/34589 Author: rjongbloed Date: 2016-02-03 18:18:43 +0000 (Wed, 03 Feb 2016) Log Message: ----------- Fixed RTP NTP times in trace logs Modified Paths: -------------- opal/trunk/src/rtp/rtp.cxx Modified: opal/trunk/src/rtp/rtp.cxx =================================================================== --- opal/trunk/src/rtp/rtp.cxx 2016-02-03 17:47:20 UTC (rev 34588) +++ opal/trunk/src/rtp/rtp.cxx 2016-02-03 18:18:43 UTC (rev 34589) @@ -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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-03 17:47:23
|
Revision: 34588 http://sourceforge.net/p/opalvoip/code/34588 Author: rjongbloed Date: 2016-02-03 17:47:20 +0000 (Wed, 03 Feb 2016) Log Message: ----------- Fixed RTP round trip time calculation, checking SR to RR lsr field. Modified Paths: -------------- opal/trunk/include/rtp/rtp.h opal/trunk/include/rtp/rtp_session.h opal/trunk/src/rtp/rtp.cxx opal/trunk/src/rtp/rtp_session.cxx Modified: opal/trunk/include/rtp/rtp.h =================================================================== --- opal/trunk/include/rtp/rtp.h 2016-02-03 16:01:51 UTC (rev 34587) +++ opal/trunk/include/rtp/rtp.h 2016-02-03 17:47:20 UTC (rev 34588) @@ -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/trunk/include/rtp/rtp_session.h =================================================================== --- opal/trunk/include/rtp/rtp_session.h 2016-02-03 16:01:51 UTC (rev 34587) +++ opal/trunk/include/rtp/rtp_session.h 2016-02-03 17:47:20 UTC (rev 34588) @@ -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/trunk/src/rtp/rtp.cxx =================================================================== --- opal/trunk/src/rtp/rtp.cxx 2016-02-03 16:01:51 UTC (rev 34587) +++ opal/trunk/src/rtp/rtp.cxx 2016-02-03 17:47:20 UTC (rev 34588) @@ -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/trunk/src/rtp/rtp_session.cxx =================================================================== --- opal/trunk/src/rtp/rtp_session.cxx 2016-02-03 16:01:51 UTC (rev 34587) +++ opal/trunk/src/rtp/rtp_session.cxx 2016-02-03 17:47:20 UTC (rev 34588) @@ -1018,9 +1018,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; @@ -1091,22 +1091,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"); + } } @@ -1268,10 +1271,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 @@ -1875,16 +1880,23 @@ } -void OpalRTPSession::OnRxReceiverReport(RTP_SyncSourceId ssrc, const RTP_ReceiverReport & report) +void OpalRTPSession::OnRxReceiverReport(RTP_SyncSourceId ssrc, const RTP_ControlFrame::ReceiverReport & rr) { SyncSource * sender = NULL; - if (CheckControlSSRC(ssrc, report.sourceIdentifier, sender PTRACE_PARAM(, "RR"))) { + 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. |
From: <rjo...@us...> - 2016-02-03 16:01:53
|
Revision: 34587 http://sourceforge.net/p/opalvoip/code/34587 Author: rjongbloed Date: 2016-02-03 16:01:51 +0000 (Wed, 03 Feb 2016) Log Message: ----------- Use unique thread ID for thread local storage index to avoid pthread_t re-use issues. Modified Paths: -------------- ptlib/trunk/include/ptlib/thread.h ptlib/trunk/src/ptlib/common/osutils.cxx Modified: ptlib/trunk/include/ptlib/thread.h =================================================================== --- ptlib/trunk/include/ptlib/thread.h 2016-02-02 12:35:27 UTC (rev 34586) +++ ptlib/trunk/include/ptlib/thread.h 2016-02-03 16:01:51 UTC (rev 34587) @@ -442,7 +442,7 @@ virtual void Deallocate(void * ptr) const = 0; virtual void * GetStorage() const; private: - typedef std::map<PThreadIdentifier, void *> DataMap; + typedef std::map<PUniqueThreadIdentifier, void *> DataMap; mutable DataMap m_data; PCriticalSection m_mutex; }; Modified: ptlib/trunk/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-02 12:35:27 UTC (rev 34586) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-03 16:01:51 UTC (rev 34587) @@ -2872,7 +2872,7 @@ void PThread::LocalStorageBase::ThreadDestroyed(PThread & thread) { m_mutex.Wait(); - DataMap::iterator it = m_data.find(thread.GetThreadId()); + DataMap::iterator it = m_data.find(thread.GetUniqueIdentifier()); if (it != m_data.end()) { Deallocate(it->second); m_data.erase(it); @@ -2883,7 +2883,7 @@ void * PThread::LocalStorageBase::GetStorage() const { - PThreadIdentifier threadId = PThread::GetCurrentThreadId(); + PThreadIdentifier threadId = PThread::GetCurrentUniqueIdentifier(); PWaitAndSignal lock(m_mutex); DataMap::iterator it = m_data.find(threadId); if (it == m_data.end()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-02 12:35:29
|
Revision: 34586 http://sourceforge.net/p/opalvoip/code/34586 Author: rjongbloed Date: 2016-02-02 12:35:27 +0000 (Tue, 02 Feb 2016) Log Message: ----------- Added string option indicating that we should accept any Sender SSRC in RTCP packets over SRTP. This is primarily a workaround for Chrome WebRTC, but leaves the system open to DoS attack. Default false. Modified Paths: -------------- opal/trunk/include/rtp/srtp_session.h opal/trunk/src/rtp/srtp_session.cxx Modified: opal/trunk/include/rtp/srtp_session.h =================================================================== --- opal/trunk/include/rtp/srtp_session.h 2016-02-02 12:33:18 UTC (rev 34585) +++ opal/trunk/include/rtp/srtp_session.h 2016-02-02 12:35:27 UTC (rev 34586) @@ -50,6 +50,14 @@ struct srtp_ctx_t; +/**String option key to a boolean indicating that we should accept + any Sender SSRC in RTCP packets over SRTP. This is primarily a + workaround for Chrome WebRTC, but leaves the system open to DoS + attack. Default false. + */ +#define OPAL_OPT_SRTP_RTCP_ANY_SSRC "SRTP-RTCP-Any-SSRC" + + //////////////////////////////////////////////////////////////////// // // this class holds the parameters required for an SRTP session @@ -147,6 +155,7 @@ virtual void OnRxDataPacket(OpalMediaTransport & transport, PBYTEArray data); virtual void OnRxControlPacket(OpalMediaTransport & transport, PBYTEArray data); + bool m_anyRTCP_SSRC; struct srtp_ctx_t * m_context; std::set<RTP_SyncSourceId> m_addedStream; OpalSRTPKeyInfo * m_keyInfo[2]; // rx & tx Modified: opal/trunk/src/rtp/srtp_session.cxx =================================================================== --- opal/trunk/src/rtp/srtp_session.cxx 2016-02-02 12:33:18 UTC (rev 34585) +++ opal/trunk/src/rtp/srtp_session.cxx 2016-02-02 12:35:27 UTC (rev 34586) @@ -444,6 +444,7 @@ OpalSRTPSession::OpalSRTPSession(const Init & init) : OpalRTPSession(init) + , m_anyRTCP_SSRC(false) { CHECK_ERROR(srtp_create, (&m_context, NULL)); @@ -549,6 +550,8 @@ m_consecutiveErrors[i][j] = 0; } + m_anyRTCP_SSRC = m_stringOptions.GetBoolean(OPAL_OPT_SRTP_RTCP_ANY_SSRC, m_anyRTCP_SSRC); + return OpalRTPSession::Open(localInterface, remoteAddress); } @@ -777,7 +780,7 @@ later SDP and that is disabled. However, for Chrome, we have a special case of SSRC=1 which they send even though never indicated in SDP. */ RTP_SyncSourceId ssrc = encoded.GetSenderSyncSource(); - if (UseSyncSource(ssrc, e_Receiver, ssrc == 1) == NULL) + if (UseSyncSource(ssrc, e_Receiver, m_anyRTCP_SSRC) == NULL) return e_IgnorePacket; RTP_ControlFrame decoded(encoded); @@ -786,11 +789,11 @@ int len = decoded.GetSize(); SendReceiveStatus status = CheckConsecutiveErrors( - CHECK_ERROR( - srtp_unprotect_rtcp, (m_context, decoded.GetPointer(), &len), - this, ssrc - ), - e_Receiver, e_Control); + CHECK_ERROR( + srtp_unprotect_rtcp, (m_context, decoded.GetPointer(), &len), + this, ssrc + ), + e_Receiver, e_Control); if (status != e_ProcessPacket) return status; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-02 12:33:21
|
Revision: 34585 http://sourceforge.net/p/opalvoip/code/34585 Author: rjongbloed Date: 2016-02-02 12:33:18 +0000 (Tue, 02 Feb 2016) Log Message: ----------- Fixed RTP session trace log typo. 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-02 09:34:38 UTC (rev 34584) +++ opal/trunk/src/rtp/rtp_session.cxx 2016-02-02 12:33:18 UTC (rev 34585) @@ -1576,7 +1576,7 @@ OnRxReceiverReport(ssrc, rr[i]); } else { - PTRACE(m_throttleRxEmptyRR, this << "received empty ReceiverReport: sender SSRC=" << RTP_TRACE_SRC(ssrc)); + PTRACE(m_throttleRxEmptyRR, *this << "received empty ReceiverReport: sender SSRC=" << RTP_TRACE_SRC(ssrc)); } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-02 09:34:40
|
Revision: 34584 http://sourceforge.net/p/opalvoip/code/34584 Author: rjongbloed Date: 2016-02-02 09:34:38 +0000 (Tue, 02 Feb 2016) Log Message: ----------- Added fail safe assert so PTimer::Stop() cannot possibly get into endless loop, no matter how unlikely. 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-02 09:18:06 UTC (rev 34583) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-02 09:34:38 UTC (rev 34584) @@ -1264,6 +1264,7 @@ if (list == NULL) return; + unsigned retry = 0; do { /* Take out of timer list first, so when callback is waited for it's completion it cannot then be called again. */ @@ -1278,7 +1279,7 @@ } // We loop in case the callback function restarted the timer. - } while (m_running); + } while (m_running && PAssert(++retry < 5, PLogicError)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-02 09:18:08
|
Revision: 34583 http://sourceforge.net/p/opalvoip/code/34583 Author: rjongbloed Date: 2016-02-02 09:18:06 +0000 (Tue, 02 Feb 2016) Log Message: ----------- Add names to various timers. Modified Paths: -------------- opal/trunk/src/h224/h281.cxx opal/trunk/src/h323/h323.cxx opal/trunk/src/h323/h323neg.cxx opal/trunk/src/h323/h450pdu.cxx opal/trunk/src/h460/h460_std19.cxx opal/trunk/src/h460/h460_std24.cxx opal/trunk/src/im/sipim.cxx opal/trunk/src/t38/t38proto.cxx ptlib/trunk/src/ptclib/pxml.cxx ptlib/trunk/src/ptclib/vxml.cxx ptlib/trunk/src/ptlib/common/safecoll.cxx Modified: opal/trunk/src/h224/h281.cxx =================================================================== --- opal/trunk/src/h224/h281.cxx 2016-02-01 20:08:04 UTC (rev 34582) +++ opal/trunk/src/h224/h281.cxx 2016-02-02 09:18:06 UTC (rev 34583) @@ -344,9 +344,9 @@ m_transmitFrame.SetBS(true); m_transmitFrame.SetES(true); - m_continueTimer.SetNotifier(PCREATE_NOTIFIER(ContinueAction)); - m_stopTimer.SetNotifier(PCREATE_NOTIFIER(StopAction)); - m_receiveTimer.SetNotifier(PCREATE_NOTIFIER(ReceiveActionTimeout)); + m_continueTimer.SetNotifier(PCREATE_NOTIFIER(ContinueAction), "H281Continue"); + m_stopTimer.SetNotifier(PCREATE_NOTIFIER(StopAction), "H281Stop"); + m_receiveTimer.SetNotifier(PCREATE_NOTIFIER(ReceiveActionTimeout), "H281Receive"); } @@ -720,7 +720,7 @@ memset(m_videoInputDevices, 0, sizeof(m_videoInputDevices)); memset(m_step, 0, sizeof(m_step)); - m_stepTimer.SetNotifier(PCREATE_NOTIFIER(StepCamera)); + m_stepTimer.SetNotifier(PCREATE_NOTIFIER(StepCamera), "FECCStep"); } Modified: opal/trunk/src/h323/h323.cxx =================================================================== --- opal/trunk/src/h323/h323.cxx 2016-02-01 20:08:04 UTC (rev 34582) +++ opal/trunk/src/h323/h323.cxx 2016-02-02 09:18:06 UTC (rev 34583) @@ -149,7 +149,7 @@ PTRACE_CONTEXT_ID_TO(localCapabilities); PTRACE_CONTEXT_ID_TO(remoteCapabilities); - m_UserInputIndicationTimer.SetNotifier(PCREATE_NOTIFIER(UserInputIndicationTimeout)); + m_UserInputIndicationTimer.SetNotifier(PCREATE_NOTIFIER(UserInputIndicationTimeout), "UII"); localAliasNames.MakeUnique(); gkAccessTokenOID.MakeUnique(); Modified: opal/trunk/src/h323/h323neg.cxx =================================================================== --- opal/trunk/src/h323/h323neg.cxx 2016-02-01 20:08:04 UTC (rev 34582) +++ opal/trunk/src/h323/h323neg.cxx 2016-02-02 09:18:06 UTC (rev 34583) @@ -57,7 +57,7 @@ { PTRACE_CONTEXT_ID_FROM(conn); PTRACE_CONTEXT_ID_TO(replyTimer); - replyTimer.SetNotifier(PCREATE_NOTIFIER(HandleTimeoutUnlocked)); + replyTimer.SetNotifier(PCREATE_NOTIFIER(HandleTimeoutUnlocked), "H245Neg"); } Modified: opal/trunk/src/h323/h450pdu.cxx =================================================================== --- opal/trunk/src/h323/h450pdu.cxx 2016-02-01 20:08:04 UTC (rev 34582) +++ opal/trunk/src/h323/h450pdu.cxx 2016-02-02 09:18:06 UTC (rev 34583) @@ -795,7 +795,7 @@ CallToken = PString(); consultationTransfer = false; - ctTimer.SetNotifier(PCREATE_NOTIFIER(OnCallTransferTimeOut)); + ctTimer.SetNotifier(PCREATE_NOTIFIER(OnCallTransferTimeOut), "H450Transfer"); } @@ -1746,7 +1746,7 @@ ciState = e_ci_Idle; ciSendState = e_ci_sIdle; ciReturnState = e_ci_rIdle; - ciTimer.SetNotifier(PCREATE_NOTIFIER(OnCallIntrudeTimeOut)); + ciTimer.SetNotifier(PCREATE_NOTIFIER(OnCallIntrudeTimeOut), "H450Intrude"); } Modified: opal/trunk/src/h460/h460_std19.cxx =================================================================== --- opal/trunk/src/h460/h460_std19.cxx 2016-02-01 20:08:04 UTC (rev 34582) +++ opal/trunk/src/h460/h460_std19.cxx 2016-02-02 09:18:06 UTC (rev 34583) @@ -442,7 +442,7 @@ , m_keepAliveSequence(0) , m_multiplexedTransmit(false) { - m_keepAliveTimer.SetNotifier(PCREATE_NOTIFIER(KeepAliveTimeout)); + m_keepAliveTimer.SetNotifier(PCREATE_NOTIFIER(KeepAliveTimeout), "H460KeepAlive"); } Modified: opal/trunk/src/h460/h460_std24.cxx =================================================================== --- opal/trunk/src/h460/h460_std24.cxx 2016-02-01 20:08:04 UTC (rev 34582) +++ opal/trunk/src/h460/h460_std24.cxx 2016-02-02 09:18:06 UTC (rev 34583) @@ -278,7 +278,7 @@ , m_probeInfo("24.1") , m_probeNotifier(PCREATE_NOTIFIER(ProbeResponse)) { - m_probeTimer.SetNotifier(PCREATE_NOTIFIER(ProbeTimeout)); + m_probeTimer.SetNotifier(PCREATE_NOTIFIER(ProbeTimeout), "H460Probe"); } Modified: opal/trunk/src/im/sipim.cxx =================================================================== --- opal/trunk/src/im/sipim.cxx 2016-02-01 20:08:04 UTC (rev 34582) +++ opal/trunk/src/im/sipim.cxx 2016-02-02 09:18:06 UTC (rev 34583) @@ -240,8 +240,8 @@ { m_conversationId += ConversationIdSeparator + SIPURL::GenerateTag(); m_attributes.Set("acceptable-content-types", "text/plain\ntext/html\napplication/im-iscomposing+xml"); - m_rxCompositionIdleTimeout.SetNotifier(PCREATE_NOTIFIER(OnRxCompositionIdleTimer)); - m_txCompositionIdleTimeout.SetNotifier(PCREATE_NOTIFIER(OnTxCompositionIdleTimer)); + m_rxCompositionIdleTimeout.SetNotifier(PCREATE_NOTIFIER(OnRxCompositionIdleTimer), "SIPIMRx"); + m_txCompositionIdleTimeout.SetNotifier(PCREATE_NOTIFIER(OnTxCompositionIdleTimer), "SIPIMTx"); } Modified: opal/trunk/src/t38/t38proto.cxx =================================================================== --- opal/trunk/src/t38/t38proto.cxx 2016-02-01 20:08:04 UTC (rev 34582) +++ opal/trunk/src/t38/t38proto.cxx 2016-02-02 09:18:06 UTC (rev 34583) @@ -146,7 +146,7 @@ , m_rxPackets(0) , m_missingPackets(0) { - m_timerWriteDataIdle.SetNotifier(PCREATE_NOTIFIER(OnWriteDataIdle)); + m_timerWriteDataIdle.SetNotifier(PCREATE_NOTIFIER(OnWriteDataIdle), "T38Idle"); m_sentPacket->m_error_recovery.SetTag(T38_UDPTLPacket_error_recovery::e_secondary_ifp_packets); m_sentPacket->m_seq_number = (unsigned)-1; @@ -666,7 +666,7 @@ { SetFaxMediaFormatOptions(m_tiffFileFormat); - m_switchTimer.SetNotifier(PCREATE_NOTIFIER(OnSwitchTimeout)); + m_switchTimer.SetNotifier(PCREATE_NOTIFIER(OnSwitchTimeout), "T38Switch"); PTRACE(3, "FAX\tCreated fax connection with token \"" << callToken << "\"," " receiving=" << receiving << "," Modified: ptlib/trunk/src/ptclib/pxml.cxx =================================================================== --- ptlib/trunk/src/ptclib/pxml.cxx 2016-02-01 20:08:04 UTC (rev 34582) +++ ptlib/trunk/src/ptclib/pxml.cxx 2016-02-02 09:18:06 UTC (rev 34583) @@ -1016,7 +1016,7 @@ m_autoloadURL = url; m_autoLoadWaitTime = timeout; m_autoLoadError.MakeEmpty(); - m_autoLoadTimer.SetNotifier(PCREATE_NOTIFIER(AutoReloadTimeout)); + m_autoLoadTimer.SetNotifier(PCREATE_NOTIFIER(AutoReloadTimeout), "XMLReload"); bool stat = AutoLoadURL(); Modified: ptlib/trunk/src/ptclib/vxml.cxx =================================================================== --- ptlib/trunk/src/ptclib/vxml.cxx 2016-02-01 20:08:04 UTC (rev 34582) +++ ptlib/trunk/src/ptclib/vxml.cxx 2016-02-02 09:18:06 UTC (rev 34583) @@ -2346,7 +2346,7 @@ , m_field(field) , m_state(Idle) { - m_timer.SetNotifier(PCREATE_NOTIFIER(OnTimeout)); + m_timer.SetNotifier(PCREATE_NOTIFIER(OnTimeout), "VXMLGrammar"); SetSessionTimeout(); } Modified: ptlib/trunk/src/ptlib/common/safecoll.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/safecoll.cxx 2016-02-01 20:08:04 UTC (rev 34582) +++ ptlib/trunk/src/ptlib/common/safecoll.cxx 2016-02-02 09:18:06 UTC (rev 34583) @@ -415,7 +415,7 @@ return; m_deleteObjectsTimer = new PTimer(); - m_deleteObjectsTimer->SetNotifier(PCREATE_NOTIFIER(DeleteObjectsTimeout)); + m_deleteObjectsTimer->SetNotifier(PCREATE_NOTIFIER(DeleteObjectsTimeout), "SafeDelObj"); m_deleteObjectsTimer->RunContinuous(1000); // Every second #endif } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-01 20:08:07
|
Revision: 34582 http://sourceforge.net/p/opalvoip/code/34582 Author: rjongbloed Date: 2016-02-01 20:08:04 +0000 (Mon, 01 Feb 2016) Log Message: ----------- Put home brew thread local storage back, with fixes for previous race condition, as the the Win32 implementation of TLS is too limited. Modified Paths: -------------- ptlib/trunk/include/ptlib/thread.h ptlib/trunk/src/ptlib/common/osutils.cxx Modified: ptlib/trunk/include/ptlib/thread.h =================================================================== --- ptlib/trunk/include/ptlib/thread.h 2016-02-01 17:52:50 UTC (rev 34581) +++ ptlib/trunk/include/ptlib/thread.h 2016-02-01 20:08:04 UTC (rev 34582) @@ -433,7 +433,8 @@ class LocalStorageBase { public: - virtual ~LocalStorageBase(); + virtual ~LocalStorageBase() { } + void ThreadDestroyed(PThread & thread); protected: LocalStorageBase(); void StorageDestroyed(); @@ -441,13 +442,9 @@ virtual void Deallocate(void * ptr) const = 0; virtual void * GetStorage() const; private: - std::list<void *> m_data; -#if defined(_WIN32) - typedef DWORD KeyType; -#elif defined(P_PTHREADS) - typedef pthread_key_t KeyType; -#endif - KeyType m_key; + typedef std::map<PThreadIdentifier, void *> DataMap; + mutable DataMap m_data; + PCriticalSection m_mutex; }; private: Modified: ptlib/trunk/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-01 17:52:50 UTC (rev 34581) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-01 20:08:04 UTC (rev 34582) @@ -2816,6 +2816,12 @@ } +#define RELEASE_THREAD_LOCAL_STORAGE 1 +#if RELEASE_THREAD_LOCAL_STORAGE +static std::set<PThread::LocalStorageBase*> s_ThreadLocalStorage; +static PCriticalSection s_ThreadLocalStorageMutex; +#endif + PThread::~PThread() { if (m_type != e_IsProcess && m_type != e_IsExternal && !WaitForTermination(100)) @@ -2823,6 +2829,13 @@ PTRACE(5, "Destroying thread " << this << ' ' << m_threadName << ", id=" << m_threadId); +#if RELEASE_THREAD_LOCAL_STORAGE + s_ThreadLocalStorageMutex.Wait(); + for (std::set<PThread::LocalStorageBase*>::iterator it = s_ThreadLocalStorage.begin(); it != s_ThreadLocalStorage.end(); ++it) + (*it)->ThreadDestroyed(*this); + s_ThreadLocalStorageMutex.Signal(); +#endif + InternalDestroy(); if (m_type != e_IsProcess) @@ -2830,61 +2843,54 @@ } -void PThread::LocalStorageBase::StorageDestroyed() -{ - for (std::list<void *>::iterator it = m_data.begin(); it != m_data.end(); ++it) - Deallocate(*it); -} - - -#if defined(_WIN32) - PThread::LocalStorageBase::LocalStorageBase() { - m_key = TlsAlloc(); - PAssert(m_key != TLS_OUT_OF_INDEXES, POperatingSystemError); +#if RELEASE_THREAD_LOCAL_STORAGE + s_ThreadLocalStorageMutex.Wait(); + s_ThreadLocalStorage.insert(this); + s_ThreadLocalStorageMutex.Signal(); +#endif } -PThread::LocalStorageBase::~LocalStorageBase() +void PThread::LocalStorageBase::StorageDestroyed() { - TlsFree(m_key); -} +#if RELEASE_THREAD_LOCAL_STORAGE + s_ThreadLocalStorageMutex.Wait(); + s_ThreadLocalStorage.erase(this); + s_ThreadLocalStorageMutex.Signal(); +#endif - -void * PThread::LocalStorageBase::GetStorage() const -{ - void * tls = TlsGetValue(m_key); - if (tls == NULL && PAssert(GetLastError() == ERROR_SUCCESS, POperatingSystemError)) - TlsSetValue(m_key, tls = Allocate()); - return tls; + m_mutex.Wait(); + for (DataMap::iterator it = m_data.begin(); it != m_data.end(); ++it) + Deallocate(it->second); + m_mutex.Signal(); } -#elif defined(P_PTHREADS) -PThread::LocalStorageBase::LocalStorageBase() +void PThread::LocalStorageBase::ThreadDestroyed(PThread & thread) { - PAssert(pthread_key_create(&m_key, NULL) == 0, POperatingSystemError); + m_mutex.Wait(); + DataMap::iterator it = m_data.find(thread.GetThreadId()); + if (it != m_data.end()) { + Deallocate(it->second); + m_data.erase(it); + } + m_mutex.Signal(); } -PThread::LocalStorageBase::~LocalStorageBase() -{ - pthread_key_delete(m_key); -} - - void * PThread::LocalStorageBase::GetStorage() const { - void * tls = pthread_getspecific(m_key); - if (tls == NULL) - pthread_setspecific(m_key, tls = Allocate()); - return tls; + PThreadIdentifier threadId = PThread::GetCurrentThreadId(); + PWaitAndSignal lock(m_mutex); + DataMap::iterator it = m_data.find(threadId); + if (it == m_data.end()) + it = m_data.insert(make_pair(threadId, Allocate())).first; + return it->second; } -#endif - ///////////////////////////////////////////////////////////////////////////// PSimpleThread::PSimpleThread(const PNotifier & notifier, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-02-01 17:52:52
|
Revision: 34581 http://sourceforge.net/p/opalvoip/code/34581 Author: rjongbloed Date: 2016-02-01 17:52:50 +0000 (Mon, 01 Feb 2016) Log Message: ----------- Fixed race condition when stopping timer, especially form destructor, where if it times out and the callback function starts the timer again. 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-01-31 16:47:49 UTC (rev 34580) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-02-01 17:52:50 UTC (rev 34581) @@ -1264,17 +1264,21 @@ if (list == NULL) return; - /* Take out of timer list first, so when callback is waited for it's - completion it cannot then be called again. */ - list->m_timersMutex.Wait(); - PAssert(list->m_timers.erase(m_handle) == 1 || !m_running, PLogicError); - m_running = false; - list->m_timersMutex.Signal(); + do { + /* Take out of timer list first, so when callback is waited for it's + completion it cannot then be called again. */ + list->m_timersMutex.Wait(); + PAssert(list->m_timers.erase(m_handle) == 1 || !m_running, PLogicError); + m_running = false; + list->m_timersMutex.Signal(); - if (wait) { - m_callbackMutex.Wait(); - m_callbackMutex.Signal(); - } + if (wait) { + m_callbackMutex.Wait(); + m_callbackMutex.Signal(); + } + + // We loop in case the callback function restarted the timer. + } while (m_running); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-01-31 16:47:52
|
Revision: 34580 http://sourceforge.net/p/opalvoip/code/34580 Author: rjongbloed Date: 2016-01-31 16:47:49 +0000 (Sun, 31 Jan 2016) Log Message: ----------- Avoid assert on endless wait for thread end when H.323 "maintainConnection" used on Avaya special. Modified Paths: -------------- opal/trunk/src/h323/h323.cxx Modified: opal/trunk/src/h323/h323.cxx =================================================================== --- opal/trunk/src/h323/h323.cxx 2016-01-31 16:32:28 UTC (rev 34579) +++ opal/trunk/src/h323/h323.cxx 2016-01-31 16:47:49 UTC (rev 34580) @@ -356,10 +356,9 @@ // Do not close m_signallingChannel as H323Endpoint can take it back for possible re-use if (m_signallingChannel != NULL) { - if (m_maintainConnection) { + if (m_maintainConnection && endpoint.GetProductInfo() != H323EndPoint::AvayaPhone()) { PTRACE(4, "H323\tMaintaining signalling channel."); m_signallingChannel->SetReadTimeout(MonitorCallStartTime); - m_signallingChannel->AttachThread(NULL); } else { PTRACE(4, "H323\tClosing signalling channel."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-01-31 16:32:31
|
Revision: 34579 http://sourceforge.net/p/opalvoip/code/34579 Author: rjongbloed Date: 2016-01-31 16:32:28 +0000 (Sun, 31 Jan 2016) Log Message: ----------- Merged revision(s) 34573-34578 from opal/branches/v3_16: Do not use no media timeout on the control port, as some dumb endpoints never send RTCP packets, and others send to the media port despite no SDP for rtcp-mux. Modified Paths: -------------- opal/trunk/src/opal/mediasession.cxx Property Changed: ---------------- opal/trunk/ Index: opal/trunk =================================================================== --- opal/trunk 2016-01-31 16:28:50 UTC (rev 34578) +++ opal/trunk 2016-01-31 16:32:28 UTC (rev 34579) 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-34572 +/opal/branches/v3_16:34090-34578 /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-01-31 16:28:50 UTC (rev 34578) +++ opal/trunk/src/opal/mediasession.cxx 2016-01-31 16:32:28 UTC (rev 34579) @@ -1051,7 +1051,8 @@ PIPAddress remoteIP; remoteAddress.GetIpAddress(remoteIP); - PTRACE(4, session << "opening: interface=\"" << localInterface << "\" local=" << bindingIP << " remote=" << remoteIP); + PTRACE(4, session << "opening " << subchannelCount << " subchannel(s):" + " interface=\"" << localInterface << "\" local=" << bindingIP << " remote=" << remoteIP); #if OPAL_PTLIB_NAT if (!manager.IsLocalAddress(remoteIP)) { @@ -1130,8 +1131,10 @@ for (size_t subchannel = 0; subchannel < m_subchannels.size(); ++subchannel) { PUDPSocket & socket = *GetSubChannelAsSocket((SubChannels)subchannel); PTRACE_CONTEXT_ID_TO(socket); - socket.SetReadTimeout(m_mediaTimeout); + if (subchannel != e_Control) + socket.SetReadTimeout(m_mediaTimeout); + // Increase internal buffer size on media UDP sockets SetMinBufferSize(socket, SO_RCVBUF, session.GetMediaType() == OpalMediaType::Audio() ? 0x4000 : 0x100000); SetMinBufferSize(socket, SO_SNDBUF, 0x2000); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-01-31 16:28:53
|
Revision: 34578 http://sourceforge.net/p/opalvoip/code/34578 Author: rjongbloed Date: 2016-01-31 16:28:50 +0000 (Sun, 31 Jan 2016) Log Message: ----------- Merged revision(s) 34550-34577 from ptlib/branches/v2_16: Fixed handling of VXML <if> statement. Failed when last element in if was compound and condition was false, last elements sub-elements where executed. Modified Paths: -------------- ptlib/trunk/src/ptclib/vxml.cxx Property Changed: ---------------- ptlib/trunk/ Index: ptlib/trunk =================================================================== --- ptlib/trunk 2016-01-31 15:50:00 UTC (rev 34577) +++ ptlib/trunk 2016-01-31 16:28:50 UTC (rev 34578) 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-34549 +/ptlib/branches/v2_16:34085-34577 /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/src/ptclib/vxml.cxx =================================================================== --- ptlib/trunk/src/ptclib/vxml.cxx 2016-01-31 15:50:00 UTC (rev 34577) +++ ptlib/trunk/src/ptclib/vxml.cxx 2016-01-31 16:28:50 UTC (rev 34578) @@ -1994,15 +1994,11 @@ if (GetVar(condition.Left(location).Trim()) == GetVar(condition.Mid(location + 2).Trim())) { PTRACE(4, "VXML\tCondition matched \"" << condition << '"'); + return true; } - else { - PTRACE(4, "VXMLSess\t\tCondition \"" << condition << "\"did not match"); - if (element.HasSubObjects()) - // Step to last child element (really last element is NULL?) - m_currentNode = element.GetElement(element.GetSize() - 1); - } - return true; + PTRACE(4, "VXML\t\tCondition \"" << condition << "\"did not match"); + return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-01-31 15:50:03
|
Revision: 34577 http://sourceforge.net/p/opalvoip/code/34577 Author: rjongbloed Date: 2016-01-31 15:50:00 +0000 (Sun, 31 Jan 2016) Log Message: ----------- Do not use no media timeout on the control port, as some dumb endpoints never send RTCP packets, and others send to the media port despite no SDP for rtcp-mux. 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-01-31 15:04:16 UTC (rev 34576) +++ opal/branches/v3_16/src/opal/mediasession.cxx 2016-01-31 15:50:00 UTC (rev 34577) @@ -1051,7 +1051,8 @@ PIPAddress remoteIP; remoteAddress.GetIpAddress(remoteIP); - PTRACE(4, session << "opening: interface=\"" << localInterface << "\" local=" << bindingIP << " remote=" << remoteIP); + PTRACE(4, session << "opening " << subchannelCount << " subchannel(s):" + " interface=\"" << localInterface << "\" local=" << bindingIP << " remote=" << remoteIP); #if OPAL_PTLIB_NAT if (!manager.IsLocalAddress(remoteIP)) { @@ -1130,8 +1131,10 @@ for (size_t subchannel = 0; subchannel < m_subchannels.size(); ++subchannel) { PUDPSocket & socket = *GetSubChannelAsSocket((SubChannels)subchannel); PTRACE_CONTEXT_ID_TO(socket); - socket.SetReadTimeout(m_mediaTimeout); + if (subchannel != e_Control) + socket.SetReadTimeout(m_mediaTimeout); + // Increase internal buffer size on media UDP sockets SetMinBufferSize(socket, SO_RCVBUF, session.GetMediaType() == OpalMediaType::Audio() ? 0x4000 : 0x100000); SetMinBufferSize(socket, SO_SNDBUF, 0x2000); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |