opalvoip-svn Mailing List for OpalVOIP (Page 2)
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-08-01 13:00:50
|
Revision: 34901 http://sourceforge.net/p/opalvoip/code/34901 Author: rjongbloed Date: 2016-08-01 13:00:48 +0000 (Mon, 01 Aug 2016) Log Message: ----------- Merged revision(s) 34894-34900 from ptlib/branches/v2_16: Fixed build with exception handling on. Modified Paths: -------------- ptlib/trunk/src/ptlib/common/object.cxx Property Changed: ---------------- ptlib/trunk/ Index: ptlib/trunk =================================================================== --- ptlib/trunk 2016-08-01 12:52:33 UTC (rev 34900) +++ ptlib/trunk 2016-08-01 13:00:48 UTC (rev 34901) 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-34893 +/ptlib/branches/v2_16:34085-34900 /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/ptlib/common/object.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/object.cxx 2016-08-01 12:52:33 UTC (rev 34900) +++ ptlib/trunk/src/ptlib/common/object.cxx 2016-08-01 13:00:48 UTC (rev 34901) @@ -128,6 +128,7 @@ int errorCode = errno; #endif + const char * env; #if P_EXCEPTIONS //Throw a runtime exception if the environment variable is set env = ::getenv("PTLIB_ASSERT_EXCEPTION"); @@ -163,7 +164,7 @@ str = strm.str(); } - const char * env = ::getenv("PTLIB_ASSERT_ACTION"); + env = ::getenv("PTLIB_ASSERT_ACTION"); if (env == NULL) env = ::getenv("PWLIB_ASSERT_ACTION"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-01 12:52:35
|
Revision: 34900 http://sourceforge.net/p/opalvoip/code/34900 Author: rjongbloed Date: 2016-08-01 12:52:33 +0000 (Mon, 01 Aug 2016) Log Message: ----------- Fixed build with exception handling on. Modified Paths: -------------- ptlib/branches/v2_16/src/ptlib/common/object.cxx Modified: ptlib/branches/v2_16/src/ptlib/common/object.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/common/object.cxx 2016-08-01 12:32:27 UTC (rev 34899) +++ ptlib/branches/v2_16/src/ptlib/common/object.cxx 2016-08-01 12:52:33 UTC (rev 34900) @@ -128,6 +128,7 @@ int errorCode = errno; #endif + const char * env; #if P_EXCEPTIONS //Throw a runtime exception if the environment variable is set env = ::getenv("PTLIB_ASSERT_EXCEPTION"); @@ -163,7 +164,7 @@ str = strm.str(); } - const char * env = ::getenv("PTLIB_ASSERT_ACTION"); + env = ::getenv("PTLIB_ASSERT_ACTION"); if (env == NULL) env = ::getenv("PWLIB_ASSERT_ACTION"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-01 12:32:30
|
Revision: 34899 http://sourceforge.net/p/opalvoip/code/34899 Author: rjongbloed Date: 2016-08-01 12:32:27 +0000 (Mon, 01 Aug 2016) Log Message: ----------- Added extra logging for when PSecureHTTPServiceProcess redirects http to https Modified Paths: -------------- ptlib/trunk/src/ptclib/shttpsvc.cxx Modified: ptlib/trunk/src/ptclib/shttpsvc.cxx =================================================================== --- ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-08-01 09:30:56 UTC (rev 34898) +++ ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-08-01 12:32:27 UTC (rev 34899) @@ -183,7 +183,7 @@ } PBoolean PSecureHTTPServiceProcess::OnDetectedNonSSLConnection(PChannel * chan, const PString & line) -{ +{ // get the MIME info PMIMEInfo mime(*chan); @@ -214,7 +214,10 @@ } } - PString str = CreateNonSSLMessage(PString("http://") + url); + url.Splice("http://", 0); + PSYSTEMLOG(Info, "Detected non-SSL connection, redirecting to " << url); + + PString str = CreateNonSSLMessage(url); chan->WriteString(str); chan->Close(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-01 09:30:59
|
Revision: 34898 http://sourceforge.net/p/opalvoip/code/34898 Author: rjongbloed Date: 2016-08-01 09:30:56 +0000 (Mon, 01 Aug 2016) Log Message: ----------- Fixed build with video Modified Paths: -------------- opal/branches/v3_16/samples/callgen/main.cxx Modified: opal/branches/v3_16/samples/callgen/main.cxx =================================================================== --- opal/branches/v3_16/samples/callgen/main.cxx 2016-08-01 08:38:17 UTC (rev 34897) +++ opal/branches/v3_16/samples/callgen/main.cxx 2016-08-01 09:30:56 UTC (rev 34898) @@ -611,6 +611,7 @@ } +#if OPAL_VIDEO PFile * MyLocalEndPoint::OpenVideoFile() const { if (m_videoFilePath.IsEmpty()) @@ -627,6 +628,7 @@ delete file; return NULL; } +#endif // OPAL_VIDEO OpalLocalConnection * MyLocalEndPoint::CreateConnection(OpalCall & call, void * userData, unsigned options, OpalConnection::StringOptions * stringOptions) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-08-01 08:38:19
|
Revision: 34897 http://sourceforge.net/p/opalvoip/code/34897 Author: rjongbloed Date: 2016-08-01 08:38:17 +0000 (Mon, 01 Aug 2016) Log Message: ----------- Fixed merge error Modified Paths: -------------- opal/branches/v3_16/src/rtp/rtp_session.cxx Modified: opal/branches/v3_16/src/rtp/rtp_session.cxx =================================================================== --- opal/branches/v3_16/src/rtp/rtp_session.cxx 2016-07-30 16:27:03 UTC (rev 34896) +++ opal/branches/v3_16/src/rtp/rtp_session.cxx 2016-08-01 08:38:17 UTC (rev 34897) @@ -2508,8 +2508,9 @@ CheckMediaFailed(e_Control); } else { - RTP_DataFrame frame(data); - if (OnPreReceiveData(frame) == e_AbortTransport) + RTP_DataFrame frame; + frame.PBYTEArray::operator=(data); + if (OnReceiveData(frame, data.GetSize()) == e_AbortTransport) CheckMediaFailed(e_Data); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-30 16:27:05
|
Revision: 34896 http://sourceforge.net/p/opalvoip/code/34896 Author: rjongbloed Date: 2016-07-30 16:27:03 +0000 (Sat, 30 Jul 2016) Log Message: ----------- Back ported some changes to fix deadlocks and crashes in media thread handling. Modified Paths: -------------- opal/branches/v3_16/include/opal/mediasession.h opal/branches/v3_16/src/opal/mediasession.cxx opal/branches/v3_16/src/rtp/rtp_session.cxx Modified: opal/branches/v3_16/include/opal/mediasession.h =================================================================== --- opal/branches/v3_16/include/opal/mediasession.h 2016-07-30 16:04:18 UTC (rev 34895) +++ opal/branches/v3_16/include/opal/mediasession.h 2016-07-30 16:27:03 UTC (rev 34896) @@ -461,6 +461,7 @@ PTimeInterval m_mediaTimeout; PSimpleTimer m_mediaTimer; PTimeInterval m_maxNoTransmitTime; + atomic<bool> m_opened; bool m_started; struct Transport Modified: opal/branches/v3_16/src/opal/mediasession.cxx =================================================================== --- opal/branches/v3_16/src/opal/mediasession.cxx 2016-07-30 16:04:18 UTC (rev 34895) +++ opal/branches/v3_16/src/opal/mediasession.cxx 2016-07-30 16:27:03 UTC (rev 34896) @@ -512,6 +512,7 @@ , m_packetSize(2048) , m_mediaTimeout(0, 0, 5) // Nothing received for 5 minutes , m_maxNoTransmitTime(0, 10) // Sending data for 10 seconds, ICMP says still not there + , m_opened(false) , m_started(false) { } @@ -525,15 +526,7 @@ bool OpalMediaTransport::IsOpen() const { - PSafeLockReadOnly lock(*this); - if (!lock.IsLocked() || m_subchannels.empty()) - return false; - - for (vector<Transport>::const_iterator it = m_subchannels.begin(); it != m_subchannels.end(); ++it) { - if (it->m_channel == NULL || !it->m_channel->IsOpen()) - return false; - } - return true; + return m_opened; } @@ -841,7 +834,7 @@ bool OpalTCPMediaTransport::Open(OpalMediaSession &, PINDEX, const PString & localInterface, const OpalTransportAddress &) { - return dynamic_cast<PTCPSocket &>(*m_subchannels[0].m_channel).Listen(PIPAddress(localInterface)); + return m_opened = dynamic_cast<PTCPSocket &>(*m_subchannels[0].m_channel).Listen(PIPAddress(localInterface)); } @@ -1158,6 +1151,7 @@ } m_mediaTimer = m_mediaTimeout; + m_opened = true; return true; } Modified: opal/branches/v3_16/src/rtp/rtp_session.cxx =================================================================== --- opal/branches/v3_16/src/rtp/rtp_session.cxx 2016-07-30 16:04:18 UTC (rev 34895) +++ opal/branches/v3_16/src/rtp/rtp_session.cxx 2016-07-30 16:27:03 UTC (rev 34896) @@ -194,6 +194,7 @@ if (it->second->m_direction == e_Sender) it->second->SendBYE(); + PTRACE(3, *this << "removed " << it->second->m_direction << " SSRC=" << RTP_TRACE_SRC(ssrc)); delete it->second; m_SSRC.erase(it); return true; @@ -207,7 +208,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; } @@ -781,6 +782,8 @@ void OpalRTPSession::InternalAttachTransport(const OpalMediaTransportPtr & newTransport PTRACE_PARAM(, const char * from)) { OpalMediaSession::AttachTransport(newTransport); + if (!IsOpen()) + return; newTransport->AddReadNotifier(m_dataNotifier, e_Data); if (!m_singlePortRx) @@ -2345,17 +2348,19 @@ { PTRACE(3, *this << "closing RTP."); + m_reportTimer.Stop(true); + m_endpoint.RegisterLocalRTP(this, true); + if (IsOpen() && LockReadOnly()) { for (SyncSourceMap::iterator it = m_SSRC.begin(); it != m_SSRC.end(); ++it) { - if (it->second->m_direction == e_Sender && it->second->m_packets > 0) - it->second->SendBYE(); + if ( it->second->m_direction == e_Sender && + it->second->m_packets > 0 && + it->second->SendBYE() == e_AbortTransport) + break; } UnlockReadOnly(); } - m_reportTimer.Stop(true); - m_endpoint.RegisterLocalRTP(this, true); - return OpalMediaSession::Close(); } @@ -2503,9 +2508,8 @@ CheckMediaFailed(e_Control); } else { - RTP_DataFrame frame; - frame.PBYTEArray::operator=(data); - if (OnReceiveData(frame, data.GetSize()) == e_AbortTransport) + RTP_DataFrame frame(data); + if (OnPreReceiveData(frame) == e_AbortTransport) CheckMediaFailed(e_Data); } } @@ -2618,7 +2622,7 @@ /* Really should test if both data and control fail, but as it is unlikely we would get one failed without the other, we don't bother. */ if (subchannel == e_Data && m_connection.OnMediaFailed(m_sessionId)) { - PTRACE(3, *this << "aborting transport, queuing close of media session."); + PTRACE(2, *this << "aborting transport, queuing close of media session."); m_manager.QueueDecoupledEvent(new PSafeWorkNoArg<OpalRTPSession, bool>(this, &OpalRTPSession::Close)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-30 16:04:20
|
Revision: 34895 http://sourceforge.net/p/opalvoip/code/34895 Author: rjongbloed Date: 2016-07-30 16:04:18 +0000 (Sat, 30 Jul 2016) Log Message: ----------- Merged revision(s) 34850-34893 from opal/branches/v3_16: --------------------- r34878 Fixed some issues in RTP playback: Reset sequence numbers on change of SSRC. Restore original RTP packet if failed to find out of order on. Improve some logging. Fix compile without trace logging. --------------------- r34877 FIxed incorrect payload type in MS-ADPCM codec. --------------------- r34868 Applied patch for some older MSVC compilers, thanks Cameron Elliott --------------------- r34866 Patch for bug #555 "Deadlock during end call while recording", thanks Kevin Verfaille --------------------- r34863 Allow for OpalRecordManager based recorders to operate without a background thread. APplication is expected to call the "push" functions at the right time for correct operation. --------------------- r34862 Increased range for detection of duplicate packets when decoding PCAP file. Also enhanced the trace logging during the discovery phase. --------------------- r34861 Fixed step button enable in OpalShark Revision Links: -------------- http://sourceforge.net/p/opalvoip/code/34878 http://sourceforge.net/p/opalvoip/code/34877 http://sourceforge.net/p/opalvoip/code/34868 http://sourceforge.net/p/opalvoip/code/34866 http://sourceforge.net/p/opalvoip/code/34863 http://sourceforge.net/p/opalvoip/code/34862 http://sourceforge.net/p/opalvoip/code/34861 Modified Paths: -------------- opal/trunk/include/ep/opalmixer.h opal/trunk/include/opal/recording.h opal/trunk/include/rtp/metrics.h opal/trunk/include/rtp/pcapfile.h opal/trunk/plugins/audio/IMA_ADPCM/ima_adpcm.c opal/trunk/samples/opalshark/main.cxx opal/trunk/src/ep/opalmixer.cxx opal/trunk/src/opal/mediasession.cxx opal/trunk/src/opal/recording.cxx opal/trunk/src/rtp/metrics.cxx opal/trunk/src/rtp/pcapfile.cxx Property Changed: ---------------- opal/trunk/ Index: opal/trunk =================================================================== --- opal/trunk 2016-07-30 16:04:14 UTC (rev 34894) +++ opal/trunk 2016-07-30 16:04:18 UTC (rev 34895) 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-34849 +/opal/branches/v3_16:34090-34893 /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/ep/opalmixer.h =================================================================== --- opal/trunk/include/ep/opalmixer.h 2016-07-30 16:04:14 UTC (rev 34894) +++ opal/trunk/include/ep/opalmixer.h 2016-07-30 16:04:18 UTC (rev 34895) @@ -142,8 +142,16 @@ /**Start the push thread. Normally called internally. */ - void StartPushThread(); + virtual void StartPushThread(); + /**Push collected input through the mixer to output. + This would normally be called from a thread, on a metronomic basis, + from a thread started via StartPushThread(), however if m_pushThread + is false, that thread is suppressed and it is expected the + application would call this function as required. + */ + virtual bool OnPush(); + /**Stop the push thread. This will wait for th epush thread to terminate, so care must be taken to avoid deadlocks when calling. @@ -166,7 +174,6 @@ virtual bool MixStreams(RTP_DataFrame & frame) = 0; virtual size_t GetOutputSize() const = 0; - virtual bool OnPush(); void PushThreadMain(); bool m_pushThread; // true if to use a thread to push data out Modified: opal/trunk/include/opal/recording.h =================================================================== --- opal/trunk/include/opal/recording.h 2016-07-30 16:04:14 UTC (rev 34894) +++ opal/trunk/include/opal/recording.h 2016-07-30 16:04:18 UTC (rev 34895) @@ -101,20 +101,21 @@ unsigned m_videoRate; /**< Video mixer output frame rate. This is independent of the input frame rates. */ #endif + bool m_pushThreads; ///< Indicate push threads are to be started an operate in background Options( bool stereo = true, #if OPAL_VIDEO VideoMode videoMixing = eSideBySideLetterbox, #endif - const char * audioFormat = NULL + const char * audioFormat = NULL, #if OPAL_VIDEO - , const char * videoFormat = NULL, unsigned width = PVideoFrameInfo::CIFWidth, unsigned height = PVideoFrameInfo::CIFHeight, - unsigned rate = 15 + unsigned rate = 15, #endif + bool pushThreads = true ) : m_stereo(stereo) , m_audioFormat(audioFormat) #if OPAL_VIDEO @@ -124,6 +125,7 @@ , m_videoHeight(height) , m_videoRate(rate) #endif + , m_pushThreads(pushThreads) { } }; @@ -176,6 +178,10 @@ const PString & strmId ///< Identifier for media stream. ) = 0; + /** Push audio through the mixer. + */ + virtual bool OnPushAudio() = 0; + /**Write audio to the recording file. */ virtual bool WriteAudio( @@ -184,6 +190,10 @@ ) = 0; #if OPAL_VIDEO + /** Push video through the mixer. + */ + virtual bool OnPushVideo() = 0; + /**Write video to the recording file. */ virtual bool WriteVideo( Modified: opal/trunk/include/rtp/metrics.h =================================================================== --- opal/trunk/include/rtp/metrics.h 2016-07-30 16:04:14 UTC (rev 34894) +++ opal/trunk/include/rtp/metrics.h 2016-07-30 16:04:18 UTC (rev 34895) @@ -287,15 +287,15 @@ */ TimePeriod CreateTimePeriod( PeriodType type, ///< The type of period (burst or gap). - PTime beginTimestamp, ///< Beginning of period timestamp. - PTime endTimestamp ///< End of period timestamp. + const PTime & beginTimestamp, ///< Beginning of period timestamp. + const PTime & endTimestamp ///< End of period timestamp. ); /**Create a period of time with an Id value associated. */ IdPeriod CreateIdPeriod( - PTime beginTimestamp, ///< Beginning of period timestamp. - PTime endTimestamp ///< End of period timestamp. + const PTime & beginTimestamp, ///< Beginning of period timestamp. + const PTime & endTimestamp ///< End of period timestamp. ); /**Create a period of time with an Ie value associated. Modified: opal/trunk/include/rtp/pcapfile.h =================================================================== --- opal/trunk/include/rtp/pcapfile.h 2016-07-30 16:04:14 UTC (rev 34894) +++ opal/trunk/include/rtp/pcapfile.h 2016-07-30 16:04:18 UTC (rev 34895) @@ -70,9 +70,11 @@ { OpalTranscoder * m_transcoder; RTP_SequenceNumber m_lastSequenceNumber; + RTP_SyncSourceId m_lastSSRC; DecodeContext() : m_transcoder(NULL) , m_lastSequenceNumber(0) + , m_lastSSRC(0) { } ~DecodeContext(); }; @@ -115,6 +117,7 @@ DiscoveredRTPKey(); Comparison Compare(const PObject & obj) const; + void PrintOn(ostream & strm) const; }; struct DiscoveredRTPInfo : DiscoveredRTPKey { Modified: opal/trunk/plugins/audio/IMA_ADPCM/ima_adpcm.c =================================================================== --- opal/trunk/plugins/audio/IMA_ADPCM/ima_adpcm.c 2016-07-30 16:04:14 UTC (rev 34894) +++ opal/trunk/plugins/audio/IMA_ADPCM/ima_adpcm.c 2016-07-30 16:04:18 UTC (rev 34895) @@ -427,7 +427,7 @@ PluginCodec_MediaTypeAudio | // audio codec PluginCodec_InputTypeRaw | // raw input data PluginCodec_OutputTypeRaw | // raw output data - PluginCodec_RTPTypeExplicit, // specified RTP type + PluginCodec_RTPTypeDynamic, // specified RTP type desc, // text decription L16Desc, // source format Modified: opal/trunk/samples/opalshark/main.cxx =================================================================== --- opal/trunk/samples/opalshark/main.cxx 2016-07-30 16:04:14 UTC (rev 34894) +++ opal/trunk/samples/opalshark/main.cxx 2016-07-30 16:04:18 UTC (rev 34895) @@ -773,7 +773,6 @@ m_stop->Enable(); m_pause->Enable(); m_resume->Disable(); - m_step->Enable(); m_analyse->Disable(); StartPlaying(CtlRunning); @@ -795,7 +794,6 @@ m_stop->Disable(); m_pause->Disable(); m_resume->Disable(); - m_step->Disable(); m_analyse->Enable(); } Modified: opal/trunk/src/ep/opalmixer.cxx =================================================================== --- opal/trunk/src/ep/opalmixer.cxx 2016-07-30 16:04:14 UTC (rev 34894) +++ opal/trunk/src/ep/opalmixer.cxx 2016-07-30 16:04:18 UTC (rev 34895) @@ -223,6 +223,7 @@ void OpalBaseMixer::StopPushThread(bool lock) { + m_threadRunning = false; PThread::WaitAndDelete(m_workerThread, 5000, &m_mutex, lock); } Modified: opal/trunk/src/opal/mediasession.cxx =================================================================== --- opal/trunk/src/opal/mediasession.cxx 2016-07-30 16:04:14 UTC (rev 34894) +++ opal/trunk/src/opal/mediasession.cxx 2016-07-30 16:04:18 UTC (rev 34895) @@ -335,7 +335,7 @@ } -static PString InternalTimeDiff(PTime lastUpdate, const PTime & previousUpdate) +static PString InternalTimeDiff(const PTime & lastUpdate, const PTime & previousUpdate) { if (previousUpdate.IsValid()) return ((lastUpdate.IsValid() ? lastUpdate : PTime()) - previousUpdate).AsString(); Modified: opal/trunk/src/opal/recording.cxx =================================================================== --- opal/trunk/src/opal/recording.cxx 2016-07-30 16:04:14 UTC (rev 34894) +++ opal/trunk/src/opal/recording.cxx 2016-07-30 16:04:18 UTC (rev 34895) @@ -57,6 +57,8 @@ virtual bool Close(); virtual bool OpenStream(const PString & strmId, const OpalMediaFormat & format); virtual bool CloseStream(const PString & strmId); + virtual bool OnPushAudio(); + virtual bool OnPushVideo(); virtual bool WriteAudio(const PString & strmId, const RTP_DataFrame & rtp); virtual bool WriteVideo(const PString & strmId, const RTP_DataFrame & rtp); @@ -156,6 +158,19 @@ } +bool OpalWAVRecordManager::OnPushAudio() +{ + PWaitAndSignal mutex(m_mutex); + return m_mixer != NULL && m_mixer->OnPush(); +} + + +bool OpalWAVRecordManager::OnPushVideo() +{ + return false; +} + + bool OpalWAVRecordManager::WriteAudio(const PString & strm, const RTP_DataFrame & rtp) { PWaitAndSignal mutex(m_mutex); @@ -222,8 +237,14 @@ protected: struct AudioMixer : public OpalAudioMixer { - AudioMixer(OpalAVIRecordManager & manager, bool stereo) - : OpalAudioMixer(stereo), m_manager(manager) { } + AudioMixer( + OpalAVIRecordManager & manager, + bool stereo, + unsigned sampleRate, + bool pushThread + ) : OpalAudioMixer(stereo, sampleRate, pushThread) + , m_manager(manager) + { } ~AudioMixer() { StopPushThread(); } virtual bool OnMixed(RTP_DataFrame * & output) { return m_manager.OnMixedAudio(*output); } OpalAVIRecordManager & m_manager; @@ -231,8 +252,16 @@ struct VideoMixer : public OpalVideoMixer { - VideoMixer(OpalAVIRecordManager & manager, OpalVideoMixer::Styles style, unsigned width, unsigned height) - : OpalVideoMixer(style, width, height), m_manager(manager) { } + VideoMixer( + OpalAVIRecordManager & manager, + OpalVideoMixer::Styles style, + unsigned width, + unsigned height, + unsigned rate, + bool pushThread + ) : OpalVideoMixer(style, width, height, rate, pushThread) + , m_manager(manager) + { } ~VideoMixer() { StopPushThread(); } virtual bool OnMixed(RTP_DataFrame * & output) { return m_manager.OnMixedVideo(*output); } OpalAVIRecordManager & m_manager; @@ -247,6 +276,8 @@ virtual bool Close(); virtual bool OpenStream(const PString & strmId, const OpalMediaFormat & format); virtual bool CloseStream(const PString & strmId); + virtual bool OnPushAudio(); + virtual bool OnPushVideo(); virtual bool WriteAudio(const PString & strmId, const RTP_DataFrame & rtp); virtual bool WriteVideo(const PString & strmId, const RTP_DataFrame & rtp); @@ -408,7 +439,10 @@ if (IS_RESULT_ERROR(AVIFileOpen(&m_file, fn, OF_WRITE|OF_CREATE, NULL), "creating AVI file")) return false; - m_audioMixer = new AudioMixer(*this, m_options.m_stereo); + m_audioMixer = new AudioMixer(*this, + m_options.m_stereo, + 8000, // Really need to make this more flexible .... + m_options.m_pushThreads); OpalVideoMixer::Styles style; switch (m_options.m_videoMixing) { @@ -435,7 +469,12 @@ return false; } - m_videoMixer = new VideoMixer(*this, style, m_options.m_videoWidth, m_options.m_videoHeight); + m_videoMixer = new VideoMixer(*this, + style, + m_options.m_videoWidth, + m_options.m_videoHeight, + m_options.m_videoRate, + m_options.m_pushThreads); PTRACE(4, (m_options.m_stereo ? "Stereo" : "Mono") << "-PCM/" << m_options.m_videoFormat << "-Video mixers opened for file \"" << fn << '"'); @@ -522,6 +561,20 @@ } +bool OpalAVIRecordManager::OnPushAudio() +{ + PWaitAndSignal mutex(m_mutex); + return m_audioMixer != NULL && m_audioMixer->OnPush(); +} + + +bool OpalAVIRecordManager::OnPushVideo() +{ + PWaitAndSignal mutex(m_mutex); + return m_videoMixer != NULL && m_videoMixer->OnPush(); +} + + bool OpalAVIRecordManager::WriteAudio(const PString & strmId, const RTP_DataFrame & rtp) { PWaitAndSignal mutex(m_mutex); Modified: opal/trunk/src/rtp/metrics.cxx =================================================================== --- opal/trunk/src/rtp/metrics.cxx 2016-07-30 16:04:14 UTC (rev 34894) +++ opal/trunk/src/rtp/metrics.cxx 2016-07-30 16:04:18 UTC (rev 34895) @@ -465,7 +465,7 @@ } -RTCP_XR_Metrics::TimePeriod RTCP_XR_Metrics::CreateTimePeriod(PeriodType type, PTime beginTimestamp, PTime endTimestamp) +RTCP_XR_Metrics::TimePeriod RTCP_XR_Metrics::CreateTimePeriod(PeriodType type, const PTime & beginTimestamp, const PTime & endTimestamp) { TimePeriod newPeriod; @@ -478,7 +478,7 @@ } -RTCP_XR_Metrics::IdPeriod RTCP_XR_Metrics::CreateIdPeriod(PTime beginTimestamp, PTime endTimestamp) +RTCP_XR_Metrics::IdPeriod RTCP_XR_Metrics::CreateIdPeriod(const PTime & beginTimestamp, const PTime & endTimestamp) { IdPeriod newPeriod; Modified: opal/trunk/src/rtp/pcapfile.cxx =================================================================== --- opal/trunk/src/rtp/pcapfile.cxx 2016-07-30 16:04:14 UTC (rev 34894) +++ opal/trunk/src/rtp/pcapfile.cxx 2016-07-30 16:04:18 UTC (rev 34895) @@ -64,9 +64,13 @@ : m_filterSSRC(0) { OpalMediaFormatList list = OpalMediaFormat::GetAllRegisteredMediaFormats(); - for (PINDEX i = 0; i < list.GetSize(); i++) { - if (list[i].GetPayloadType() < RTP_DataFrame::DynamicBase) - m_payloadType2mediaFormat[list[i].GetPayloadType()] = list[i]; + for (OpalMediaFormatList::iterator it = list.begin(); it != list.end(); ++it) { + OpalMediaFormat fmt = *it; + if (fmt.GetPayloadType() < RTP_DataFrame::LastKnownPayloadType) { + RTP_DataFrame::PayloadTypes pt = fmt.GetPayloadType(); + m_payloadType2mediaFormat[pt] = fmt; + PTRACE(4, "Pre-defined payload type " << pt << " set to " << fmt); + } } } @@ -276,31 +280,39 @@ return -2; } + RTP_SyncSourceId thisSSRC = encodedRTP.GetSyncSource(); RTP_SequenceNumber thisSequenceNumber = encodedRTP.GetSequenceNumber(); RTP_SequenceNumber expectedSequenceNumber = context.m_lastSequenceNumber + 1; RTP_SequenceNumber sequenceDelta = thisSequenceNumber - expectedSequenceNumber; if (context.m_lastSequenceNumber != 0) { - if (sequenceDelta > (1<<16)-100) { - PTRACE(3, "Skipping duplicate or out of order RTP packet " << thisSequenceNumber); + if (context.m_lastSSRC != thisSSRC) { + PTRACE(3, "Changed SSRC, restarting RTP sequence numbers from " << thisSequenceNumber); + } + else if (sequenceDelta > (1<<16)-500) { + PTRACE(3, "Skipping duplicate or out of order RTP packet " << thisSequenceNumber << ", expected " << expectedSequenceNumber); return 0; } - - if (sequenceDelta > 3000) + else if (sequenceDelta > 3000) PTRACE(3, "Restarting RTP sequence numbers from " << thisSequenceNumber); else if (sequenceDelta > 0) { bool missing = true; - off_t nextPacketsFilePosition = GetPosition(); // Scan ahead 100 packets looking for out of order one for (PINDEX i = 0; i < 100; ++i) { - if (GetRTP(encodedRTP) >= 0 && encodedRTP.GetSequenceNumber() == thisSequenceNumber) { - // Found it, move file back to the packet we just read, to read again next time - SetPosition(thisPacketsFilePosition); + if (GetRTP(encodedRTP) >= 0 && encodedRTP.GetSequenceNumber() == expectedSequenceNumber) { + PTRACE(3, "Restoring out of order packet at " << expectedSequenceNumber); missing = false; + break; } } + + /* If found move back to position so is read next time, then the one we + are using now is skipped as out of order. If not found we read it + again immediately. */ + SetPosition(thisPacketsFilePosition); + if (missing) { - SetPosition(nextPacketsFilePosition); + GetRTP(encodedRTP); encodedRTP.SetDiscontinuity(sequenceDelta); PTRACE(3, "Detected " << sequenceDelta << " missing RTP packets:" " expected=" << expectedSequenceNumber << ", got=" << thisSequenceNumber); @@ -309,6 +321,7 @@ } context.m_lastSequenceNumber = thisSequenceNumber; + context.m_lastSSRC = thisSSRC; RTP_DataFrameList output; if (!context.m_transcoder->ConvertFrames(encodedRTP, output)) @@ -345,6 +358,12 @@ } +void OpalPCAPFile::DiscoveredRTPKey::PrintOn(ostream & strm) const +{ + strm << m_src << " -> " << m_dst << " SSRC=" << m_ssrc; +} + + OpalPCAPFile::DiscoveredRTPInfo::DiscoveredRTPInfo() : m_payloadType(RTP_DataFrame::IllegalPayloadType) { @@ -421,16 +440,22 @@ bool Finalise(DiscoveredRTPInfo & info, const PayloadMap & payloadType2mediaFormat) { - if (m_totalPackets < 100) // Not worth worrying about + if (m_totalPackets < 100) { // Not worth worrying about + PTRACE(4, &info, "Not enough packets (" << m_totalPackets << ") for " << info); return false; + } - unsigned matchThreshold = m_totalPackets*4/5; // 80% + unsigned matchThreshold = m_totalPackets/2; // 50% - if (m_matchedSequenceNumber < matchThreshold) // Most of them consecutive + if (m_matchedSequenceNumber < matchThreshold) { // Most of them consecutive + PTRACE(4, &info, "Not enough consecutive sequence numbers (" << m_matchedSequenceNumber << ") for " << info); return false; + } - if (m_matchedTimestamps < matchThreshold) // Most of them consecutive + if (m_matchedTimestamps < matchThreshold) { // Most of them monotonic increasing + PTRACE(4, &info, "Not enough monotonic timestamps (" << m_matchedTimestamps << ") for " << info); return false; + } unsigned maxPayloadTypeCount = 0; for (map<RTP_DataFrame::PayloadTypes, unsigned>::iterator it = m_payloadTypes.begin(); it != m_payloadTypes.end(); ++it) { @@ -439,8 +464,10 @@ info.m_payloadType = it->first; } } - if (maxPayloadTypeCount < m_totalPackets/2) + if (maxPayloadTypeCount < matchThreshold) { + PTRACE(4, &info, "Not enough with same payload type (" << maxPayloadTypeCount << ") for " << info); return false; + } // look for known types PayloadMap::const_iterator pt2mf = payloadType2mediaFormat.find(info.m_payloadType); @@ -495,7 +522,7 @@ if (!Restart()) return false; - PTRACE(4, "Starting RTP discovery"); + PTRACE(3, "Starting RTP discovery"); map<DiscoveredRTPKey, DiscoveryInfo> discoveryMap; @@ -519,10 +546,12 @@ key.m_ssrc = rtp.GetSyncSource(); map<DiscoveredRTPKey, DiscoveryInfo>::iterator it; - if ((it = discoveryMap.find(key)) == discoveryMap.end()) + if ((it = discoveryMap.find(key)) != discoveryMap.end()) + it->second.ProcessPacket(rtp); + else { discoveryMap.insert(make_pair(key, rtp)); - else - it->second.ProcessPacket(rtp); + PTRACE(4, "Adding RTP discovery possibility: " << key); + } } PTRACE(4, "Finalising RTP discovery: " << discoveryMap.size() << " possibilities"); @@ -535,7 +564,7 @@ delete info; } - PTRACE(4, "Completed RTP discovery: " << discoveredRTP << " streams"); + PTRACE(3, "Completed RTP discovery: " << discoveredRTP << " streams"); return Restart(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-30 16:04:16
|
Revision: 34894 http://sourceforge.net/p/opalvoip/code/34894 Author: rjongbloed Date: 2016-07-30 16:04:14 +0000 (Sat, 30 Jul 2016) Log Message: ----------- Merged revision(s) 34858-34893 from ptlib/branches/v2_16: --------------------- r34891 Fix possibility of recursive PAssert on win32 platform. Also normalised mutex/recursion control for Assert and StackWalk to platform independent code. --------------------- r34883 Update readme files. --------------------- r34867 Fixed being able to have multiple web servers using same SSL certificate "subject". --------------------- r34860 Improved trace logging around DLL load failure. --------------------- r34859 Enhancements to thread sample (and regression test) application. Thanks Derek Smithies. Revision Links: -------------- http://sourceforge.net/p/opalvoip/code/34891 http://sourceforge.net/p/opalvoip/code/34883 http://sourceforge.net/p/opalvoip/code/34867 http://sourceforge.net/p/opalvoip/code/34860 http://sourceforge.net/p/opalvoip/code/34859 Modified Paths: -------------- ptlib/trunk/ReadMe.txt ptlib/trunk/include/ptlib/object.h ptlib/trunk/samples/threadex/Makefile ptlib/trunk/samples/threadex/main.cxx ptlib/trunk/samples/threadex/main.h ptlib/trunk/src/ptclib/pssl.cxx ptlib/trunk/src/ptlib/common/object.cxx ptlib/trunk/src/ptlib/common/osutils.cxx ptlib/trunk/src/ptlib/msos/assert.cxx ptlib/trunk/src/ptlib/msos/win32.cxx ptlib/trunk/src/ptlib/unix/assert.cxx Removed Paths: ------------- ptlib/trunk/README_VXWORKS.txt ptlib/trunk/ReadMe.MingW32.txt ptlib/trunk/ReadMe_PortAudio.txt Property Changed: ---------------- ptlib/trunk/ Index: ptlib/trunk =================================================================== --- ptlib/trunk 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk 2016-07-30 16:04:14 UTC (rev 34894) 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-34857 +/ptlib/branches/v2_16:34085-34893 /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 Deleted: ptlib/trunk/README_VXWORKS.txt =================================================================== --- ptlib/trunk/README_VXWORKS.txt 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk/README_VXWORKS.txt 2016-07-30 16:04:14 UTC (rev 34894) @@ -1,100 +0,0 @@ -Cummulative VxWorks patch for PWLIB -=================================== -Patch is done against CVS-snapshot dated: 9 juli 2004 - -This patch includes VxWorks specific updates (platform and compiler), -including a minor general update. - - -Disclaimer -========== -We have not yet thoroughly tested this patch-set against the latest -PWLIB. However all patches are already use in our 30-channel IP-gateway -product, which is using Openh323 based on version 1.10.4 (PWLib:1.4.4) -with some general community bugfixes added and is running very stable. -Our VxWorks environment is Tornado 2.1.1 for MIPS platform building the -MIPS images on Windows platform. - - -Patch history -============= -- Added Mozilla Public License header and revision history in tlibvx.cxx - (this was missing...) -- Implemention of critical section (for semaphores) -- Rewritten semaphore handling (was incredible buggy) -- Fixed synchronisation bug during launching of new task in PThread - (related to priority handling of VxWorks task scheduler) -- Fixed administration handling with PThreads (especially when PThread - was ending/terminating). Did show up under heavier load. -- Implemention of tracing facility in PThread (::Trace) -- Less use of asserts (for embedded environment) -- Increased stacksize for House-Keeping Thread (+ giving that beast a name) -- Included here and there lot of comments regarding specific behaviour - of VxWorks and/or Tornado-IDE version. -- Update in socket handling: - - Now supporting Non-Blocking sockets - - Fixed memory-leak in inet_ntoa(). - VxWorks does do malloc but no free!! Now using inet_ntoa_b. - - os_select now more directly with same behaviour -- Some P_TORNADO defines renamed to P_VXWORKS. - The P_TORNADO compiler define now applies to some specific TORNADO versions. - When using version 2.1.0 or earlier. This flag now only covers the compiler - bug and missing iostream. Suggested is to try to build VxWorks first without - P_TORNADO flag. In case of errors (compiler crashes or error in iostreams), - enable this flag. -- Resolved conflict due to VxWorks headerfile mbuf.h - Above mentioned headerfile includes a "#define m_data <to_something_else>" - (also for m_type) ?!?!. This resulted into the requirement to manually edit - some generated H.323 files (ASN.1) by placing #undef's after the includes - because the m_data in these files were overwritten by that #define. By - locating a central place to put "#undef m_data" and m_type this is history - now. Another step closer to full automatic generation of openh323. -- Adapted PMEMORY_CHECK for VxWorks variant -- Routed cfree to PMEMORY_CHECK (as counterpart of calloc) -- Moved other build variants from os_select to PSocket::Select -- Simplified remaining PXBlockOnIO -- Added copy constructors of PSemaphore, PMutex and PSyncPoint -- Removed unnecessary assignment in PMutex::WillBlock -- Removed unused PXBlockOnIO definition (not VxWorks specific) - - -Some comments for seting up PWLib for VxWorks -============================================= -- Get PWLib, and if If applicable: apply all patches -- Current way of working with ./configure.exe and ./make is not supported, so - you need to make/adapt your own makefile. -- WindRiver has a special adapted GCC compiler for VxWorks, which possible - requires to include -fpermissive in your CFLAG to make everything compiling. -- Add next VxWorks specific defines: - -DP_VXWORKS - -DVX_TASKS - -DP_TORNADO (only if your compiler *crashes*) - -DNO_LONG_DOUBLE - -DP_USE_PRAGMA - -DPHAS_TEMPLATES -- Big change you need to ask WindRiver support for a compiler patch to solve - the "Virtual memory Exhaust" problem during compile/link... - This has actually nothing to do with your internal PC memory, but all with - the applied stacksizes internally in the compiler. -- In CVS a module exist called pwlib_tornado. Here you can find the Tornado SDE - workspace files for ARM environment (like MS Developer Studio workspace files). - Sadly.. these are corrupt because they are saved/stored including CR+LF while - it should only contain <CR> (or LF?) => UNIX style. We're not using this but - just want to mention it here. -- Surely I forgot something... just drop me a mail. - - - -Happy VxWorks'ing with these patches. -If you have any questions or comments, just drop me a mail (see below) - - -Eize Slange - --- -Department: Development - Platform Enhancement -Philips Business Communications, The Netherlands (NL) -Homepage: http://www.sopho.philips.com -Tel: +31 (0) 35 6893604 -Fax: +31 (0) 35 6891290 -e-Mail: Eiz...@ph... Deleted: ptlib/trunk/ReadMe.MingW32.txt =================================================================== --- ptlib/trunk/ReadMe.MingW32.txt 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk/ReadMe.MingW32.txt 2016-07-30 16:04:14 UTC (rev 34894) @@ -1,13 +0,0 @@ -The following script can be used to compile PTLib (and Opal) -using MingW. - -Uncomment the appropriate line for 64 or 32 bit builds - -------------------------------------------------------- -#!/bin/sh - -export HOST_PREFIX=x86_64-w64-mingw32 -#export HOST_PREFIX=i586-mingw32msvc - -export PKG_CONFIG_LIBDIR=/usr/local/${HOST_PREFIX}/ -./configure --host=${HOST_PREFIX} Modified: ptlib/trunk/ReadMe.txt =================================================================== --- ptlib/trunk/ReadMe.txt 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk/ReadMe.txt 2016-07-30 16:04:14 UTC (rev 34894) @@ -7,13 +7,12 @@ 1. Introduction 2. Apologies - 3. CVS Access - 4. Building PTLib - 5. Using PTLib - 6. IPv6 issues - 7. Platform Specific Issues - 8. Conclusion - 9. Licensing + 3. Licensing + 4. CVS Access + 5. Building PTLib + 6. Using PTLib + 7. IPv6 issues + 8. Using PortAudio @@ -39,7 +38,7 @@ classes replaced or supplemented by STL. The library was used extensively for all our in-house products. Then we decided -to support OpenH323, and then Opal, by throwing in some of the code written for +to support OpenH323, and then OPAL, by throwing in some of the code written for one of our products. Thus, required PTLib so it got thrown into the open source world as well. @@ -68,48 +67,137 @@ not) include them in the base line code. Just do not send us any mail starting with the words "Why did you..." as the answer is quite likely to be "Because!" +This package is far from a "product". There is very limited documentation and +support will be on an ad-hoc basis, send us an e-mail and we will probably +answer your question if it isn't too difficult. +It is supplied mainly to support the OPAL project, but that shouldn't stop +you from using it in whatever project you have in mind if you so desire. We like +it and use it all the time, and we don't want to get into any religious wars of +this class library over that one. + ================================================================================ -3. SVN Access +9. Licensing +------------ + +The bulk of this library is licensed under the MPL (Mozilla Public License) +version 1.0. In simple terms this license allows you to use the library for +any purpose, commercial or otherwise, provided the library is kept in tact +as a separate entity and any changes made to the library are made publicly +available under the same (MPL) license. It is important to realise that that +refers to changes to the library and not your application that is merely +linked to the library. + +Note that due to a restriction in the GPL, any application you write that +uses anything another than GPL, eg our library with MPL, is technically in +breach of the GPL license. However, it should be noted that MPL does not +care about the license of the final application, and as only the author of +the GPL application is in breach of his own license and is unlikely to sue +themselves for that breach, in practice there is no problem with a GPL +application using an MPL or any other commercial library. + + +The random number generator is based on code originally by Bob Jenkins. + + +Portions of this library are from the REGEX library and is under the +following license: + +Copyright 1992, 1993, 1994, 1997 Henry Spencer. All rights reserved. +This software is not subject to any license of the American Telephone +and Telegraph Company or of the Regents of the University of California. + +Permission is granted to anyone to use this software for any purpose on +any computer system, and to alter it and redistribute it, subject +to the following restrictions: + +1. The author is not responsible for the consequences of use of this + software, no matter how awful, even if they arise from flaws in it. + +2. The origin of this software must not be misrepresented, either by + explicit claim or by omission. Since few users ever read sources, + credits must appear in the documentation. + +3. Altered versions must be plainly marked as such, and must not be + misrepresented as being the original software. Since few users + ever read sources, credits must appear in the documentation. + +4. This notice may not be removed or altered. + + +The in-band DTMF decoding code was taken from FreeBSD's dtmfdecode.c +application written by Poul-Henning Kamp. It has the following +license: + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * <ph...@Fr...> wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * ---------------------------------------------------------------------------- + + +================================================================================ + +4. SVN Access ------------- -There is a public SVN archive available at svn.sourceforge.net. To extract, use a -command line like the following: +There is a public SVN archive available at svn.sourceforge.net. To extract the +latest version, use a command line like the following: svn co http://opalvoip.svn.sourceforge.net/svnroot/opalvoip/ptlib/trunk -If you would like see the structure of the SVN, then use the View SVN tool at: +More information on stable branches is available at: - http://opalvoip.svn.sourceforge.net/viewvc/opalvoip/ + http://wiki.opalvoip.org/index.php?n=Main.Subversion ================================================================================ -4. Building PTLib +5. Building PTLib ----------------- This library is multi-platform, however there are only two major build systems that are used. The Microsoft DevStudio environment for Windows and the GNU make system for all of the various unix systems. -4.1. For Windows +5.1. For Windows ---------------- See the online documentation at: - http://www.opalvoip.org/wiki/index.php?n=Main.BuildingPTLib + http://wiki.opalvoip.org/index.php?n=Main.BuildingPTLib -4.2. For Linux/Unix +5.2. For Linux/Unix ------------------- See the online documentation at: - http://www.opalvoip.org/wiki/index.php?n=Main.BuildingPTLibUnix + http://wiki.opalvoip.org/index.php?n=Main.BuildingPTLibUnix +5.3. For MacOS +------------------- + +See the online documentation at: + + http://wiki.opalvoip.org/index.php?n=Main.BuildingPTLibMacOSX + +5.4. For MinGW + +Uncomment the appropriate line for 64 or 32 bit builds + +------------------------------------------------------- +#!/bin/sh + +export HOST_PREFIX=x86_64-w64-mingw32 +#export HOST_PREFIX=i586-mingw32msvc + +export PKG_CONFIG_LIBDIR=/usr/local/${HOST_PREFIX}/ +./configure --host=${HOST_PREFIX} + ================================================================================ -5. Using PTLib +6. Using PTLib -------------- What documentation there is consists of this document and all of the header @@ -117,7 +205,7 @@ produces HTML help files, but this never got completed. -5.1. Tutorial +6.1. Tutorial ------------- Detailed tutorials will almost certainly not be forthcoming. However, at least @@ -175,7 +263,7 @@ -------------------------------------------------------------------------------- -5.2. PTlib Classes +6.2. PTlib Classes ------------------ The classes in PTLib fall into the following broad categories @@ -185,20 +273,20 @@ Threads & Processes -5.2.1. Containers +6.2.1. Containers While there are a number of container classes you wourld rarely actually descend off them, you would use macros that declare type safe descendents. These are simply templates instantiations when using a compiler that supports templates in a simple manner (GNU C++ does not qualify in our opinion). -5.2.2. I/O +6.2.2. I/O There are many classes descendend from a basic primitive call a PChannel, which represents an entity for doing I/O. There are classes for files, serial ports, various types of socket and pipes to sub-processes. -5.2.3. Threads & Processes +6.2.3. Threads & Processes These classes support lightweight threading and functionality to do with the process as a whole (for example argument parsing). The threading will be @@ -208,7 +296,7 @@ ================================================================================ -6. IPv6 support in ptlib +7. IPv6 support in ptlib ------------------------ The IPv6 support in PTlib is supported and can be enabled or disabled via @@ -218,13 +306,7 @@ fully backward compatible. PTLib is able to manage simultaneously IPv4 and IPv6 connections. -6.1 Removed ------------ - -6.2 Removed ------------ - -6.3. Testing +7.1. Testing ------------ The test application sources can be found in the directory: opal/samples/simple @@ -236,7 +318,7 @@ -6.3.1. IPv6 Address and port notation +7.1.1. IPv6 Address and port notation ------------------------------------- IPv4 address and port are written in dot notation: xx.xx.xx.xx:4000 IPv6 global address are written in semi-colon notation: [xx:xx:xx:xx::xx]:4000 @@ -253,7 +335,7 @@ -6.3.2. Tests configuration +7.1.2. Tests configuration -------------------------- Tests 1,2,3 run on a single dual stack machine. IPv4 Address: 127.0.0.1, 10.0.0.6 @@ -269,7 +351,7 @@ -6.3.3. Test 1: IPv4 <--> IPv4 local call +7.1.3. Test 1: IPv4 <--> IPv4 local call ---------------------------------------- This test checks the backward compatibility with IPv4 @@ -280,7 +362,7 @@ -6.3.4. Test 2: IPv6 <--> IPv6 local call +7.1.4. Test 2: IPv6 <--> IPv6 local call ---------------------------------------- This test checks the IPv6 support @@ -290,7 +372,7 @@ simple.exe -tttt -n -i 3ffe:0b80:0002:f9c1:0000:0000:500b:0ea5 -n [::1] -6.3.5. Test 3: IPv4 <--> IPv6 local call +7.1.5. Test 3: IPv4 <--> IPv6 local call ---------------------------------------- This test checks that simultaneous IPv4 and IPv6 calls are supported. @@ -301,7 +383,7 @@ -6.3.6. Test 4: IPv4 <--> IPv4 call between two hosts +7.1.6. Test 4: IPv4 <--> IPv4 call between two hosts ---------------------------------------------------- This test checks the backward compatibility with IPv4 @@ -312,7 +394,7 @@ -6.3.7. Test 5: IPv6 <--> IPv6 call between two hosts +7.1.7. Test 5: IPv6 <--> IPv6 call between two hosts ---------------------------------------------------- This test checks the IPv6 support @@ -323,7 +405,7 @@ -6.3.8. Test 6: IPv4 <--> IPv6 call between two hosts +7.1.8. Test 6: IPv4 <--> IPv6 call between two hosts ---------------------------------------------------- This test checks that simultaneous IPv4 and IPv6 calls are supported. @@ -335,28 +417,21 @@ -------------------------------------------------------------------------------- -6.4. Known limitations +7.2. Known limitations -------------------- You must use IPv6 address with global scope. Tests with IPv6 local link address fail. - -------------------------------------------------------------------------------- -6.5. Questions +7.3. Questions -------------- -6.5.1. Removed --------------- - -6.5.2. Removed --------------- - -6.5.3. How to get an ipv6 address with a Global scope ? +7.3.1. How to get an ipv6 address with a Global scope ? ----------------------------------------------------- -6.5.3.1. Manually +7.3.1.1. Manually ----------------- Set one manually if you're not connected to IPv4 Internet or IPv6 backbone: @@ -376,7 +451,7 @@ RX bytes:0 (0.0 b) TX bytes:534 (534.0 b) -6.5.3.2. Tunnel broker +7.3.1.2. Tunnel broker ---------------------- Get one from a free IPv6 tunnel broker. @@ -391,116 +466,71 @@ -------------------------------------------------------------------------------- -6.6. Troubles +7.4. Troubles ------------ -6.6.1. Listen on ::1:1720 failed: Address family not supported by protocol +7.4.1. Listen on ::1:1720 failed: Address family not supported by protocol ----------------------------------------------------------------------- IPv6 module is not loaded in the kernel. #modprobe ipv6 -6.6.2. SimpleOpal TCP Could not open H.323 listener port on 1720 --------------------------------------------------------------- -Add some traces: -t on the command line. +================================================================================ +8. Using PortAudio +------------------ +PTLib can be configured to use PortAudio V19 for audio input and +output. Some distros (Ubuntu, for example) only include PortAudio +V18 so it is necessary to build it manually. -6.6.3. SimpleOpal TCP Listen on fe80::2b0:d0ff:fedf:d6bf:1720 failed: Invalid argument ------------------------------------------------------------------------------------- -This address is a local scope address. As the scope_id field is always set to 0, -its value is invalid. +PTLib can also use PortMixer (part of the Audacity project) but +not many distros provide this feature as it requires patching +PortAudio. -Use address with global scope. +The script below will extract latest PortAudio and PortMixer +from the correct source repositories, build and install it +into /opt/portaudio. Once this is done, configure ptlib as +follows: + ./configure --with-portaudio-dir=/opt/portaudio +This script has been verified on OSX Mountain Lion and +Ubuntu 12.01 for x64 + Craig (cr...@po...) -================================================================================ + 17 January, 2013 -7. Platform Specific Issues ---------------------------- +-------------------------------------------------- -See the Wiki at http://www.opalvoip.org/wiki/index.php?n=Main.HomePage +#!/bin/sh -================================================================================ +PREFIX=/opt/portaudio -8. Conclusion -------------- +svn co https://subversion.assembla.com/svn/portaudio/portaudio/trunk portaudio +svn co http://audacity.googlecode.com/svn/audacity-src/trunk/lib-src/portmixer portmixer -This package is far from a "product". There is very limited documentation and -support will be on an ad-hoc basis, send us an e-mail and we will probably -answer your question if it isn't too difficult. +cd portaudio +patch -p4 < ../portmixer/portaudio.patch +cd .. -It is supplied mainly to support the Opal project, but that shouldn't stop -you from using it in whatever project you have in mind if you so desire. We like -it and use it all the time, and we don't want to get into any religious wars of -this class library over that one. +cd portaudio +make clean +./configure --prefix=${PREFIX} +make +sudo make install +cd .. +cd portmixer +make clean +( export CFLAGS=-fPIC ; ./configure --with-pa-include=../portaudio/include/ --prefix=${PREFIX} ) +make +sudo cp libportmixer.a ${PREFIX}/lib +sudo cp include/portmixer.h ${PREFIX}/include +cd .. - - ================================================================================ -9. Licensing ------------- - -The bulk of this library is licensed under the MPL (Mozilla Public License) -version 1.0. In simple terms this license allows you to use the library for -any purpose, commercial or otherwise, provided the library is kept in tact -as a separate entity and any changes made to the library are made publicly -available under the same (MPL) license. It is important to realise that that -refers to changes to the library and not your application that is merely -linked to the library. - -Note that due to a restriction in the GPL, any application you write that -uses anything another than GPL, eg our library with MPL, is technically in -breach of the GPL license. However, it should be noted that MPL does not -care about the license of the final application, and as only the author of -the GPL application is in breach of his own license and is unlikely to sue -themselves for that breach, in practice there is no problem with a GPL -application using an MPL or any other commercial library. - - -The random number generator is based on code originally by Bob Jenkins. - - -Portions of this library are from the REGEX library and is under the -following license: - -Copyright 1992, 1993, 1994, 1997 Henry Spencer. All rights reserved. -This software is not subject to any license of the American Telephone -and Telegraph Company or of the Regents of the University of California. - -Permission is granted to anyone to use this software for any purpose on -any computer system, and to alter it and redistribute it, subject -to the following restrictions: - -1. The author is not responsible for the consequences of use of this - software, no matter how awful, even if they arise from flaws in it. - -2. The origin of this software must not be misrepresented, either by - explicit claim or by omission. Since few users ever read sources, - credits must appear in the documentation. - -3. Altered versions must be plainly marked as such, and must not be - misrepresented as being the original software. Since few users - ever read sources, credits must appear in the documentation. - -4. This notice may not be removed or altered. - - -The in-band DTMF decoding code was taken from FreeBSD's dtmfdecode.c -application written by Poul-Henning Kamp. It has the following -license: - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <ph...@Fr...> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - - - -================================================================================ +9. \ No newline at end of file Deleted: ptlib/trunk/ReadMe_PortAudio.txt =================================================================== --- ptlib/trunk/ReadMe_PortAudio.txt 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk/ReadMe_PortAudio.txt 2016-07-30 16:04:14 UTC (rev 34894) @@ -1,52 +0,0 @@ -Using PortAudio ---------------- - -PTLib can be configured to use PortAudio V19 for audio input and -output. Some distros (Ubuntu, for example) only include PortAudio -V18 so it is necessary to build it manually. - -PTLib can also use PortMixer (part of the Audacity project) but -not many distros provide this feature as it requires patching -PortAudio. - -The script below will extract latest PortAudio and PortMixer -from the correct source repositories, build and install it -into /opt/portaudio. Once this is done, configure ptlib as -follows: - - ./configure --with-portaudio-dir=/opt/portaudio - -This script has been verified on OSX Mountain Lion and -Ubuntu 12.01 for x64 - - Craig (cr...@po...) - - 17 January, 2013 - --------------------------------------------------- - -#!/bin/sh - -PREFIX=/opt/portaudio - -svn co https://subversion.assembla.com/svn/portaudio/portaudio/trunk portaudio -svn co http://audacity.googlecode.com/svn/audacity-src/trunk/lib-src/portmixer portmixer - -cd portaudio -patch -p4 < ../portmixer/portaudio.patch -cd .. - -cd portaudio -make clean -./configure --prefix=${PREFIX} -make -sudo make install -cd .. - -cd portmixer -make clean -( export CFLAGS=-fPIC ; ./configure --with-pa-include=../portaudio/include/ --prefix=${PREFIX} ) -make -sudo cp libportmixer.a ${PREFIX}/lib -sudo cp include/portmixer.h ${PREFIX}/include -cd .. Modified: ptlib/trunk/include/ptlib/object.h =================================================================== --- ptlib/trunk/include/ptlib/object.h 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk/include/ptlib/object.h 2016-07-30 16:04:14 UTC (rev 34894) @@ -329,7 +329,6 @@ bool PAssertFunc(const char * file, int line, const char * className, PStandardAssertMessage msg); bool PAssertFunc(const char * file, int line, const char * className, const char * msg); -bool PAssertFunc(const char * full_msg); /** This macro is used to assert that a condition must be true. Modified: ptlib/trunk/samples/threadex/Makefile =================================================================== --- ptlib/trunk/samples/threadex/Makefile 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk/samples/threadex/Makefile 2016-07-30 16:04:14 UTC (rev 34894) @@ -31,5 +31,6 @@ else include $(shell pkg-config ptlib --variable=makedir)/ptlib.mak endif +LIBS += -lpthread # End of Makefile Modified: ptlib/trunk/samples/threadex/main.cxx =================================================================== --- ptlib/trunk/samples/threadex/main.cxx 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk/samples/threadex/main.cxx 2016-07-30 16:04:14 UTC (rev 34894) @@ -47,10 +47,33 @@ PAtomicInteger autoDeleteThreadsStarted; PAtomicInteger autoDeleteThreadsFinished; +PAtomicInteger manualDeleteThreadsStarted; +PAtomicInteger manualDeleteThreadsFinished; + PMutex setMutex; -typedef std::set<PThreadIdentifer> ThreadSet; +typedef std::set<PThreadIdentifier> ThreadSet; ThreadSet threadSet; +PString NumberWithCommas(unsigned long long v) +{ + PStringStream answer; + while (true) { + unsigned long long nv = v / 1000; + unsigned long long tv = v % 1000; + if (answer.GetLength() > 0) + answer = PString(",") + answer; + if (nv > 0) + answer = psprintf("%03d", tv) + answer; + else + answer = psprintf("%d", tv) + answer; + if (nv == 0) + break; + else + v = nv; + } + return answer; +} + Threadex::Threadex() : PProcess("Derek Smithies code factory", "threadex", MAJOR_VERSION, MINOR_VERSION, BUILD_TYPE, BUILD_NUMBER) { @@ -72,6 +95,7 @@ "c-create." "-no-create." "h-help." "-no-help." "d-delay:" "-no-delay." + "g-gap:" "-no-gap." "b-busywait." "-no-busywait." #if PTRACING "o-output:" "-no-output." @@ -101,25 +125,39 @@ << "-h or --help :print this help" << endl << "-v or --version print version info" << endl << "-d or --delay ## where ## specifies how many milliseconds the created thread waits for" << endl + << "-g or --gap ## where ## specifies how many milliseconds betweeen iterations - big value slows down rate of thread construction" << endl << "-b or --busywait where if specified will cause the created thread to be tested for termination using a busy wait." << endl << "-a or --autodelete where the pwlib methods for auto deleting a thread are used" << endl << "-c or --create Use the pwlib PThread::Create method to create a thread of the reqired type" << endl #if PTRACING << "o-output output file name for trace" << endl - << "t-trace. trace level to use." << endl + << "t-trace. trace level to use." << endl; #endif - << endl + if (GetOSName() == "Linux") + PError << " -->You can get error 24 - this program can creates BILLIONs of threads. run ulimit -n 100000 to increment the number of " << endl + << " file handles available - so it can create lots of threads without running out of file handles. " << endl; + PError << endl << endl << endl; return; } delay = 2000; - if (args.HasOption('d')) + if (args.HasOption('d')) { delay = args.GetOptionString('d').AsInteger(); + delay = PMIN(1000000, PMAX(0, delay)); + cout << "Created thread will wait for " << delay << " milliseconds before ending" << endl; + } else + cout << "Delay (or time each thread runs for) is not specified. Default value is 0 ms" << endl; - delay = PMIN(1000000, PMAX(0, delay)); - cout << "Created thread will wait for " << delay << " milliseconds before ending" << endl; - + gapIteration = 0; + if (args.HasOption('g')) { + gapIteration = args.GetOptionString('g').AsInteger(); + gapIteration = PMIN(1000, PMAX(0, gapIteration)); + cout << "A gap of " << gapIteration << " milliseconds between launching threads" << endl; + } else + cout << "Gap between the launching of threads not specified. Default value is 0 milliseconds, which gives the highest launch rate of threads." << endl; + + doBusyWait = args.HasOption('b'); doAutoDelete = args.HasOption('a'); @@ -133,7 +171,7 @@ ///////////////////////////////////////////////////////////////////////////// -void AddToThreadSet(PThreadIdentifer id) +void AddToThreadSet(PThreadIdentifier id) { PWaitAndSignal m(setMutex); if (threadSet.find(id) != threadSet.end()) { @@ -143,7 +181,7 @@ threadSet.insert(id); } -void RemoveFromThreadSet(PThreadIdentifer id) +void RemoveFromThreadSet(PThreadIdentifier id) { PWaitAndSignal m(setMutex); if (threadSet.find(id) == threadSet.end()) { @@ -159,12 +197,13 @@ : PThread(10000, NoAutoDeleteThread), delay(_delay) { PTRACE(5, "ThreadEx\tConstructor for a non auto deleted delay thread"); + ++manualDeleteThreadsStarted; } DelayThread::DelayThread(PINDEX _delay, PBoolean) : PThread(10000, AutoDeleteThread), delay(_delay) { - PTRACE(5, "ThreadEx\tConstructor for an auto deleted delay thread"); + PTRACE(3, "ThreadEx\tConstructor for an auto deleted delay thread"); ++autoDeleteThreadsStarted; } @@ -175,6 +214,8 @@ RemoveFromThreadSet(id); if (IsAutoDelete()) ++autoDeleteThreadsFinished; + else + ++manualDeleteThreadsFinished; //This thread must not have a PTRACE statement in the debugger, if it is an autodeleted thread. //If a PTRACE statement is here, the PTRACE will fail as the PThread::Current() returns empty. } @@ -208,10 +249,16 @@ void LauncherThread::AutoCreatedMain(PThread &, INT param) { PThread::Sleep(param); + + if (Threadex::Current().AutoDelete()) + ++autoDeleteThreadsFinished; + else + ++manualDeleteThreadsFinished; } void LauncherThread::Main() { + PINDEX gapIteration = Threadex::Current().GapIteration(); PINDEX delay = Threadex::Current().Delay(); PBoolean doCreate = Threadex::Current().Create(); @@ -219,6 +266,7 @@ if (Threadex::Current().AutoDelete()) { while (keepGoing) { if (doCreate) { + ++autoDeleteThreadsStarted; thread = PThread::Create(PCREATE_NOTIFIER(AutoCreatedMain), delay, PThread::AutoDeleteThread, PThread::NormalPriority, @@ -229,6 +277,8 @@ } // PThread::Sleep(1); iteration++; + if (gapIteration > 0) + PThread::Sleep(gapIteration); } return; } @@ -236,6 +286,7 @@ if (Threadex::Current().BusyWait()) { while (keepGoing) { if (doCreate) { + ++manualDeleteThreadsStarted; thread = PThread::Create(PCREATE_NOTIFIER(AutoCreatedMain), delay, PThread::NoAutoDeleteThread, PThread::NormalPriority, @@ -248,6 +299,8 @@ while (!thread->IsTerminated()); delete thread; iteration++; + if (gapIteration > 0) + PThread::Sleep(gapIteration); } return; } @@ -265,6 +318,8 @@ thread->WaitForTermination(); delete thread; iteration++; + if (gapIteration > 0) + PThread::Sleep(gapIteration); } } @@ -303,11 +358,16 @@ break; case 'r' : - cout << "\nHave completed " << launch.GetIteration() << " iterations" << endl; + cout << "\nHave created " << NumberWithCommas(launch.GetIteration()) << " threads" << endl; { int a = autoDeleteThreadsStarted; int b = autoDeleteThreadsFinished; - cout << "Auto-delete threads : " << a << " - " << b << " = " << a-b << endl; + int c = manualDeleteThreadsStarted; + int d = manualDeleteThreadsFinished; + if (a > 0) + cout << "Auto-delete threads in the system : " << NumberWithCommas((int)(a-b)) << endl; + if (c > 0) + cout << "Manual-delete threads in the system : " << NumberWithCommas((int)(c-d)) << endl; } break; @@ -334,6 +394,7 @@ cout << "Exiting." << endl; launch.Terminate(); launch.WaitForTermination(); + exit(0); return; case '?' : Modified: ptlib/trunk/samples/threadex/main.h =================================================================== --- ptlib/trunk/samples/threadex/main.h 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk/samples/threadex/main.h 2016-07-30 16:04:14 UTC (rev 34894) @@ -53,7 +53,7 @@ protected: PINDEX delay; - PThreadIdentifer id; + PThreadIdentifier id; }; //////////////////////////////////////////////////////////////////////////////// @@ -123,11 +123,15 @@ PBoolean Create() { return doCreate; } + PINDEX GapIteration() { return gapIteration; } + static Threadex & Current() { return (Threadex &)PProcess::Current(); } protected: + PINDEX gapIteration; + PINDEX delay; PBoolean doAutoDelete; Modified: ptlib/trunk/src/ptclib/pssl.cxx =================================================================== --- ptlib/trunk/src/ptclib/pssl.cxx 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk/src/ptclib/pssl.cxx 2016-07-30 16:04:14 UTC (rev 34894) @@ -593,7 +593,12 @@ if (X509_set_version(m_certificate, 2)) { /* Set version to V3 */ - ASN1_INTEGER_set(X509_get_serialNumber(m_certificate), 0L); + { + static PMutex s_mutex; + PWaitAndSignal lock(s_mutex); + static map<PString, long> s_sequenceNumbers; + ASN1_INTEGER_set(X509_get_serialNumber(m_certificate), ++s_sequenceNumbers[subject]); + } X509_NAME * name = X509_NAME_new(); for (POrdinalToString::iterator it = info.begin(); it != info.end(); ++it) Modified: ptlib/trunk/src/ptlib/common/object.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/object.cxx 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk/src/ptlib/common/object.cxx 2016-07-30 16:04:14 UTC (rev 34894) @@ -106,6 +106,73 @@ #else +static PCriticalSection s_AssertMutex; +extern void PPlatformAssertFunc(const char * msg, char defaultAction); +extern void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, unsigned framesToSkip); + +#if PTRACING + void PTrace::WalkStack(ostream & strm, PThreadIdentifier id) + { + s_AssertMutex.Wait(); + PPlatformWalkStack(strm, id, 1); // 1 means skip reporting PTrace::WalkStack + s_AssertMutex.Signal(); + } +#endif // PTRACING + + +static void InternalAssertFunc(const char * file, int line, const char * className, const char * msg) +{ +#if defined(_WIN32) + DWORD errorCode = GetLastError(); +#else + int errorCode = errno; +#endif + +#if P_EXCEPTIONS + //Throw a runtime exception if the environment variable is set + env = ::getenv("PTLIB_ASSERT_EXCEPTION"); + if (env == NULL) + env = ::getenv("PWLIB_ASSERT_EXCEPTION"); + if (env != NULL) { + throw std::runtime_error(msg); + return; + } +#endif + + PWaitAndSignal lock(s_AssertMutex); + static bool s_RecursiveAssert = false; + if (s_RecursiveAssert) + return; + + s_RecursiveAssert = true; + + std::string str; + { + ostringstream strm; + strm << "Assertion fail: "; + if (msg != NULL) + strm << msg << ", "; + strm << "file " << file << ", line " << line; + if (className != NULL) + strm << ", class " << className; + if (errorCode != 0) + strm << ", error=" << errorCode; + strm << ", when=" << PTime().AsString(PTime::LoggingFormat); + PPlatformWalkStack(strm, PNullThreadIdentifier, 2); // 2 means skip reporting InternalAssertFunc & PAssertFunc + strm << ends; + str = strm.str(); + } + + const char * env = ::getenv("PTLIB_ASSERT_ACTION"); + if (env == NULL) + env = ::getenv("PWLIB_ASSERT_ACTION"); + + PPlatformAssertFunc(str.c_str(), env != NULL ? *env : '\0'); + + s_RecursiveAssert = false; +} + + bool PAssertFunc(const char * file, int line, const char * className, @@ -117,7 +184,8 @@ static const char fmt[] = "Out of memory at file %.100s, line %u, class %.30s"; char msgbuf[sizeof(fmt)+100+10+30]; sprintf(msgbuf, fmt, file, line, className); - return PAssertFunc(msgbuf); + PPlatformAssertFunc(msgbuf, 'A'); + return false; } static const char * const textmsg[PMaxStandardAssertMessage] = { @@ -136,40 +204,25 @@ "Invalid or closed operating system window" }; - const char * theMsg; - char msgbuf[20]; if (msg < PMaxStandardAssertMessage) - theMsg = textmsg[msg]; + InternalAssertFunc(file, line, className, textmsg[msg]); else { + char msgbuf[20]; sprintf(msgbuf, "Assertion %i", msg); - theMsg = msgbuf; + InternalAssertFunc(file, line, className, msgbuf); } - return PAssertFunc(file, line, className, theMsg); + return false; } bool PAssertFunc(const char * file, int line, const char * className, const char * msg) { -#if defined(_WIN32) - DWORD err = GetLastError(); -#else - int err = errno; -#endif - - ostringstream str; - str << "Assertion fail: "; - if (msg != NULL) - str << msg << ", "; - str << "file " << file << ", line " << line; - if (className != NULL) - str << ", class " << className; - if (err != 0) - str << ", error=" << err; - str << ", when=" << PTime().AsString(PTime::LoggingFormat) << ends; - - return PAssertFunc(str.str().c_str()); + // Done this way so WalkStack removes the correct number of irrelevant frames + InternalAssertFunc(file, line, className, msg); + return false; } + #endif // !P_USE_ASSERTS PObject::Comparison PObject::CompareObjectMemoryDirect(const PObject & obj) const Modified: ptlib/trunk/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/osutils.cxx 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-07-30 16:04:14 UTC (rev 34894) @@ -2330,7 +2330,7 @@ PProcess & PProcess::Current() { if (PProcessInstance == NULL) { - PAssertFunc("Catastrophic failure, PProcess::Current() = NULL!!"); + PAssertAlways("Catastrophic failure, PProcess::Current() = NULL!!"); PBreakToDebugger(); _exit(1); } Modified: ptlib/trunk/src/ptlib/msos/assert.cxx =================================================================== --- ptlib/trunk/src/ptlib/msos/assert.cxx 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk/src/ptlib/msos/assert.cxx 2016-07-30 16:04:14 UTC (rev 34894) @@ -99,6 +99,12 @@ #include <DbgHelp.h> #include <Psapi.h> + #if PTRACING + #define InternalMaxStackWalk PTrace::MaxStackWalk + #else + #define InternalMaxStackWalk 20 + #endif // PTRACING + class PDebugDLL : public PDynaLink { PCLASSINFO(PDebugDLL, PDynaLink) @@ -155,7 +161,7 @@ m_SymCleanup(GetCurrentProcess()); } - void StackWalk(ostream & strm, PThreadIdentifier id, unsigned maxWalk) + void WalkStack(ostream & strm, PThreadIdentifier id, unsigned framesToSkip) { if (!GetFunction("SymInitialize", (Function &)m_SymInitialize) || !GetFunction("SymCleanup", (Function &)m_SymCleanup) || @@ -226,7 +232,6 @@ // The thread information. HANDLE hThread; - unsigned framesToSkip = 0; int resumeCount = -1; CONTEXT threadContext; @@ -236,7 +241,11 @@ if (id == PNullThreadIdentifier || id == GetCurrentThreadId()) { hThread = GetCurrentThread(); RtlCaptureContext(&threadContext); - framesToSkip = 2; +#if P_64BIT + framesToSkip += 2; +#else + ++framesToSkip; +#endif } else { hThread = OpenThread(THREAD_QUERY_INFORMATION|THREAD_GET_CONTEXT|THREAD_SUSPEND_RESUME, FALSE, id); @@ -281,7 +290,7 @@ #endif unsigned frameCount = 0; - while (frameCount++ < maxWalk) { + while (frameCount++ < InternalMaxStackWalk) { if (!m_StackWalk64(imageType, hProcess, hThread, @@ -351,29 +360,16 @@ }; - static PCriticalSection StackWalkMutex; - - #if PTRACING - #define InternalStackWalk PTrace::WalkStack - #define InternalMaxStackWalk PTrace::MaxStackWalk - #else - #define InternalMaxStackWalk 20 - static - #endif // PTRACING - void InternalStackWalk(ostream & strm, PThreadIdentifier id) + void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, unsigned framesToSkip) { - StackWalkMutex.Wait(); PDebugDLL debughelp; if (debughelp.IsLoaded()) - debughelp.StackWalk(strm, id, InternalMaxStackWalk); - StackWalkMutex.Signal(); + debughelp.WalkStack(strm, id, framesToSkip); } #endif // _WIN32_WCE -static PCriticalSection AssertMutex; - static bool AssertAction(int c) { switch (c) { @@ -404,46 +400,30 @@ } -bool PAssertFunc(const char * msg) +void PPlatformAssertFunc(const char * msg, char defaultAction) { - std::string str; - { - ostringstream strm; - strm << msg; - InternalStackWalk(strm, PNullThreadIdentifier); - strm << ends; - str = strm.str(); - } - #ifndef _WIN32_WCE if (PProcess::Current().IsServiceProcess()) { - PSYSTEMLOG(Fatal, str); - return false; + PSYSTEMLOG(Fatal, msg); + return; } #endif // !_WIN32_WCE - PTRACE(0, str); + PTRACE(0, msg); - PWaitAndSignal mutex(AssertMutex); - - const char * env = ::getenv("PTLIB_ASSERT_ACTION"); - if (env == NULL) - env = ::getenv("PWLIB_ASSERT_ACTION"); - if (env != NULL && *env != EOF && AssertAction(*env)) - return false; - - if (PProcess::Current().IsGUIProcess()) { - PVarString msg = str; - PVarString name = PProcess::Current().GetName(); - AssertAction(MessageBox(NULL, msg, name, MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_APPLMODAL)); + if (defaultAction != '\0') + AssertAction(defaultAction); + else if (PProcess::Current().IsGUIProcess()) { + PVarString boxMsg = msg; + PVarString boxTitle = PProcess::Current().GetName(); + AssertAction(MessageBox(NULL, boxMsg, boxTitle, MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_TASKMODAL)); } else { do { - cerr << str << "\n<A>bort, <B>reak, <I>gnore? "; + cerr << msg << "\n<A>bort, <B>reak, <I>gnore? "; cerr.flush(); } while (AssertAction(cin.get())); } - return false; } Modified: ptlib/trunk/src/ptlib/msos/win32.cxx =================================================================== --- ptlib/trunk/src/ptlib/msos/win32.cxx 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk/src/ptlib/msos/win32.cxx 2016-07-30 16:04:14 UTC (rev 34894) @@ -1941,7 +1941,7 @@ } m_lastError.sprintf("0x%x", ::GetLastError()); - PTRACE(1, "DLL\tError loading DLL: " << m_lastError); + PTRACE(1, "DLL\tError loading DLL (" << setfill(',') << filenames << "), error=" << m_lastError); return false; } Modified: ptlib/trunk/src/ptlib/unix/assert.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/assert.cxx 2016-07-30 14:39:01 UTC (rev 34893) +++ ptlib/trunk/src/ptlib/unix/assert.cxx 2016-07-30 16:04:14 UTC (rev 34894) @@ -104,27 +104,25 @@ } - static void InternalWalkStack(ostream & strm, int skip, void * const * addresses, int addressCount) + static void InternalWalkStack(ostream & strm, unsigned framesToSkip, void * const * addresses, unsigned addressCount) { - if (addressCount <= skip) { + if (addressCount <= framesToSkip) { strm << "\n\tStack back trace empty, possibly corrupt."; return; } - int i; - std::vector<std::string> lines(addressCount); static std::string addr2line = Locate_addr2line(); if (!addr2line.empty()) { std::stringstream cmd; cmd << addr2line << " -e \"" << PProcess::Current().GetFile() << '"'; - for (i = skip; i < addressCount; ++i) + for (unsigned i = framesToSkip; i < addressCount; ++i) cmd << ' ' << addresses[i]; FILE * p = popen(cmd.str().c_str(), "r"); if (p != NULL) { char line[200]; - for (i = skip; i < addressCount; ++i) { + for (unsigned i = framesToSkip; i < addressCount; ++i) { line[0] = '\0'; if (!fgets_nonl(line, sizeof(line), p)) { if (line[0] != '\0') @@ -140,7 +138,7 @@ char ** symbols = backtrace_symbols(addresses, addressCount); - for (i = skip; i < addressCount; ++i) { + for (unsigned i = framesToSkip; i < addressCount; ++i) { strm << "\n\t"; if (symbols[i] == NULL || symbols[i][0] == '\0') { @@ -177,15 +175,6 @@ } - static void InternalWalkStack(ostream & strm, int skip) - { - const size_t maxStackWalk = InternalMaxStackWalk + skip; - void * addresses[maxStackWalk]; - InternalWalkStack(strm, skip, addresses, backtrace(addresses, maxStackWalk)); - } - - - #if PTRACING #if P_PTHREADS struct PWalkStackInfo { @@ -273,12 +262,21 @@ static PWalkStackInfo s_otherThreadStack; - void PTrace::WalkStack(ostream & strm, PThreadIdentifier id) + void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, unsigned framesToSkip) { - if (id == PNullThreadIdentifier || id == PThread::GetCurrentThreadId()) - InternalWalkStack(strm, 2); - else if (PProcess::IsInitialised()) + if (!PProcess::IsInitialised()) + return; + + if (id != PNullThreadIdentifier && id != PThread::GetCurrentThreadId()) s_otherThreadStack.WalkOther(strm, id); + else { + // Allow for some bizarre optimisation when called from PTrace::WalkStack() + if (framesToSkip == 1) + framesToSkip = 0; + const size_t maxStackWalk = InternalMaxStackWalk + framesToSkip; + void * addresses[maxStackWalk]; + InternalWalkStack(strm, framesToSkip, addresses, backtrace(addresses, maxStackWalk)); + } } void PProcess::InternalWalkStackSignaled() @@ -286,18 +284,13 @@ if (IsInitialised()) s_otherThreadStack.OthersWalk(); } - #endif // PTRACING #else - #define InternalWalkStack(...) + void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, unsigned skip) + { + } - #if PTRACING - void PTrace::WalkStack(ostream &, PThreadIdentifier) - { - } - #endif // PTRACING - #endif // P_HAS_BACKTRACE @@ -417,64 +410,27 @@ #endif -static void InternalAssertFunc(const char * msg) +void PPlatformAssertFunc(const char * msg, char defaultAction) { - std::string str; - { - ostringstream strm; - strm << msg; - InternalWalkStack(strm, 3); - strm << ends; - str = strm.str(); - } + OUTPUT_MESSAGE(msg); - OUTPUT_MESSAGE(str); - - char *env; - -#if P_EXCEPTIONS - //Throw a runtime exception if the environment variable PWLIB_ASSERT_EXCEPTION is set - env = ::getenv("PTLIB_ASSERT_EXCEPTION"); - if (env == NULL) - env = ::getenv("PWLIB_ASSERT_EXCEPTION"); - if (env != NULL) { - throw std::runtime_error(msg); + // DO default action is specified + if (defaultAction != '\0') { + AssertAction(defaultAction, msg); return; } -#endif - env = ::getenv("PTLIB_ASSERT_ACTION"); - if (env == NULL) - env = ::getenv("PWLIB_ASSERT_ACTION"); - if (env != NULL && *env != EOF && AssertAction(*env, msg)) - return; - // Check for if stdin is not a TTY and just ignore the assert if so. if (isatty(STDIN_FILENO) != 1) { AssertAction('i', msg); return; } + // Keep asking for action till we get a legal one do { PError << '\n' << ActionMessage << "? " << flush; } while (AssertAction(getchar(), msg)); } -static PCriticalSection s_AssertMutex; -static bool s_TopLevelAssert = true; - -bool PAssertFunc(const char * msg) -{ - s_AssertMutex.Wait(); - if (s_TopLevelAssert) { - s_TopLevelAssert = false; - InternalAssertFunc(msg); - s_TopLevelAssert = true; - } - s_AssertMutex.Signal(); - return false; -} - - // End Of File /////////////////////////////////////////////////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-30 14:39:03
|
Revision: 34893 http://sourceforge.net/p/opalvoip/code/34893 Author: rjongbloed Date: 2016-07-30 14:39:01 +0000 (Sat, 30 Jul 2016) Log Message: ----------- Merged revision(s) 34817, 34820, 34822, 34845, 34851, 34881 from opal/trunk: Fixed incorrect inclusion of watermark video when not enabled in OpenPhone ........ Fixed jitter buffer when in zero delay mode. ........ Avoid issues in jitter buffer with constant delay offset caused by initial in rush of packets. ........ Allow for retransmit of re-INVITE. This also deals with a strange bug in Asterisk, where it appears to try to do a re-INVITE using the same transaction ID as the initial INVITE it sent. ........ Fixed regression with a retry of a re-INVITE being interpreted as an initial INVITE. Caused by recent workaround for Asterisk using initial INVITE transaction ID on re-INVITE transaction. ........ Fixed crash if x264 encoder helper app increases resolution on the fly. ........ Modified Paths: -------------- opal/branches/v3_16/include/rtp/jitter.h opal/branches/v3_16/plugins/video/x264/gpl/h264_helper.cxx opal/branches/v3_16/samples/openphone/main.cxx opal/branches/v3_16/src/rtp/jitter.cxx opal/branches/v3_16/src/sip/sipcon.cxx Property Changed: ---------------- opal/branches/v3_16/ Index: opal/branches/v3_16 =================================================================== --- opal/branches/v3_16 2016-07-30 14:25:26 UTC (rev 34892) +++ opal/branches/v3_16 2016-07-30 14:39:01 UTC (rev 34893) 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,34588-34589,34718,34735,34746,34775,34784,34795 +/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,34718,34735,34746,34775,34784,34795,34817,34820,34822,34845,34851,34881 /ptlib/branches/v2_8:24136 /ptlib/trunk:20820 \ No newline at end of property Modified: opal/branches/v3_16/include/rtp/jitter.h =================================================================== --- opal/branches/v3_16/include/rtp/jitter.h 2016-07-30 14:25:26 UTC (rev 34892) +++ opal/branches/v3_16/include/rtp/jitter.h 2016-07-30 14:39:01 UTC (rev 34893) @@ -332,8 +332,8 @@ PDECLARE_MUTEX(m_bufferMutex); PSemaphore m_frameCount; + PTimeInterval m_lastInsertTick; #if PTRACING - PTimeInterval m_lastInsertTick; PTimeInterval m_lastRemoveTick; public: static unsigned sm_EveryPacketLogLevel; Modified: opal/branches/v3_16/plugins/video/x264/gpl/h264_helper.cxx =================================================================== --- opal/branches/v3_16/plugins/video/x264/gpl/h264_helper.cxx 2016-07-30 14:25:26 UTC (rev 34892) +++ opal/branches/v3_16/plugins/video/x264/gpl/h264_helper.cxx 2016-07-30 14:39:01 UTC (rev 34893) @@ -175,9 +175,12 @@ H264Encoder x264; -void ResizeBuffer() +void ResizeBuffer(size_t len) { - size_t newBufSize = x264.GetWidth()*x264.GetHeight()*3/2 + rtpSize + 1024; + size_t newBufSize =x264.GetWidth()*x264.GetHeight()*3/2; + if (newBufSize < len) + newBufSize = len; + newBufSize += rtpSize + 1024; if (newBufSize > bufSize) { buffer = (unsigned char *)realloc(buffer, newBufSize); if (buffer == NULL) { @@ -266,15 +269,15 @@ WritePipe(&msg, sizeof(msg)); break; case ENCODE_FRAMES: - ResizeBuffer(); ReadPipe(&srcLen, sizeof(srcLen)); + ResizeBuffer(srcLen); ReadPipe(buffer+rtpSize, srcLen); ReadPipe(&headerLen, sizeof(headerLen)); ReadPipe(buffer, headerLen); ReadPipe(&flags, sizeof(flags)); case ENCODE_FRAMES_BUFFERED: { - ResizeBuffer(); + ResizeBuffer(0); unsigned dstLen = rtpSize; unsigned ret = x264.EncodeFrames(buffer+rtpSize, srcLen, buffer, dstLen, headerLen, flags); WritePipe(&msg, sizeof(msg)); Modified: opal/branches/v3_16/samples/openphone/main.cxx =================================================================== --- opal/branches/v3_16/samples/openphone/main.cxx 2016-07-30 14:25:26 UTC (rev 34892) +++ opal/branches/v3_16/samples/openphone/main.cxx 2016-07-30 14:39:01 UTC (rev 34893) @@ -2935,7 +2935,7 @@ OpalMediaStream::DetailAudio | OpalMediaStream::DetailEOL); } - else { + else if (!m_VideoWatermarkDevice.IsEmpty()) { OpalVideoMediaStream * videoStream = dynamic_cast<OpalVideoMediaStream *>(&patch.GetSource()); if (videoStream != NULL) { PVideoInputDevice * device = PVideoInputDevice::CreateOpenedDevice(m_VideoWatermarkDevice, false); Modified: opal/branches/v3_16/src/rtp/jitter.cxx =================================================================== --- opal/branches/v3_16/src/rtp/jitter.cxx 2016-07-30 14:25:26 UTC (rev 34892) +++ opal/branches/v3_16/src/rtp/jitter.cxx 2016-07-30 14:39:01 UTC (rev 34893) @@ -291,8 +291,7 @@ , m_consecutiveEmpty(0) , m_lastSyncSource(0) #if PTRACING - , m_lastInsertTick(PTimer::Tick()) - , m_lastRemoveTick(m_lastInsertTick) + , m_lastRemoveTick(PTimer::Tick()) #endif { InternalReset(); @@ -390,11 +389,10 @@ m_synchronisationState = e_SynchronisationStart; m_frames.clear(); - m_frameCount.Reset(); } -PBoolean OpalAudioJitterBuffer::WriteData(const RTP_DataFrame & frame, PTimeInterval PTRACE_PARAM(tick)) +PBoolean OpalAudioJitterBuffer::WriteData(const RTP_DataFrame & frame, PTimeInterval tick) { if (m_closed) return false; @@ -410,6 +408,16 @@ RTP_SequenceNumber currentSequenceNum = frame.GetSequenceNumber(); RTP_SyncSourceId newSyncSource = frame.GetSyncSource(); + // Avoid issues with constant delay offset caused by initial in rush of packets + if (m_lastSyncSource == 0 && (m_lastInsertTick == 0 || (tick - m_lastInsertTick) < 10)) { + PTRACE(std::min(sm_EveryPacketLogLevel,4U), "Flushing initial audio packet:" + " SSRC=" << RTP_TRACE_SRC(newSyncSource) << + " sn=" << currentSequenceNum << + " ts=" << timestamp); + m_lastInsertTick = tick; + return true; + } + // Check for remote switching media senders, they shouldn't do this but do anyway if (newSyncSource != m_lastSyncSource) { PTRACE_IF(std::min(sm_EveryPacketLogLevel,4U), m_lastSyncSource != 0, "Buffer reset due to SSRC change from " @@ -521,9 +529,7 @@ " dT=" << (tick - m_lastInsertTick) << "," " payload=" << frame.GetPayloadSize() << "," " size=" << m_frames.size()); -#if PTRACING m_lastInsertTick = tick; -#endif m_frameCount.Signal(); } else { @@ -571,7 +577,12 @@ m_currentJitterDelay = 0; m_frameCount.Wait(); // Go synchronous PWaitAndSignal mutex(m_bufferMutex); - if (!m_frames.empty()) { + if (m_frames.empty()) { + // Must have been reset, clear the semaphore. + while (m_frameCount.Wait(0)) + ; + } + else { FrameMap::iterator oldestFrame = m_frames.begin(); frame = oldestFrame->second; m_frames.erase(oldestFrame); Modified: opal/branches/v3_16/src/sip/sipcon.cxx =================================================================== --- opal/branches/v3_16/src/sip/sipcon.cxx 2016-07-30 14:25:26 UTC (rev 34892) +++ opal/branches/v3_16/src/sip/sipcon.cxx 2016-07-30 14:39:01 UTC (rev 34893) @@ -2115,6 +2115,14 @@ SIPConnection::TypeOfINVITE SIPConnection::CheckINVITE(const SIP_PDU & request) const { + /* If we have same transaction ID, it means it is a retransmission + of the original INVITE, probably should re-transmit last sent response + but we just ignore it. Still should work. */ + if (m_lastReceivedINVITE != NULL && m_lastReceivedINVITE->GetTransactionID() == request.GetTransactionID()) { + PTRACE(3, "Ignoring duplicate INVITE from " << request.GetURI() << " after " << m_phaseTime[UninitialisedPhase].GetElapsed()); + return IsDuplicateINVITE; + } + const SIPMIMEInfo & requestMIME = request.GetMIME(); PString requestFromTag = requestMIME.GetFieldParameter("From", "tag"); PString requestToTag = requestMIME.GetFieldParameter("To", "tag"); @@ -2129,7 +2137,7 @@ if (IsOriginating()) { /* Weird, got incoming INVITE for a call we originated, however it is not in the same dialog. Send back a refusal as this just isn't handled. */ - PTRACE(2, "Ignoring INVITE from " << request.GetURI() << " when originated call."); + PTRACE(2, "Ignoring INVITE from " << request.GetURI() << " when we originated call."); return IsLoopedINVITE; } @@ -2138,21 +2146,13 @@ // to be new INVITE, then it should be retried and next time the race // will be passed. if (m_lastReceivedINVITE == NULL) { - PTRACE(3, "Ignoring INVITE from " << request.GetURI() << " as we are originator."); + PTRACE(3, "Ignoring INVITE from " << request.GetURI() << " as have not yet processed pevious one."); return IsDuplicateINVITE; } - /* If we have same transaction ID, it means it is a retransmission - of the original INVITE, probably should re-transmit last sent response - but we just ignore it. Still should work. */ - if (m_lastReceivedINVITE->GetTransactionID() == request.GetTransactionID()) { - PTRACE(3, "Ignoring duplicate INVITE from " << request.GetURI() << " after " << (PTime() - m_phaseTime[SetUpPhase])); - return IsDuplicateINVITE; - } - // Check if is RFC3261/8.2.2.2 case relating to merged requests. if (!requestToTag.IsEmpty()) { - PTRACE(3, "Ignoring INVITE from " << request.GetURI() << " as has invalid to-tag."); + PTRACE(2, "Ignoring INVITE from " << request.GetURI() << " as has invalid to-tag \"" << requestToTag << '"'); return IsDuplicateINVITE; } @@ -2175,9 +2175,8 @@ void SIPConnection::OnReceivedINVITE(SIP_PDU & request) { - bool isReinvite = IsOriginating() || - (m_lastReceivedINVITE != NULL && m_lastReceivedINVITE->GetTransactionID() != request.GetTransactionID()); - PTRACE_IF(4, !isReinvite, "Initial INVITE to " << request.GetURI()); + bool isReinvite = IsOriginating() || GetPhase() >= ConnectedPhase; + PTRACE(3, (isReinvite ? "Re-" : "Initial ") << "INVITE to " << request.GetURI() << ", id=" << request.GetTransactionID()); // m_lastReceivedINVITE should contain the last received INVITE for this connection delete m_lastReceivedINVITE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-30 14:25:29
|
Revision: 34892 http://sourceforge.net/p/opalvoip/code/34892 Author: rjongbloed Date: 2016-07-30 14:25:26 +0000 (Sat, 30 Jul 2016) Log Message: ----------- Merged revision(s) 34837, 34854, 34876 from ptlib/trunk: Improved documentation around PString::SetSize() usage. ........ Priorities outputting Assert text with trace info over write to error stream. ........ Fixed bug in thread pool where if the max thread count was reduced to below the actual number of threads in the pool, then every time all thread had work a new thread was created for the pool, exceeding the maximum set. Also if thread pool maximum reduced, excess thread were not reclaimed. Added. ........ Modified Paths: -------------- ptlib/branches/v2_16/include/ptclib/threadpool.h ptlib/branches/v2_16/include/ptlib/pstring.h ptlib/branches/v2_16/src/ptclib/threadpool.cxx ptlib/branches/v2_16/src/ptlib/unix/assert.cxx Property Changed: ---------------- ptlib/branches/v2_16/ Index: ptlib/branches/v2_16 =================================================================== --- ptlib/branches/v2_16 2016-07-30 14:20:51 UTC (rev 34891) +++ ptlib/branches/v2_16 2016-07-30 14:25:26 UTC (rev 34892) 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,34581,34584,34722,34740-34745,34774,34792-34793,34796 +/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,34722,34740-34745,34774,34792-34793,34796,34837,34854,34876 \ No newline at end of property Modified: ptlib/branches/v2_16/include/ptclib/threadpool.h =================================================================== --- ptlib/branches/v2_16/include/ptclib/threadpool.h 2016-07-30 14:20:51 UTC (rev 34891) +++ ptlib/branches/v2_16/include/ptclib/threadpool.h 2016-07-30 14:25:26 UTC (rev 34892) @@ -192,7 +192,7 @@ void SetMaxWorkers( unsigned count - ) { m_maxWorkerCount = count; } + ); unsigned GetMaxUnits() const { return m_maxWorkUnitCount; } Modified: ptlib/branches/v2_16/include/ptlib/pstring.h =================================================================== --- ptlib/branches/v2_16/include/ptlib/pstring.h 2016-07-30 14:20:51 UTC (rev 34891) +++ ptlib/branches/v2_16/include/ptlib/pstring.h 2016-07-30 14:25:26 UTC (rev 34892) @@ -543,6 +543,10 @@ new characters are initialised to zero. If the string is made smaller then the data beyond the new size is lost. + This does not set the actual length of the string, but only allocates + space for it. It is expected that GetPointerAndSetLength() or + MakeMinimumSize() is used to set the actual length of the string. + Note that this function will break the current instance from multiple references to an array. A new array is allocated and the data from the old array copied to it. Modified: ptlib/branches/v2_16/src/ptclib/threadpool.cxx =================================================================== --- ptlib/branches/v2_16/src/ptclib/threadpool.cxx 2016-07-30 14:20:51 UTC (rev 34891) +++ ptlib/branches/v2_16/src/ptclib/threadpool.cxx 2016-07-30 14:25:26 UTC (rev 34892) @@ -72,6 +72,18 @@ } +void PThreadPoolBase::SetMaxWorkers(unsigned count) +{ + m_mutex.Wait(); + bool needReclamation = m_maxWorkerCount > count; + m_maxWorkerCount = count; + m_mutex.Signal(); + + if (needReclamation) + ReclaimWorkers(); +} + + PThreadPoolBase::WorkerThreadBase * PThreadPoolBase::AllocateWorker() { // Assumes m_mutex already locked @@ -79,31 +91,30 @@ // find the worker thread with the minimum number of work units // shortcut the search if we find an empty one WorkerList_t::iterator minWorker = m_workers.end(); - size_t minSizeFound = 0x7ffff; - WorkerList_t::iterator iter; - for (iter = m_workers.begin(); iter != m_workers.end(); ++iter) { + size_t minSizeFound = INT_MAX; + for (WorkerList_t::iterator iter = m_workers.begin(); iter != m_workers.end(); ++iter) { WorkerThreadBase & worker = **iter; PWaitAndSignal m2(worker.m_workerMutex); if (!worker.m_shutdown && (worker.GetWorkSize() <= minSizeFound)) { minSizeFound = worker.GetWorkSize(); + if (minSizeFound == 0) + return &worker; // if there is an idle worker, use it minWorker = iter; - if (minSizeFound == 0) - break; } } - // if there is an idle worker, use it - if (iter != m_workers.end()) - return *minWorker; - - // if there is a per-worker limit, increase workers in quanta of the max worker count - // otherwise only allow maximum number of workers - if (m_maxWorkUnitCount > 0) { - if (((m_workers.size() % m_maxWorkerCount) == 0) && (minSizeFound < m_maxWorkUnitCount)) - return *minWorker; + if (minWorker != m_workers.end()) { + // if there is a per-worker limit, increase workers in quanta of the max worker count + // otherwise only allow maximum number of workers + if (m_maxWorkUnitCount > 0) { + if (((m_workers.size() % m_maxWorkerCount) == 0) && (minSizeFound < m_maxWorkUnitCount)) + return *minWorker; + } + else { + if (m_workers.size() >= m_maxWorkerCount) + return *minWorker; + } } - else if ((m_workers.size() > 0) && (m_workers.size() == m_maxWorkerCount)) - return *minWorker; // create a new worker thread WorkerThreadBase * worker = CreateWorkerThread(); Modified: ptlib/branches/v2_16/src/ptlib/unix/assert.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/unix/assert.cxx 2016-07-30 14:20:51 UTC (rev 34891) +++ ptlib/branches/v2_16/src/ptlib/unix/assert.cxx 2016-07-30 14:25:26 UTC (rev 34892) @@ -294,9 +294,14 @@ #endif // P_HAS_BACKTRACE -#define OUTPUT_MESSAGE(msg) \ - PTRACE_IF(0, PTrace::GetStream() != &PError, NULL, "PTLib", msg); \ - PError << msg << endl +#if PTRACING + #define OUTPUT_MESSAGE(msg) \ + PTRACE(0, NULL, "PTLib", msg); \ + if (PTrace::GetStream() != &PError) \ + PError << msg << endl +#else + #define OUTPUT_MESSAGE(msg) PError << msg << endl +#endif #if defined(P_ANDROID) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-30 14:20:54
|
Revision: 34891 http://sourceforge.net/p/opalvoip/code/34891 Author: rjongbloed Date: 2016-07-30 14:20:51 +0000 (Sat, 30 Jul 2016) Log Message: ----------- Fix possibility of recursive PAssert on win32 platform. Also normalised mutex/recursion control for Assert and StackWalk to platform independent code. Modified Paths: -------------- ptlib/branches/v2_16/include/ptlib/object.h ptlib/branches/v2_16/src/ptlib/common/object.cxx ptlib/branches/v2_16/src/ptlib/common/osutils.cxx ptlib/branches/v2_16/src/ptlib/msos/assert.cxx ptlib/branches/v2_16/src/ptlib/unix/assert.cxx Modified: ptlib/branches/v2_16/include/ptlib/object.h =================================================================== --- ptlib/branches/v2_16/include/ptlib/object.h 2016-07-28 17:00:11 UTC (rev 34890) +++ ptlib/branches/v2_16/include/ptlib/object.h 2016-07-30 14:20:51 UTC (rev 34891) @@ -316,7 +316,6 @@ bool PAssertFunc(const char * file, int line, const char * className, PStandardAssertMessage msg); bool PAssertFunc(const char * file, int line, const char * className, const char * msg); -bool PAssertFunc(const char * full_msg); /** This macro is used to assert that a condition must be true. Modified: ptlib/branches/v2_16/src/ptlib/common/object.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/common/object.cxx 2016-07-28 17:00:11 UTC (rev 34890) +++ ptlib/branches/v2_16/src/ptlib/common/object.cxx 2016-07-30 14:20:51 UTC (rev 34891) @@ -106,6 +106,73 @@ #else +static PCriticalSection s_AssertMutex; +extern void PPlatformAssertFunc(const char * msg, char defaultAction); +extern void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, unsigned framesToSkip); + +#if PTRACING + void PTrace::WalkStack(ostream & strm, PThreadIdentifier id) + { + s_AssertMutex.Wait(); + PPlatformWalkStack(strm, id, 1); // 1 means skip reporting PTrace::WalkStack + s_AssertMutex.Signal(); + } +#endif // PTRACING + + +static void InternalAssertFunc(const char * file, int line, const char * className, const char * msg) +{ +#if defined(_WIN32) + DWORD errorCode = GetLastError(); +#else + int errorCode = errno; +#endif + +#if P_EXCEPTIONS + //Throw a runtime exception if the environment variable is set + env = ::getenv("PTLIB_ASSERT_EXCEPTION"); + if (env == NULL) + env = ::getenv("PWLIB_ASSERT_EXCEPTION"); + if (env != NULL) { + throw std::runtime_error(msg); + return; + } +#endif + + PWaitAndSignal lock(s_AssertMutex); + static bool s_RecursiveAssert = false; + if (s_RecursiveAssert) + return; + + s_RecursiveAssert = true; + + std::string str; + { + ostringstream strm; + strm << "Assertion fail: "; + if (msg != NULL) + strm << msg << ", "; + strm << "file " << file << ", line " << line; + if (className != NULL) + strm << ", class " << className; + if (errorCode != 0) + strm << ", error=" << errorCode; + strm << ", when=" << PTime().AsString(PTime::LoggingFormat); + PPlatformWalkStack(strm, PNullThreadIdentifier, 2); // 2 means skip reporting InternalAssertFunc & PAssertFunc + strm << ends; + str = strm.str(); + } + + const char * env = ::getenv("PTLIB_ASSERT_ACTION"); + if (env == NULL) + env = ::getenv("PWLIB_ASSERT_ACTION"); + + PPlatformAssertFunc(str.c_str(), env != NULL ? *env : '\0'); + + s_RecursiveAssert = false; +} + + bool PAssertFunc(const char * file, int line, const char * className, @@ -117,7 +184,8 @@ static const char fmt[] = "Out of memory at file %.100s, line %u, class %.30s"; char msgbuf[sizeof(fmt)+100+10+30]; sprintf(msgbuf, fmt, file, line, className); - return PAssertFunc(msgbuf); + PPlatformAssertFunc(msgbuf, 'A'); + return false; } static const char * const textmsg[PMaxStandardAssertMessage] = { @@ -136,40 +204,25 @@ "Invalid or closed operating system window" }; - const char * theMsg; - char msgbuf[20]; if (msg < PMaxStandardAssertMessage) - theMsg = textmsg[msg]; + InternalAssertFunc(file, line, className, textmsg[msg]); else { + char msgbuf[20]; sprintf(msgbuf, "Assertion %i", msg); - theMsg = msgbuf; + InternalAssertFunc(file, line, className, msgbuf); } - return PAssertFunc(file, line, className, theMsg); + return false; } bool PAssertFunc(const char * file, int line, const char * className, const char * msg) { -#if defined(_WIN32) - DWORD err = GetLastError(); -#else - int err = errno; -#endif - - ostringstream str; - str << "Assertion fail: "; - if (msg != NULL) - str << msg << ", "; - str << "file " << file << ", line " << line; - if (className != NULL) - str << ", class " << className; - if (err != 0) - str << ", error=" << err; - str << ", when=" << PTime().AsString(PTime::LoggingFormat) << ends; - - return PAssertFunc(str.str().c_str()); + // Done this way so WalkStack removes the correct number of irrelevant frames + InternalAssertFunc(file, line, className, msg); + return false; } + #endif // !P_USE_ASSERTS PObject::Comparison PObject::CompareObjectMemoryDirect(const PObject & obj) const Modified: ptlib/branches/v2_16/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-07-28 17:00:11 UTC (rev 34890) +++ ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-07-30 14:20:51 UTC (rev 34891) @@ -2344,7 +2344,7 @@ PProcess & PProcess::Current() { if (PProcessInstance == NULL) { - PAssertFunc("Catastrophic failure, PProcess::Current() = NULL!!"); + PAssertAlways("Catastrophic failure, PProcess::Current() = NULL!!"); PBreakToDebugger(); _exit(1); } Modified: ptlib/branches/v2_16/src/ptlib/msos/assert.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/msos/assert.cxx 2016-07-28 17:00:11 UTC (rev 34890) +++ ptlib/branches/v2_16/src/ptlib/msos/assert.cxx 2016-07-30 14:20:51 UTC (rev 34891) @@ -99,6 +99,12 @@ #include <DbgHelp.h> #include <Psapi.h> + #if PTRACING + #define InternalMaxStackWalk PTrace::MaxStackWalk + #else + #define InternalMaxStackWalk 20 + #endif // PTRACING + class PDebugDLL : public PDynaLink { PCLASSINFO(PDebugDLL, PDynaLink) @@ -155,7 +161,7 @@ m_SymCleanup(GetCurrentProcess()); } - void StackWalk(ostream & strm, PThreadIdentifier id, unsigned maxWalk) + void WalkStack(ostream & strm, PThreadIdentifier id, unsigned framesToSkip) { if (!GetFunction("SymInitialize", (Function &)m_SymInitialize) || !GetFunction("SymCleanup", (Function &)m_SymCleanup) || @@ -226,7 +232,6 @@ // The thread information. HANDLE hThread; - unsigned framesToSkip = 0; int resumeCount = -1; CONTEXT threadContext; @@ -236,7 +241,11 @@ if (id == PNullThreadIdentifier || id == GetCurrentThreadId()) { hThread = GetCurrentThread(); RtlCaptureContext(&threadContext); - framesToSkip = 2; +#if P_64BIT + framesToSkip += 2; +#else + ++framesToSkip; +#endif } else { hThread = OpenThread(THREAD_QUERY_INFORMATION|THREAD_GET_CONTEXT|THREAD_SUSPEND_RESUME, FALSE, id); @@ -281,7 +290,7 @@ #endif unsigned frameCount = 0; - while (frameCount++ < maxWalk) { + while (frameCount++ < InternalMaxStackWalk) { if (!m_StackWalk64(imageType, hProcess, hThread, @@ -351,29 +360,16 @@ }; - static PCriticalSection StackWalkMutex; - - #if PTRACING - #define InternalStackWalk PTrace::WalkStack - #define InternalMaxStackWalk PTrace::MaxStackWalk - #else - #define InternalMaxStackWalk 20 - static - #endif // PTRACING - void InternalStackWalk(ostream & strm, PThreadIdentifier id) + void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, unsigned framesToSkip) { - StackWalkMutex.Wait(); PDebugDLL debughelp; if (debughelp.IsLoaded()) - debughelp.StackWalk(strm, id, InternalMaxStackWalk); - StackWalkMutex.Signal(); + debughelp.WalkStack(strm, id, framesToSkip); } #endif // _WIN32_WCE -static PCriticalSection AssertMutex; - static bool AssertAction(int c) { switch (c) { @@ -404,46 +400,30 @@ } -bool PAssertFunc(const char * msg) +void PPlatformAssertFunc(const char * msg, char defaultAction) { - std::string str; - { - ostringstream strm; - strm << msg; - InternalStackWalk(strm, PNullThreadIdentifier); - strm << ends; - str = strm.str(); - } - #ifndef _WIN32_WCE if (PProcess::Current().IsServiceProcess()) { - PSYSTEMLOG(Fatal, str); - return false; + PSYSTEMLOG(Fatal, msg); + return; } #endif // !_WIN32_WCE - PTRACE(0, str); + PTRACE(0, msg); - PWaitAndSignal mutex(AssertMutex); - - const char * env = ::getenv("PTLIB_ASSERT_ACTION"); - if (env == NULL) - env = ::getenv("PWLIB_ASSERT_ACTION"); - if (env != NULL && *env != EOF && AssertAction(*env)) - return false; - - if (PProcess::Current().IsGUIProcess()) { - PVarString msg = str; - PVarString name = PProcess::Current().GetName(); - AssertAction(MessageBox(NULL, msg, name, MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_TASKMODAL)); + if (defaultAction != '\0') + AssertAction(defaultAction); + else if (PProcess::Current().IsGUIProcess()) { + PVarString boxMsg = msg; + PVarString boxTitle = PProcess::Current().GetName(); + AssertAction(MessageBox(NULL, boxMsg, boxTitle, MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_TASKMODAL)); } else { do { - cerr << str << "\n<A>bort, <B>reak, <I>gnore? "; + cerr << msg << "\n<A>bort, <B>reak, <I>gnore? "; cerr.flush(); } while (AssertAction(cin.get())); } - return false; } Modified: ptlib/branches/v2_16/src/ptlib/unix/assert.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/unix/assert.cxx 2016-07-28 17:00:11 UTC (rev 34890) +++ ptlib/branches/v2_16/src/ptlib/unix/assert.cxx 2016-07-30 14:20:51 UTC (rev 34891) @@ -104,27 +104,25 @@ } - static void InternalWalkStack(ostream & strm, int skip, void * const * addresses, int addressCount) + static void InternalWalkStack(ostream & strm, unsigned framesToSkip, void * const * addresses, unsigned addressCount) { - if (addressCount <= skip) { + if (addressCount <= framesToSkip) { strm << "\n\tStack back trace empty, possibly corrupt."; return; } - int i; - std::vector<std::string> lines(addressCount); static std::string addr2line = Locate_addr2line(); if (!addr2line.empty()) { std::stringstream cmd; cmd << addr2line << " -e \"" << PProcess::Current().GetFile() << '"'; - for (i = skip; i < addressCount; ++i) + for (unsigned i = framesToSkip; i < addressCount; ++i) cmd << ' ' << addresses[i]; FILE * p = popen(cmd.str().c_str(), "r"); if (p != NULL) { char line[200]; - for (i = skip; i < addressCount; ++i) { + for (unsigned i = framesToSkip; i < addressCount; ++i) { line[0] = '\0'; if (!fgets_nonl(line, sizeof(line), p)) { if (line[0] != '\0') @@ -140,7 +138,7 @@ char ** symbols = backtrace_symbols(addresses, addressCount); - for (i = skip; i < addressCount; ++i) { + for (unsigned i = framesToSkip; i < addressCount; ++i) { strm << "\n\t"; if (symbols[i] == NULL || symbols[i][0] == '\0') { @@ -177,15 +175,6 @@ } - static void InternalWalkStack(ostream & strm, int skip) - { - const size_t maxStackWalk = InternalMaxStackWalk + skip; - void * addresses[maxStackWalk]; - InternalWalkStack(strm, skip, addresses, backtrace(addresses, maxStackWalk)); - } - - - #if PTRACING #if P_PTHREADS struct PWalkStackInfo { @@ -273,12 +262,21 @@ static PWalkStackInfo s_otherThreadStack; - void PTrace::WalkStack(ostream & strm, PThreadIdentifier id) + void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, unsigned framesToSkip) { - if (id == PNullThreadIdentifier || id == PThread::GetCurrentThreadId()) - InternalWalkStack(strm, 2); - else if (PProcess::IsInitialised()) + if (!PProcess::IsInitialised()) + return; + + if (id != PNullThreadIdentifier && id != PThread::GetCurrentThreadId()) s_otherThreadStack.WalkOther(strm, id); + else { + // Allow for some bizarre optimisation when called from PTrace::WalkStack() + if (framesToSkip == 1) + framesToSkip = 0; + const size_t maxStackWalk = InternalMaxStackWalk + framesToSkip; + void * addresses[maxStackWalk]; + InternalWalkStack(strm, framesToSkip, addresses, backtrace(addresses, maxStackWalk)); + } } void PProcess::InternalWalkStackSignaled() @@ -286,18 +284,13 @@ if (IsInitialised()) s_otherThreadStack.OthersWalk(); } - #endif // PTRACING #else - #define InternalWalkStack(...) + void PPlatformWalkStack(ostream & strm, PThreadIdentifier id, unsigned skip) + { + } - #if PTRACING - void PTrace::WalkStack(ostream &, PThreadIdentifier) - { - } - #endif // PTRACING - #endif // P_HAS_BACKTRACE @@ -412,64 +405,27 @@ #endif -static void InternalAssertFunc(const char * msg) +void PPlatformAssertFunc(const char * msg, char defaultAction) { - std::string str; - { - ostringstream strm; - strm << msg; - InternalWalkStack(strm, 3); - strm << ends; - str = strm.str(); - } + OUTPUT_MESSAGE(msg); - OUTPUT_MESSAGE(str); - - char *env; - -#if P_EXCEPTIONS - //Throw a runtime exception if the environment variable PWLIB_ASSERT_EXCEPTION is set - env = ::getenv("PTLIB_ASSERT_EXCEPTION"); - if (env == NULL) - env = ::getenv("PWLIB_ASSERT_EXCEPTION"); - if (env != NULL) { - throw std::runtime_error(msg); + // DO default action is specified + if (defaultAction != '\0') { + AssertAction(defaultAction, msg); return; } -#endif - env = ::getenv("PTLIB_ASSERT_ACTION"); - if (env == NULL) - env = ::getenv("PWLIB_ASSERT_ACTION"); - if (env != NULL && *env != EOF && AssertAction(*env, msg)) - return; - // Check for if stdin is not a TTY and just ignore the assert if so. if (isatty(STDIN_FILENO) != 1) { AssertAction('i', msg); return; } + // Keep asking for action till we get a legal one do { PError << '\n' << ActionMessage << "? " << flush; } while (AssertAction(getchar(), msg)); } -static PCriticalSection s_AssertMutex; -static bool s_TopLevelAssert = true; - -bool PAssertFunc(const char * msg) -{ - s_AssertMutex.Wait(); - if (s_TopLevelAssert) { - s_TopLevelAssert = false; - InternalAssertFunc(msg); - s_TopLevelAssert = true; - } - s_AssertMutex.Signal(); - return false; -} - - // End Of File /////////////////////////////////////////////////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-28 17:00:13
|
Revision: 34890 http://sourceforge.net/p/opalvoip/code/34890 Author: rjongbloed Date: 2016-07-28 17:00:11 +0000 (Thu, 28 Jul 2016) Log Message: ----------- Fixed error reporting in httptest Modified Paths: -------------- ptlib/trunk/samples/httptest/httptest.cxx Modified: ptlib/trunk/samples/httptest/httptest.cxx =================================================================== --- ptlib/trunk/samples/httptest/httptest.cxx 2016-07-28 11:51:07 UTC (rev 34889) +++ ptlib/trunk/samples/httptest/httptest.cxx 2016-07-28 17:00:11 UTC (rev 34890) @@ -92,7 +92,7 @@ PString str; ok = client.GetTextDocument(args[0], str); if (ok) - cout << str << endl; + cout << "Response body: \"" << str << '"' << endl; } else if (op == "DELETE") ok = client.DeleteDocument(args[0]); @@ -116,7 +116,9 @@ if (ok) cout << op << " sucessful."; else - cout << "Error in " << op << ' ' << client.GetErrorText(); + cout << "Error in " << op + << " code=" << client.GetLastResponseCode() + << " info=\"" << client.GetLastResponseInfo() << '"'; cout << endl; return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-28 11:51:09
|
Revision: 34889 http://sourceforge.net/p/opalvoip/code/34889 Author: rjongbloed Date: 2016-07-28 11:51:07 +0000 (Thu, 28 Jul 2016) Log Message: ----------- Renamed function to be consistent. Modified Paths: -------------- ptlib/trunk/include/ptclib/shttpsvc.h ptlib/trunk/src/ptclib/shttpsvc.cxx Modified: ptlib/trunk/include/ptclib/shttpsvc.h =================================================================== --- ptlib/trunk/include/ptclib/shttpsvc.h 2016-07-28 11:49:52 UTC (rev 34888) +++ ptlib/trunk/include/ptclib/shttpsvc.h 2016-07-28 11:51:07 UTC (rev 34889) @@ -77,10 +77,10 @@ const char * dn = NULL ///< Distinguished Name to use if creating new self signed certificate. ); - /** Set the server certificates to use. + /** Set the server credentials, certificates etc, to use. Must be called before ListenForHTTP() or https will not be supported. */ - bool SetServerCertificates( + bool SetServerCredentials( const PString & cert, ///< Certificate file or text string const PString & key, ///< Private key file or text string const PString & ca ///< Certificate authority file, directory or text string Modified: ptlib/trunk/src/ptclib/shttpsvc.cxx =================================================================== --- ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-07-28 11:49:52 UTC (rev 34888) +++ ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-07-28 11:51:07 UTC (rev 34889) @@ -166,11 +166,11 @@ key.Save(certificateFile, true); } - return SetServerCertificates(certificateFile, certificateFile, PString::Empty()); + return SetServerCredentials(certificateFile, certificateFile, PString::Empty()); } -bool PSecureHTTPServiceProcess::SetServerCertificates(const PString & cert, const PString & key, const PString & ca) +bool PSecureHTTPServiceProcess::SetServerCredentials(const PString & cert, const PString & key, const PString & ca) { if (m_sslContext == NULL) m_sslContext = new PSSLContext(PSSLContext::TLSv1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-28 11:49:54
|
Revision: 34888 http://sourceforge.net/p/opalvoip/code/34888 Author: rjongbloed Date: 2016-07-28 11:49:52 +0000 (Thu, 28 Jul 2016) Log Message: ----------- Make sure SSL disabled in PSecureHTTPServiceProcess if could not set credentials. Modified Paths: -------------- ptlib/trunk/src/ptclib/shttpsvc.cxx Modified: ptlib/trunk/src/ptclib/shttpsvc.cxx =================================================================== --- ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-07-28 11:44:53 UTC (rev 34887) +++ ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-07-28 11:49:52 UTC (rev 34888) @@ -75,6 +75,7 @@ void PSecureHTTPServiceProcess::DisableSSL() { + PSYSTEMLOG(Info, "SSL disabled"); delete m_sslContext; m_sslContext = NULL; } @@ -165,11 +166,7 @@ key.Save(certificateFile, true); } - if (SetServerCertificates(certificateFile, certificateFile, PString::Empty())) - return true; - - DisableSSL(); - return false; + return SetServerCertificates(certificateFile, certificateFile, PString::Empty()); } @@ -178,7 +175,11 @@ if (m_sslContext == NULL) m_sslContext = new PSSLContext(PSSLContext::TLSv1); - return m_sslContext->SetCredentials(ca, cert, key); + if (m_sslContext->SetCredentials(ca, cert, key)) + return true; + + DisableSSL(); + return false; } PBoolean PSecureHTTPServiceProcess::OnDetectedNonSSLConnection(PChannel * chan, const PString & line) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-28 11:44:55
|
Revision: 34887 http://sourceforge.net/p/opalvoip/code/34887 Author: rjongbloed Date: 2016-07-28 11:44:53 +0000 (Thu, 28 Jul 2016) Log Message: ----------- Fixed crash in PSecureHTTPServiceProcess if get SSL level error during web page access. Modified Paths: -------------- ptlib/trunk/src/ptclib/shttpsvc.cxx Modified: ptlib/trunk/src/ptclib/shttpsvc.cxx =================================================================== --- ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-07-28 10:00:20 UTC (rev 34886) +++ ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-07-28 11:44:53 UTC (rev 34887) @@ -130,6 +130,7 @@ return ssl; PSYSTEMLOG(Error, "Accept failed: " << ssl->GetErrorText()); + ssl->Detach(); delete ssl; return NULL; } @@ -175,7 +176,7 @@ bool PSecureHTTPServiceProcess::SetServerCertificates(const PString & cert, const PString & key, const PString & ca) { if (m_sslContext == NULL) - m_sslContext = new PSSLContext; + m_sslContext = new PSSLContext(PSSLContext::TLSv1); return m_sslContext->SetCredentials(ca, cert, key); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-28 10:00:22
|
Revision: 34886 http://sourceforge.net/p/opalvoip/code/34886 Author: rjongbloed Date: 2016-07-28 10:00:20 +0000 (Thu, 28 Jul 2016) Log Message: ----------- Added ability to set separate certificate and private key files, as well as certificate authority for two way validation, to PSecureHTTPServiceProcess. Modified Paths: -------------- ptlib/trunk/include/ptclib/shttpsvc.h ptlib/trunk/src/ptclib/shttpsvc.cxx Modified: ptlib/trunk/include/ptclib/shttpsvc.h =================================================================== --- ptlib/trunk/include/ptclib/shttpsvc.h 2016-07-27 18:09:23 UTC (rev 34885) +++ ptlib/trunk/include/ptclib/shttpsvc.h 2016-07-28 10:00:20 UTC (rev 34886) @@ -68,12 +68,24 @@ virtual PChannel * CreateChannelForHTTP(PChannel * channel); virtual void OnHTTPStarted(PHTTPServer & server); + /** Set/Create the server certificate to use. + Must be called before ListenForHTTP() or https will not be supported. + */ bool SetServerCertificate( - const PFilePath & certFile, - bool create = false, - const char * dn = NULL + const PFilePath & certFile, ///< Combined certificate/private key file + bool create = false, ///< Flag indicating a self signed certificate should be generated if it does not exist. + const char * dn = NULL ///< Distinguished Name to use if creating new self signed certificate. ); + /** Set the server certificates to use. + Must be called before ListenForHTTP() or https will not be supported. + */ + bool SetServerCertificates( + const PString & cert, ///< Certificate file or text string + const PString & key, ///< Private key file or text string + const PString & ca ///< Certificate authority file, directory or text string + ); + virtual PBoolean OnDetectedNonSSLConnection(PChannel * chan, const PString & line); virtual PString CreateNonSSLMessage(const PString & url); Modified: ptlib/trunk/src/ptclib/shttpsvc.cxx =================================================================== --- ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-07-27 18:09:23 UTC (rev 34885) +++ ptlib/trunk/src/ptclib/shttpsvc.cxx 2016-07-28 10:00:20 UTC (rev 34886) @@ -146,9 +146,6 @@ bool create, const char * dn) { - if (m_sslContext == NULL) - m_sslContext = new PSSLContext; - if (create && !PFile::Exists(certificateFile)) { PSSLPrivateKey key(1024); PSSLCertificate certificate; @@ -167,13 +164,22 @@ key.Save(certificateFile, true); } - if (m_sslContext->UseCertificate(certificateFile) && m_sslContext->UsePrivateKey(certificateFile)) + if (SetServerCertificates(certificateFile, certificateFile, PString::Empty())) return true; DisableSSL(); return false; } + +bool PSecureHTTPServiceProcess::SetServerCertificates(const PString & cert, const PString & key, const PString & ca) +{ + if (m_sslContext == NULL) + m_sslContext = new PSSLContext; + + return m_sslContext->SetCredentials(ca, cert, key); +} + PBoolean PSecureHTTPServiceProcess::OnDetectedNonSSLConnection(PChannel * chan, const PString & line) { // get the MIME info This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-27 18:09:26
|
Revision: 34885 http://sourceforge.net/p/opalvoip/code/34885 Author: rjongbloed Date: 2016-07-27 18:09:23 +0000 (Wed, 27 Jul 2016) Log Message: ----------- Fixed incorrect display of subject instead of issuer in SSL certificate handling. Also improved the debug output of certificate verification, and fixed some issues in recent changes to HTTP sample application. Modified Paths: -------------- ptlib/trunk/samples/httptest/httptest.cxx ptlib/trunk/src/ptclib/pssl.cxx Modified: ptlib/trunk/samples/httptest/httptest.cxx =================================================================== --- ptlib/trunk/samples/httptest/httptest.cxx 2016-07-27 17:13:50 UTC (rev 34884) +++ ptlib/trunk/samples/httptest/httptest.cxx 2016-07-27 18:09:23 UTC (rev 34885) @@ -94,7 +94,7 @@ if (ok) cout << str << endl; } - else if (op == "GET") + else if (op == "DELETE") ok = client.DeleteDocument(args[0]); else { if (args.GetCount() < 2) { @@ -104,8 +104,10 @@ if (op == "PUT") ok = client.PutDocument(args[0], PFilePath(args[1])); - else if (op == "POST") - ok = client.PostData(args[0], PFilePath(args[1])); + else if (op == "POST") { + PMIMEInfo outMIME; + ok = client.PostData(args[0], outMIME, args[1]); + } else { cerr << args.Usage("[ url [ file ] ]"); return; Modified: ptlib/trunk/src/ptclib/pssl.cxx =================================================================== --- ptlib/trunk/src/ptclib/pssl.cxx 2016-07-27 17:13:50 UTC (rev 34884) +++ ptlib/trunk/src/ptclib/pssl.cxx 2016-07-27 18:09:23 UTC (rev 34885) @@ -769,7 +769,7 @@ if (m_certificate == NULL) return false; - name = X509_Name(X509_get_subject_name(m_certificate)); + name = X509_Name(X509_get_issuer_name(m_certificate)); return name.IsValid(); } @@ -854,7 +854,7 @@ if (bio == NULL) return str; - X509_NAME_print_ex(bio, m_name, std::max(0, indent), indent < 0 ? XN_FLAG_ONELINE : XN_FLAG_MULTILINE); + X509_NAME_print_ex(bio, m_name, std::max(0, indent), indent < 0 ? XN_FLAG_ONELINE : (XN_FLAG_MULTILINE|XN_FLAG_DUMP_UNKNOWN_FIELDS)); char * data; int len = BIO_get_mem_data(bio, &data); @@ -1810,21 +1810,36 @@ static void TraceVerifyCallback(int ok, X509_STORE_CTX * ctx) { const unsigned Level = ok ? 5 : 2; - if (PTrace::GetLevel() >= Level) { + if (PTrace::CanTrace(Level)) { + ostream & trace = PTRACE_BEGIN(Level); + trace << "Verify callback: depth=" << X509_STORE_CTX_get_error_depth(ctx); + int err = X509_STORE_CTX_get_error(ctx); - int depth = X509_STORE_CTX_get_error_depth(ctx); + if (err != 0) + trace << ", err=" << err << " - " << X509_verify_cert_error_string(err); + PSSLCertificate cert(X509_STORE_CTX_get_current_cert(ctx)); - PSSLCertificate::X509_Name issuer, subject; - cert.GetIssuerName(issuer); - cert.GetSubjectName(subject); - PTRACE_BEGIN(Level) - << "Verify callback: depth=" - << depth - << ", err=" << err << " - " << X509_verify_cert_error_string(err) - << "\n Subject:\n" << subject.AsString(4) - << "\n Issuer:\n" << issuer.AsString(4) - << PTrace::End; + PSSLCertificate::X509_Name x509; + bool good = cert.GetSubjectName(x509); + trace << "\n Subject:"; + if (good) + trace << '\n' << x509.AsString(4); + else + trace << " Invalid!"; + + good = cert.GetIssuerName(x509); + trace << "\n Issuer:"; + if (good) + trace << '\n' << x509.AsString(4); + else + trace << " Invalid!"; + + PString alt = cert.GetSubjectAltName(); + if (!alt) + trace << "\n Subject-Alt: \"" << alt << '"'; + + trace << PTrace::End; } } #else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-27 17:13:53
|
Revision: 34884 http://sourceforge.net/p/opalvoip/code/34884 Author: rjongbloed Date: 2016-07-27 17:13:50 +0000 (Wed, 27 Jul 2016) Log Message: ----------- Updated and improved the HTTP test sample application. Modified Paths: -------------- ptlib/trunk/samples/httptest/httptest.cxx Modified: ptlib/trunk/samples/httptest/httptest.cxx =================================================================== --- ptlib/trunk/samples/httptest/httptest.cxx 2016-07-27 13:56:32 UTC (rev 34883) +++ ptlib/trunk/samples/httptest/httptest.cxx 2016-07-27 17:13:50 UTC (rev 34884) @@ -52,12 +52,11 @@ void HTTPTest::Main() { PArgList & args = GetArguments(); - args.Parse("h-help. print this help message.\n" - "G. do a GET\n" - "P. do a PUT" - "p-port: port number to listen on(default 80 or 443).\n" + args.Parse("h-help. print this help message.\n" + "O-operation: do a GET/POST/PUT/DELETE, if absent then acts as server\n" + "p-port: port number to listen on (default 80 or 443).\n" #if P_SSL - "s-secure. SSL/TLS mode.\n" + "s-secure. SSL/TLS mode for server.\n" "-ca: SSL/TLS client certificate authority file/directory.\n" "-certificate: SSL/TLS server certificate.\n" "-private-key: SSL/TLS server private key.\n" @@ -74,30 +73,49 @@ return; } - if (args.HasOption('G')) { + if (args.HasOption('O')) { if (args.GetCount() < 1) { cerr << args.Usage("url"); return; } - PString str; + PHTTPClient client; - if (client.GetTextDocument(args[0], str)) - cout << str << endl; - else - cout << "Error " << client.GetErrorText() << endl; - return; - } +#if P_SSL + client.SetSSLCredentials(args.GetOptionString("ca"), + args.GetOptionString("certificate"), + args.GetOptionString("private-key")); +#endif - if (args.HasOption('P')) { - if (args.GetCount() < 2) { - cerr << args.Usage("url file"); - return; + PCaselessString op = args.GetOptionString('O'); + bool ok; + if (op == "GET") { + PString str; + ok = client.GetTextDocument(args[0], str); + if (ok) + cout << str << endl; } - PHTTPClient client; - if (client.PutDocument(args[0], PFilePath(args[1]))) - cout << "Put succeeded\n"; + else if (op == "GET") + ok = client.DeleteDocument(args[0]); + else { + if (args.GetCount() < 2) { + cerr << args.Usage("url file"); + return; + } + + if (op == "PUT") + ok = client.PutDocument(args[0], PFilePath(args[1])); + else if (op == "POST") + ok = client.PostData(args[0], PFilePath(args[1])); + else { + cerr << args.Usage("[ url [ file ] ]"); + return; + } + } + if (ok) + cout << op << " sucessful."; else - cout << "Error " << client.GetErrorText() << endl; + cout << "Error in " << op << ' ' << client.GetErrorText(); + cout << endl; return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-27 13:56:34
|
Revision: 34883 http://sourceforge.net/p/opalvoip/code/34883 Author: rjongbloed Date: 2016-07-27 13:56:32 +0000 (Wed, 27 Jul 2016) Log Message: ----------- Update readme files. Modified Paths: -------------- ptlib/branches/v2_16/ReadMe.txt Removed Paths: ------------- ptlib/branches/v2_16/README_VXWORKS.txt ptlib/branches/v2_16/ReadMe.MingW32.txt ptlib/branches/v2_16/ReadMe_PortAudio.txt Deleted: ptlib/branches/v2_16/README_VXWORKS.txt =================================================================== --- ptlib/branches/v2_16/README_VXWORKS.txt 2016-07-26 09:14:33 UTC (rev 34882) +++ ptlib/branches/v2_16/README_VXWORKS.txt 2016-07-27 13:56:32 UTC (rev 34883) @@ -1,100 +0,0 @@ -Cummulative VxWorks patch for PWLIB -=================================== -Patch is done against CVS-snapshot dated: 9 juli 2004 - -This patch includes VxWorks specific updates (platform and compiler), -including a minor general update. - - -Disclaimer -========== -We have not yet thoroughly tested this patch-set against the latest -PWLIB. However all patches are already use in our 30-channel IP-gateway -product, which is using Openh323 based on version 1.10.4 (PWLib:1.4.4) -with some general community bugfixes added and is running very stable. -Our VxWorks environment is Tornado 2.1.1 for MIPS platform building the -MIPS images on Windows platform. - - -Patch history -============= -- Added Mozilla Public License header and revision history in tlibvx.cxx - (this was missing...) -- Implemention of critical section (for semaphores) -- Rewritten semaphore handling (was incredible buggy) -- Fixed synchronisation bug during launching of new task in PThread - (related to priority handling of VxWorks task scheduler) -- Fixed administration handling with PThreads (especially when PThread - was ending/terminating). Did show up under heavier load. -- Implemention of tracing facility in PThread (::Trace) -- Less use of asserts (for embedded environment) -- Increased stacksize for House-Keeping Thread (+ giving that beast a name) -- Included here and there lot of comments regarding specific behaviour - of VxWorks and/or Tornado-IDE version. -- Update in socket handling: - - Now supporting Non-Blocking sockets - - Fixed memory-leak in inet_ntoa(). - VxWorks does do malloc but no free!! Now using inet_ntoa_b. - - os_select now more directly with same behaviour -- Some P_TORNADO defines renamed to P_VXWORKS. - The P_TORNADO compiler define now applies to some specific TORNADO versions. - When using version 2.1.0 or earlier. This flag now only covers the compiler - bug and missing iostream. Suggested is to try to build VxWorks first without - P_TORNADO flag. In case of errors (compiler crashes or error in iostreams), - enable this flag. -- Resolved conflict due to VxWorks headerfile mbuf.h - Above mentioned headerfile includes a "#define m_data <to_something_else>" - (also for m_type) ?!?!. This resulted into the requirement to manually edit - some generated H.323 files (ASN.1) by placing #undef's after the includes - because the m_data in these files were overwritten by that #define. By - locating a central place to put "#undef m_data" and m_type this is history - now. Another step closer to full automatic generation of openh323. -- Adapted PMEMORY_CHECK for VxWorks variant -- Routed cfree to PMEMORY_CHECK (as counterpart of calloc) -- Moved other build variants from os_select to PSocket::Select -- Simplified remaining PXBlockOnIO -- Added copy constructors of PSemaphore, PMutex and PSyncPoint -- Removed unnecessary assignment in PMutex::WillBlock -- Removed unused PXBlockOnIO definition (not VxWorks specific) - - -Some comments for seting up PWLib for VxWorks -============================================= -- Get PWLib, and if If applicable: apply all patches -- Current way of working with ./configure.exe and ./make is not supported, so - you need to make/adapt your own makefile. -- WindRiver has a special adapted GCC compiler for VxWorks, which possible - requires to include -fpermissive in your CFLAG to make everything compiling. -- Add next VxWorks specific defines: - -DP_VXWORKS - -DVX_TASKS - -DP_TORNADO (only if your compiler *crashes*) - -DNO_LONG_DOUBLE - -DP_USE_PRAGMA - -DPHAS_TEMPLATES -- Big change you need to ask WindRiver support for a compiler patch to solve - the "Virtual memory Exhaust" problem during compile/link... - This has actually nothing to do with your internal PC memory, but all with - the applied stacksizes internally in the compiler. -- In CVS a module exist called pwlib_tornado. Here you can find the Tornado SDE - workspace files for ARM environment (like MS Developer Studio workspace files). - Sadly.. these are corrupt because they are saved/stored including CR+LF while - it should only contain <CR> (or LF?) => UNIX style. We're not using this but - just want to mention it here. -- Surely I forgot something... just drop me a mail. - - - -Happy VxWorks'ing with these patches. -If you have any questions or comments, just drop me a mail (see below) - - -Eize Slange - --- -Department: Development - Platform Enhancement -Philips Business Communications, The Netherlands (NL) -Homepage: http://www.sopho.philips.com -Tel: +31 (0) 35 6893604 -Fax: +31 (0) 35 6891290 -e-Mail: Eiz...@ph... Deleted: ptlib/branches/v2_16/ReadMe.MingW32.txt =================================================================== --- ptlib/branches/v2_16/ReadMe.MingW32.txt 2016-07-26 09:14:33 UTC (rev 34882) +++ ptlib/branches/v2_16/ReadMe.MingW32.txt 2016-07-27 13:56:32 UTC (rev 34883) @@ -1,13 +0,0 @@ -The following script can be used to compile PTLib (and Opal) -using MingW. - -Uncomment the appropriate line for 64 or 32 bit builds - -------------------------------------------------------- -#!/bin/sh - -export HOST_PREFIX=x86_64-w64-mingw32 -#export HOST_PREFIX=i586-mingw32msvc - -export PKG_CONFIG_LIBDIR=/usr/local/${HOST_PREFIX}/ -./configure --host=${HOST_PREFIX} Modified: ptlib/branches/v2_16/ReadMe.txt =================================================================== --- ptlib/branches/v2_16/ReadMe.txt 2016-07-26 09:14:33 UTC (rev 34882) +++ ptlib/branches/v2_16/ReadMe.txt 2016-07-27 13:56:32 UTC (rev 34883) @@ -7,13 +7,12 @@ 1. Introduction 2. Apologies - 3. CVS Access - 4. Building PTLib - 5. Using PTLib - 6. IPv6 issues - 7. Platform Specific Issues - 8. Conclusion - 9. Licensing + 3. Licensing + 4. CVS Access + 5. Building PTLib + 6. Using PTLib + 7. IPv6 issues + 8. Using PortAudio @@ -39,7 +38,7 @@ classes replaced or supplemented by STL. The library was used extensively for all our in-house products. Then we decided -to support OpenH323, and then Opal, by throwing in some of the code written for +to support OpenH323, and then OPAL, by throwing in some of the code written for one of our products. Thus, required PTLib so it got thrown into the open source world as well. @@ -68,48 +67,137 @@ not) include them in the base line code. Just do not send us any mail starting with the words "Why did you..." as the answer is quite likely to be "Because!" +This package is far from a "product". There is very limited documentation and +support will be on an ad-hoc basis, send us an e-mail and we will probably +answer your question if it isn't too difficult. +It is supplied mainly to support the OPAL project, but that shouldn't stop +you from using it in whatever project you have in mind if you so desire. We like +it and use it all the time, and we don't want to get into any religious wars of +this class library over that one. + ================================================================================ -3. SVN Access +9. Licensing +------------ + +The bulk of this library is licensed under the MPL (Mozilla Public License) +version 1.0. In simple terms this license allows you to use the library for +any purpose, commercial or otherwise, provided the library is kept in tact +as a separate entity and any changes made to the library are made publicly +available under the same (MPL) license. It is important to realise that that +refers to changes to the library and not your application that is merely +linked to the library. + +Note that due to a restriction in the GPL, any application you write that +uses anything another than GPL, eg our library with MPL, is technically in +breach of the GPL license. However, it should be noted that MPL does not +care about the license of the final application, and as only the author of +the GPL application is in breach of his own license and is unlikely to sue +themselves for that breach, in practice there is no problem with a GPL +application using an MPL or any other commercial library. + + +The random number generator is based on code originally by Bob Jenkins. + + +Portions of this library are from the REGEX library and is under the +following license: + +Copyright 1992, 1993, 1994, 1997 Henry Spencer. All rights reserved. +This software is not subject to any license of the American Telephone +and Telegraph Company or of the Regents of the University of California. + +Permission is granted to anyone to use this software for any purpose on +any computer system, and to alter it and redistribute it, subject +to the following restrictions: + +1. The author is not responsible for the consequences of use of this + software, no matter how awful, even if they arise from flaws in it. + +2. The origin of this software must not be misrepresented, either by + explicit claim or by omission. Since few users ever read sources, + credits must appear in the documentation. + +3. Altered versions must be plainly marked as such, and must not be + misrepresented as being the original software. Since few users + ever read sources, credits must appear in the documentation. + +4. This notice may not be removed or altered. + + +The in-band DTMF decoding code was taken from FreeBSD's dtmfdecode.c +application written by Poul-Henning Kamp. It has the following +license: + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * <ph...@Fr...> wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * ---------------------------------------------------------------------------- + + +================================================================================ + +4. SVN Access ------------- -There is a public SVN archive available at svn.sourceforge.net. To extract, use a -command line like the following: +There is a public SVN archive available at svn.sourceforge.net. To extract the +latest version, use a command line like the following: svn co http://opalvoip.svn.sourceforge.net/svnroot/opalvoip/ptlib/trunk -If you would like see the structure of the SVN, then use the View SVN tool at: +More information on stable branches is available at: - http://opalvoip.svn.sourceforge.net/viewvc/opalvoip/ + http://wiki.opalvoip.org/index.php?n=Main.Subversion ================================================================================ -4. Building PTLib +5. Building PTLib ----------------- This library is multi-platform, however there are only two major build systems that are used. The Microsoft DevStudio environment for Windows and the GNU make system for all of the various unix systems. -4.1. For Windows +5.1. For Windows ---------------- See the online documentation at: - http://www.opalvoip.org/wiki/index.php?n=Main.BuildingPTLib + http://wiki.opalvoip.org/index.php?n=Main.BuildingPTLib -4.2. For Linux/Unix +5.2. For Linux/Unix ------------------- See the online documentation at: - http://www.opalvoip.org/wiki/index.php?n=Main.BuildingPTLibUnix + http://wiki.opalvoip.org/index.php?n=Main.BuildingPTLibUnix +5.3. For MacOS +------------------- + +See the online documentation at: + + http://wiki.opalvoip.org/index.php?n=Main.BuildingPTLibMacOSX + +5.4. For MinGW + +Uncomment the appropriate line for 64 or 32 bit builds + +------------------------------------------------------- +#!/bin/sh + +export HOST_PREFIX=x86_64-w64-mingw32 +#export HOST_PREFIX=i586-mingw32msvc + +export PKG_CONFIG_LIBDIR=/usr/local/${HOST_PREFIX}/ +./configure --host=${HOST_PREFIX} + ================================================================================ -5. Using PTLib +6. Using PTLib -------------- What documentation there is consists of this document and all of the header @@ -117,7 +205,7 @@ produces HTML help files, but this never got completed. -5.1. Tutorial +6.1. Tutorial ------------- Detailed tutorials will almost certainly not be forthcoming. However, at least @@ -175,7 +263,7 @@ -------------------------------------------------------------------------------- -5.2. PTlib Classes +6.2. PTlib Classes ------------------ The classes in PTLib fall into the following broad categories @@ -185,20 +273,20 @@ Threads & Processes -5.2.1. Containers +6.2.1. Containers While there are a number of container classes you wourld rarely actually descend off them, you would use macros that declare type safe descendents. These are simply templates instantiations when using a compiler that supports templates in a simple manner (GNU C++ does not qualify in our opinion). -5.2.2. I/O +6.2.2. I/O There are many classes descendend from a basic primitive call a PChannel, which represents an entity for doing I/O. There are classes for files, serial ports, various types of socket and pipes to sub-processes. -5.2.3. Threads & Processes +6.2.3. Threads & Processes These classes support lightweight threading and functionality to do with the process as a whole (for example argument parsing). The threading will be @@ -208,7 +296,7 @@ ================================================================================ -6. IPv6 support in ptlib +7. IPv6 support in ptlib ------------------------ The IPv6 support in PTlib is supported and can be enabled or disabled via @@ -218,13 +306,7 @@ fully backward compatible. PTLib is able to manage simultaneously IPv4 and IPv6 connections. -6.1 Removed ------------ - -6.2 Removed ------------ - -6.3. Testing +7.1. Testing ------------ The test application sources can be found in the directory: opal/samples/simple @@ -236,7 +318,7 @@ -6.3.1. IPv6 Address and port notation +7.1.1. IPv6 Address and port notation ------------------------------------- IPv4 address and port are written in dot notation: xx.xx.xx.xx:4000 IPv6 global address are written in semi-colon notation: [xx:xx:xx:xx::xx]:4000 @@ -253,7 +335,7 @@ -6.3.2. Tests configuration +7.1.2. Tests configuration -------------------------- Tests 1,2,3 run on a single dual stack machine. IPv4 Address: 127.0.0.1, 10.0.0.6 @@ -269,7 +351,7 @@ -6.3.3. Test 1: IPv4 <--> IPv4 local call +7.1.3. Test 1: IPv4 <--> IPv4 local call ---------------------------------------- This test checks the backward compatibility with IPv4 @@ -280,7 +362,7 @@ -6.3.4. Test 2: IPv6 <--> IPv6 local call +7.1.4. Test 2: IPv6 <--> IPv6 local call ---------------------------------------- This test checks the IPv6 support @@ -290,7 +372,7 @@ simple.exe -tttt -n -i 3ffe:0b80:0002:f9c1:0000:0000:500b:0ea5 -n [::1] -6.3.5. Test 3: IPv4 <--> IPv6 local call +7.1.5. Test 3: IPv4 <--> IPv6 local call ---------------------------------------- This test checks that simultaneous IPv4 and IPv6 calls are supported. @@ -301,7 +383,7 @@ -6.3.6. Test 4: IPv4 <--> IPv4 call between two hosts +7.1.6. Test 4: IPv4 <--> IPv4 call between two hosts ---------------------------------------------------- This test checks the backward compatibility with IPv4 @@ -312,7 +394,7 @@ -6.3.7. Test 5: IPv6 <--> IPv6 call between two hosts +7.1.7. Test 5: IPv6 <--> IPv6 call between two hosts ---------------------------------------------------- This test checks the IPv6 support @@ -323,7 +405,7 @@ -6.3.8. Test 6: IPv4 <--> IPv6 call between two hosts +7.1.8. Test 6: IPv4 <--> IPv6 call between two hosts ---------------------------------------------------- This test checks that simultaneous IPv4 and IPv6 calls are supported. @@ -335,28 +417,21 @@ -------------------------------------------------------------------------------- -6.4. Known limitations +7.2. Known limitations -------------------- You must use IPv6 address with global scope. Tests with IPv6 local link address fail. - -------------------------------------------------------------------------------- -6.5. Questions +7.3. Questions -------------- -6.5.1. Removed --------------- - -6.5.2. Removed --------------- - -6.5.3. How to get an ipv6 address with a Global scope ? +7.3.1. How to get an ipv6 address with a Global scope ? ----------------------------------------------------- -6.5.3.1. Manually +7.3.1.1. Manually ----------------- Set one manually if you're not connected to IPv4 Internet or IPv6 backbone: @@ -376,7 +451,7 @@ RX bytes:0 (0.0 b) TX bytes:534 (534.0 b) -6.5.3.2. Tunnel broker +7.3.1.2. Tunnel broker ---------------------- Get one from a free IPv6 tunnel broker. @@ -391,116 +466,71 @@ -------------------------------------------------------------------------------- -6.6. Troubles +7.4. Troubles ------------ -6.6.1. Listen on ::1:1720 failed: Address family not supported by protocol +7.4.1. Listen on ::1:1720 failed: Address family not supported by protocol ----------------------------------------------------------------------- IPv6 module is not loaded in the kernel. #modprobe ipv6 -6.6.2. SimpleOpal TCP Could not open H.323 listener port on 1720 --------------------------------------------------------------- -Add some traces: -t on the command line. +================================================================================ +8. Using PortAudio +------------------ +PTLib can be configured to use PortAudio V19 for audio input and +output. Some distros (Ubuntu, for example) only include PortAudio +V18 so it is necessary to build it manually. -6.6.3. SimpleOpal TCP Listen on fe80::2b0:d0ff:fedf:d6bf:1720 failed: Invalid argument ------------------------------------------------------------------------------------- -This address is a local scope address. As the scope_id field is always set to 0, -its value is invalid. +PTLib can also use PortMixer (part of the Audacity project) but +not many distros provide this feature as it requires patching +PortAudio. -Use address with global scope. +The script below will extract latest PortAudio and PortMixer +from the correct source repositories, build and install it +into /opt/portaudio. Once this is done, configure ptlib as +follows: + ./configure --with-portaudio-dir=/opt/portaudio +This script has been verified on OSX Mountain Lion and +Ubuntu 12.01 for x64 + Craig (cr...@po...) -================================================================================ + 17 January, 2013 -7. Platform Specific Issues ---------------------------- +-------------------------------------------------- -See the Wiki at http://www.opalvoip.org/wiki/index.php?n=Main.HomePage +#!/bin/sh -================================================================================ +PREFIX=/opt/portaudio -8. Conclusion -------------- +svn co https://subversion.assembla.com/svn/portaudio/portaudio/trunk portaudio +svn co http://audacity.googlecode.com/svn/audacity-src/trunk/lib-src/portmixer portmixer -This package is far from a "product". There is very limited documentation and -support will be on an ad-hoc basis, send us an e-mail and we will probably -answer your question if it isn't too difficult. +cd portaudio +patch -p4 < ../portmixer/portaudio.patch +cd .. -It is supplied mainly to support the Opal project, but that shouldn't stop -you from using it in whatever project you have in mind if you so desire. We like -it and use it all the time, and we don't want to get into any religious wars of -this class library over that one. +cd portaudio +make clean +./configure --prefix=${PREFIX} +make +sudo make install +cd .. +cd portmixer +make clean +( export CFLAGS=-fPIC ; ./configure --with-pa-include=../portaudio/include/ --prefix=${PREFIX} ) +make +sudo cp libportmixer.a ${PREFIX}/lib +sudo cp include/portmixer.h ${PREFIX}/include +cd .. - - ================================================================================ -9. Licensing ------------- - -The bulk of this library is licensed under the MPL (Mozilla Public License) -version 1.0. In simple terms this license allows you to use the library for -any purpose, commercial or otherwise, provided the library is kept in tact -as a separate entity and any changes made to the library are made publicly -available under the same (MPL) license. It is important to realise that that -refers to changes to the library and not your application that is merely -linked to the library. - -Note that due to a restriction in the GPL, any application you write that -uses anything another than GPL, eg our library with MPL, is technically in -breach of the GPL license. However, it should be noted that MPL does not -care about the license of the final application, and as only the author of -the GPL application is in breach of his own license and is unlikely to sue -themselves for that breach, in practice there is no problem with a GPL -application using an MPL or any other commercial library. - - -The random number generator is based on code originally by Bob Jenkins. - - -Portions of this library are from the REGEX library and is under the -following license: - -Copyright 1992, 1993, 1994, 1997 Henry Spencer. All rights reserved. -This software is not subject to any license of the American Telephone -and Telegraph Company or of the Regents of the University of California. - -Permission is granted to anyone to use this software for any purpose on -any computer system, and to alter it and redistribute it, subject -to the following restrictions: - -1. The author is not responsible for the consequences of use of this - software, no matter how awful, even if they arise from flaws in it. - -2. The origin of this software must not be misrepresented, either by - explicit claim or by omission. Since few users ever read sources, - credits must appear in the documentation. - -3. Altered versions must be plainly marked as such, and must not be - misrepresented as being the original software. Since few users - ever read sources, credits must appear in the documentation. - -4. This notice may not be removed or altered. - - -The in-band DTMF decoding code was taken from FreeBSD's dtmfdecode.c -application written by Poul-Henning Kamp. It has the following -license: - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <ph...@Fr...> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - - - -================================================================================ +9. \ No newline at end of file Deleted: ptlib/branches/v2_16/ReadMe_PortAudio.txt =================================================================== --- ptlib/branches/v2_16/ReadMe_PortAudio.txt 2016-07-26 09:14:33 UTC (rev 34882) +++ ptlib/branches/v2_16/ReadMe_PortAudio.txt 2016-07-27 13:56:32 UTC (rev 34883) @@ -1,52 +0,0 @@ -Using PortAudio ---------------- - -PTLib can be configured to use PortAudio V19 for audio input and -output. Some distros (Ubuntu, for example) only include PortAudio -V18 so it is necessary to build it manually. - -PTLib can also use PortMixer (part of the Audacity project) but -not many distros provide this feature as it requires patching -PortAudio. - -The script below will extract latest PortAudio and PortMixer -from the correct source repositories, build and install it -into /opt/portaudio. Once this is done, configure ptlib as -follows: - - ./configure --with-portaudio-dir=/opt/portaudio - -This script has been verified on OSX Mountain Lion and -Ubuntu 12.01 for x64 - - Craig (cr...@po...) - - 17 January, 2013 - --------------------------------------------------- - -#!/bin/sh - -PREFIX=/opt/portaudio - -svn co https://subversion.assembla.com/svn/portaudio/portaudio/trunk portaudio -svn co http://audacity.googlecode.com/svn/audacity-src/trunk/lib-src/portmixer portmixer - -cd portaudio -patch -p4 < ../portmixer/portaudio.patch -cd .. - -cd portaudio -make clean -./configure --prefix=${PREFIX} -make -sudo make install -cd .. - -cd portmixer -make clean -( export CFLAGS=-fPIC ; ./configure --with-pa-include=../portaudio/include/ --prefix=${PREFIX} ) -make -sudo cp libportmixer.a ${PREFIX}/lib -sudo cp include/portmixer.h ${PREFIX}/include -cd .. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-26 09:14:36
|
Revision: 34882 http://sourceforge.net/p/opalvoip/code/34882 Author: rjongbloed Date: 2016-07-26 09:14:33 +0000 (Tue, 26 Jul 2016) Log Message: ----------- Fixed extra colon output if PTimeInterval displays days. Modified Paths: -------------- ptlib/trunk/src/ptlib/common/ptime.cxx Modified: ptlib/trunk/src/ptlib/common/ptime.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/ptime.cxx 2016-07-25 17:56:17 UTC (rev 34881) +++ ptlib/trunk/src/ptlib/common/ptime.cxx 2016-07-26 09:14:33 UTC (rev 34882) @@ -111,32 +111,26 @@ if (format == SecondsOnly) str << ns/SecsToNano; else { - bool hadPrevious = false; + std::streamsize digits = 1; if (format == IncludeDays && (ns > DaysToNano || width > (precision + 10))) { str << ns/DaysToNano << 'd'; ns = ns % DaysToNano; - hadPrevious = true; + digits = 2; } - if (hadPrevious || ns > HoursToNano || width > (precision + 7)) { - if (hadPrevious) - str << ':' << setw(2); - str << ns/HoursToNano; - hadPrevious = true; + if (digits > 1 || ns > HoursToNano || width > (precision + 7)) { + str << setw(digits) << ns/HoursToNano << ':'; + digits = 2; } ns = ns % HoursToNano; - if (hadPrevious || ns > MinsToNano || width > (precision + 4)) { - if (hadPrevious) - str << ':' << setw(2); - str << ns/MinsToNano; - hadPrevious = true; + if (digits > 1 || ns > MinsToNano || width > (precision + 4)) { + str << setw(digits) << ns/MinsToNano << ':'; + digits = 2; } - if (hadPrevious) - str << ':' << setw(2); - str << (ns % MinsToNano) / SecsToNano; + str << setw(digits) << (ns % MinsToNano)/SecsToNano; } ns = ns%SecsToNano; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-25 17:56:20
|
Revision: 34881 http://sourceforge.net/p/opalvoip/code/34881 Author: rjongbloed Date: 2016-07-25 17:56:17 +0000 (Mon, 25 Jul 2016) Log Message: ----------- Fixed crash if x264 encoder helper app increases resolution on the fly. Modified Paths: -------------- opal/trunk/plugins/video/x264/gpl/h264_helper.cxx Modified: opal/trunk/plugins/video/x264/gpl/h264_helper.cxx =================================================================== --- opal/trunk/plugins/video/x264/gpl/h264_helper.cxx 2016-07-20 17:35:20 UTC (rev 34880) +++ opal/trunk/plugins/video/x264/gpl/h264_helper.cxx 2016-07-25 17:56:17 UTC (rev 34881) @@ -175,9 +175,12 @@ H264Encoder x264; -void ResizeBuffer() +void ResizeBuffer(size_t len) { - size_t newBufSize = x264.GetWidth()*x264.GetHeight()*3/2 + rtpSize + 1024; + size_t newBufSize =x264.GetWidth()*x264.GetHeight()*3/2; + if (newBufSize < len) + newBufSize = len; + newBufSize += rtpSize + 1024; if (newBufSize > bufSize) { buffer = (unsigned char *)realloc(buffer, newBufSize); if (buffer == NULL) { @@ -266,15 +269,15 @@ WritePipe(&msg, sizeof(msg)); break; case ENCODE_FRAMES: - ResizeBuffer(); ReadPipe(&srcLen, sizeof(srcLen)); + ResizeBuffer(srcLen); ReadPipe(buffer+rtpSize, srcLen); ReadPipe(&headerLen, sizeof(headerLen)); ReadPipe(buffer, headerLen); ReadPipe(&flags, sizeof(flags)); case ENCODE_FRAMES_BUFFERED: { - ResizeBuffer(); + ResizeBuffer(0); unsigned dstLen = rtpSize; unsigned ret = x264.EncodeFrames(buffer+rtpSize, srcLen, buffer, dstLen, headerLen, flags); WritePipe(&msg, sizeof(msg)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-20 17:35:23
|
Revision: 34880 http://sourceforge.net/p/opalvoip/code/34880 Author: rjongbloed Date: 2016-07-20 17:35:20 +0000 (Wed, 20 Jul 2016) Log Message: ----------- Added some more information to video frame dropping trace log. Modified Paths: -------------- opal/trunk/src/codec/vidcodec.cxx Modified: opal/trunk/src/codec/vidcodec.cxx =================================================================== --- opal/trunk/src/codec/vidcodec.cxx 2016-07-20 17:34:07 UTC (rev 34879) +++ opal/trunk/src/codec/vidcodec.cxx 2016-07-20 17:35:20 UTC (rev 34880) @@ -246,7 +246,10 @@ return false; // Sent too many bits, drop frame - PTRACE(4, "Frame dropped, overrun=" << PString(PString::ScaleSI, m_frameDropBits, 3) << "bits."); + PTRACE(4, "Frame dropped:" + " overrun=" << PString(PString::ScaleSI, m_frameDropBits, 3) << "bits," + " rate=" << m_frameDropRate << "," + " period=" << m_frameDropPeriod); ++m_framesDropped; return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-20 17:34:10
|
Revision: 34879 http://sourceforge.net/p/opalvoip/code/34879 Author: rjongbloed Date: 2016-07-20 17:34:07 +0000 (Wed, 20 Jul 2016) Log Message: ----------- Moved trace log for when PTimer::OnTimeout() has taken longer than the timeout time to complete, so can provide more information on timer. 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-07-19 21:19:51 UTC (rev 34878) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-07-20 17:34:07 UTC (rev 34879) @@ -1316,7 +1316,6 @@ if (list->OnTimeout(m_handle)) return; - PTRACE(5, NULL, PTraceModule(), "Timer: [" << m_handle << "] already in OnTimeout(), waiting."); PThread::Sleep(10); } } @@ -1337,8 +1336,13 @@ if (!timer->m_oneshot && !timer->m_running) return true; // Was recurring timer and was stopped - if (!timer->m_callbackMutex.Try()) + if (!timer->m_callbackMutex.Try()) { + PTRACE(4, timer, PTraceModule(), "Timer: [handle=" << handle << "," + " ptr=" << timer << "," + " name=\"" << timer->m_threadName << "\"]" + " already in OnTimeout(), waiting."); return false; // Try again + } // Remove the expired one shot timers from map if (timer->m_oneshot && !timer->m_running) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-19 21:19:54
|
Revision: 34878 http://sourceforge.net/p/opalvoip/code/34878 Author: rjongbloed Date: 2016-07-19 21:19:51 +0000 (Tue, 19 Jul 2016) Log Message: ----------- Fixed some issues in RTP playback: Reset sequence numbers on change of SSRC. Restore original RTP packet if failed to find out of order on. Improve some logging. Fix compile without trace logging. Modified Paths: -------------- opal/branches/v3_16/include/rtp/pcapfile.h opal/branches/v3_16/src/rtp/pcapfile.cxx Modified: opal/branches/v3_16/include/rtp/pcapfile.h =================================================================== --- opal/branches/v3_16/include/rtp/pcapfile.h 2016-07-19 21:16:44 UTC (rev 34877) +++ opal/branches/v3_16/include/rtp/pcapfile.h 2016-07-19 21:19:51 UTC (rev 34878) @@ -70,9 +70,11 @@ { OpalTranscoder * m_transcoder; RTP_SequenceNumber m_lastSequenceNumber; + RTP_SyncSourceId m_lastSSRC; DecodeContext() : m_transcoder(NULL) , m_lastSequenceNumber(0) + , m_lastSSRC(0) { } ~DecodeContext(); }; Modified: opal/branches/v3_16/src/rtp/pcapfile.cxx =================================================================== --- opal/branches/v3_16/src/rtp/pcapfile.cxx 2016-07-19 21:16:44 UTC (rev 34877) +++ opal/branches/v3_16/src/rtp/pcapfile.cxx 2016-07-19 21:19:51 UTC (rev 34878) @@ -64,9 +64,13 @@ : m_filterSSRC(0) { OpalMediaFormatList list = OpalMediaFormat::GetAllRegisteredMediaFormats(); - for (PINDEX i = 0; i < list.GetSize(); i++) { - if (list[i].GetPayloadType() < RTP_DataFrame::DynamicBase) - m_payloadType2mediaFormat[list[i].GetPayloadType()] = list[i]; + for (OpalMediaFormatList::iterator it = list.begin(); it != list.end(); ++it) { + OpalMediaFormat fmt = *it; + if (fmt.GetPayloadType() < RTP_DataFrame::LastKnownPayloadType) { + RTP_DataFrame::PayloadTypes pt = fmt.GetPayloadType(); + m_payloadType2mediaFormat[pt] = fmt; + PTRACE(4, "Pre-defined payload type " << pt << " set to " << fmt); + } } } @@ -276,31 +280,39 @@ return -2; } + RTP_SyncSourceId thisSSRC = encodedRTP.GetSyncSource(); RTP_SequenceNumber thisSequenceNumber = encodedRTP.GetSequenceNumber(); RTP_SequenceNumber expectedSequenceNumber = context.m_lastSequenceNumber + 1; RTP_SequenceNumber sequenceDelta = thisSequenceNumber - expectedSequenceNumber; if (context.m_lastSequenceNumber != 0) { - if (sequenceDelta > (1<<16)-500) { - PTRACE(3, "Skipping duplicate or out of order RTP packet " << thisSequenceNumber); + if (context.m_lastSSRC != thisSSRC) { + PTRACE(3, "Changed SSRC, restarting RTP sequence numbers from " << thisSequenceNumber); + } + else if (sequenceDelta > (1<<16)-500) { + PTRACE(3, "Skipping duplicate or out of order RTP packet " << thisSequenceNumber << ", expected " << expectedSequenceNumber); return 0; } - - if (sequenceDelta > 3000) + else if (sequenceDelta > 3000) PTRACE(3, "Restarting RTP sequence numbers from " << thisSequenceNumber); else if (sequenceDelta > 0) { bool missing = true; - off_t nextPacketsFilePosition = GetPosition(); // Scan ahead 100 packets looking for out of order one for (PINDEX i = 0; i < 100; ++i) { - if (GetRTP(encodedRTP) >= 0 && encodedRTP.GetSequenceNumber() == thisSequenceNumber) { - // Found it, move file back to the packet we just read, to read again next time - SetPosition(thisPacketsFilePosition); + if (GetRTP(encodedRTP) >= 0 && encodedRTP.GetSequenceNumber() == expectedSequenceNumber) { + PTRACE(3, "Restoring out of order packet at " << expectedSequenceNumber); missing = false; + break; } } + + /* If found move back to position so is read next time, then the one we + are using now is skipped as out of order. If not found we read it + again immediately. */ + SetPosition(thisPacketsFilePosition); + if (missing) { - SetPosition(nextPacketsFilePosition); + GetRTP(encodedRTP); encodedRTP.SetDiscontinuity(sequenceDelta); PTRACE(3, "Detected " << sequenceDelta << " missing RTP packets:" " expected=" << expectedSequenceNumber << ", got=" << thisSequenceNumber); @@ -309,6 +321,7 @@ } context.m_lastSequenceNumber = thisSequenceNumber; + context.m_lastSSRC = thisSSRC; RTP_DataFrameList output; if (!context.m_transcoder->ConvertFrames(encodedRTP, output)) @@ -347,7 +360,7 @@ void OpalPCAPFile::DiscoveredRTPKey::PrintOn(ostream & strm) const { - strm << m_src << " -> " << m_dst << " src=" << RTP_TRACE_SRC(m_ssrc); + strm << m_src << " -> " << m_dst << " SSRC=" << m_ssrc; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-19 21:16:47
|
Revision: 34877 http://sourceforge.net/p/opalvoip/code/34877 Author: rjongbloed Date: 2016-07-19 21:16:44 +0000 (Tue, 19 Jul 2016) Log Message: ----------- FIxed incorrect payload type in MS-ADPCM codec. Modified Paths: -------------- opal/branches/v3_16/plugins/audio/IMA_ADPCM/ima_adpcm.c Modified: opal/branches/v3_16/plugins/audio/IMA_ADPCM/ima_adpcm.c =================================================================== --- opal/branches/v3_16/plugins/audio/IMA_ADPCM/ima_adpcm.c 2016-07-15 10:24:30 UTC (rev 34876) +++ opal/branches/v3_16/plugins/audio/IMA_ADPCM/ima_adpcm.c 2016-07-19 21:16:44 UTC (rev 34877) @@ -427,7 +427,7 @@ PluginCodec_MediaTypeAudio | // audio codec PluginCodec_InputTypeRaw | // raw input data PluginCodec_OutputTypeRaw | // raw output data - PluginCodec_RTPTypeExplicit, // specified RTP type + PluginCodec_RTPTypeDynamic, // specified RTP type desc, // text decription L16Desc, // source format This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |