opalvoip-svn Mailing List for OpalVOIP (Page 3)
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-07-15 10:24:33
|
Revision: 34876 http://sourceforge.net/p/opalvoip/code/34876 Author: rjongbloed Date: 2016-07-15 10:24:30 +0000 (Fri, 15 Jul 2016) Log Message: ----------- 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/trunk/include/ptclib/threadpool.h ptlib/trunk/src/ptclib/threadpool.cxx Modified: ptlib/trunk/include/ptclib/threadpool.h =================================================================== --- ptlib/trunk/include/ptclib/threadpool.h 2016-07-14 17:10:51 UTC (rev 34875) +++ ptlib/trunk/include/ptclib/threadpool.h 2016-07-15 10:24:30 UTC (rev 34876) @@ -192,7 +192,7 @@ void SetMaxWorkers( unsigned count - ) { m_maxWorkerCount = count; } + ); unsigned GetMaxUnits() const { return m_maxWorkUnitCount; } Modified: ptlib/trunk/src/ptclib/threadpool.cxx =================================================================== --- ptlib/trunk/src/ptclib/threadpool.cxx 2016-07-14 17:10:51 UTC (rev 34875) +++ ptlib/trunk/src/ptclib/threadpool.cxx 2016-07-15 10:24:30 UTC (rev 34876) @@ -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(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-14 17:10:53
|
Revision: 34875 http://sourceforge.net/p/opalvoip/code/34875 Author: rjongbloed Date: 2016-07-14 17:10:51 +0000 (Thu, 14 Jul 2016) Log Message: ----------- Fixed compile of PPipeChannel::Run() Modified Paths: -------------- ptlib/trunk/src/ptlib/unix/pipechan.cxx Modified: ptlib/trunk/src/ptlib/unix/pipechan.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/pipechan.cxx 2016-07-14 17:02:13 UTC (rev 34874) +++ ptlib/trunk/src/ptlib/unix/pipechan.cxx 2016-07-14 17:10:51 UTC (rev 34875) @@ -490,7 +490,7 @@ cmdWithStderr += " 2>&1"; FILE * pipe = popen(cmdWithStderr, "r"); if (pipe == NULL) { - PTRACE(2, NULL, "Could not execute command [" << command << "] - " << strerror(errno)); + PTRACE2(2, NULL, "Could not execute command [" << command << "] - errno=" << errno); return -1; } @@ -501,13 +501,12 @@ int status = pclose(pipe); #if PTRACING - ostream & trace = PTRACE_BEGIN(4); - trace << "Sub-process [" << command << "] executed: status=" << WEXITSTATUS(errorCode); - if (WIFSIGNALED(errorCode)) - trace << ", signal=" << WTERMSIG(errorCode); - if (WCOREDUMP(errorCode)) + ostream & trace = PTRACE_BEGIN(4, NULL, PTraceModule()); + trace << "Sub-process [" << command << "] executed: status=" << WEXITSTATUS(status); + if (WIFSIGNALED(status)) + trace << ", signal=" << WTERMSIG(status); + if (WCOREDUMP(status)) trace << ", core dumped"; - } trace << PTrace::End; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-14 17:02:20
|
Revision: 34874 http://sourceforge.net/p/opalvoip/code/34874 Author: rjongbloed Date: 2016-07-14 17:02:13 +0000 (Thu, 14 Jul 2016) Log Message: ----------- Added PPipeChannel::Run() to give similar functionality to Unix popen(). Modified Paths: -------------- ptlib/trunk/include/ptlib/pipechan.h ptlib/trunk/src/ptlib/msos/pipe.cxx ptlib/trunk/src/ptlib/unix/pipechan.cxx Modified: ptlib/trunk/include/ptlib/pipechan.h =================================================================== --- ptlib/trunk/include/ptlib/pipechan.h 2016-07-14 16:59:36 UTC (rev 34873) +++ ptlib/trunk/include/ptlib/pipechan.h 2016-07-14 17:02:13 UTC (rev 34874) @@ -378,6 +378,26 @@ PBoolean wait = false ///< Flag to indicate if function should block ); + /**Run the command synchonously and return the output. + Note it is expected that no output to the command is required, so stdin + will be EOF immediately. It is also expected that the command will run + to complation and all output, stdout and stderr, is captured to the + \p output parameter. + + @return + status code of the sub-process, if it ran to completion. If -1 then the + command failed to run at all. Other negative values indicates that the + process was terminated in an abnormal manner, e.g. crashed. The values + are platform specific, for Linux this is the negative value of signal + that the process was terminated with. + */ + static int Run( + const PString & command, ///< Command to execute + PString & output, ///< Output of command + bool includeStderr = true, ///< Include stderr in the above output + const PTimeInterval & timeout = PMaxTimeInterval ///< Timeout for waiting on output from sub-process + ); + /**Determine if the platform can support simultaneous read and writes from the PPipeChannel (eg MSDOS returns false, Unix returns true). Modified: ptlib/trunk/src/ptlib/msos/pipe.cxx =================================================================== --- ptlib/trunk/src/ptlib/msos/pipe.cxx 2016-07-14 16:59:36 UTC (rev 34873) +++ ptlib/trunk/src/ptlib/msos/pipe.cxx 2016-07-14 17:02:13 UTC (rev 34874) @@ -355,4 +355,20 @@ #endif // !_WIN32_WCE +int PPipeChannel::Run(const PString & command, PString & output, bool includeStderr, const PTimeInterval & timeout) +{ + PPipeChannel pipe; + pipe.SetReadTimeout(timeout); + + if (!pipe.Open(command, PPipeChannel::ReadOnly, true, !includeStderr) | !pipe.Execute()) + return -1; + + // Read until end of file, or timeout + output = pipe.ReadString(P_MAX_INDEX); + + // Wait for completion, which should have already happened + return pipe.WaitForTermination(1000); +} + + // End Of File /////////////////////////////////////////////////////////////// Modified: ptlib/trunk/src/ptlib/unix/pipechan.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/pipechan.cxx 2016-07-14 16:59:36 UTC (rev 34873) +++ ptlib/trunk/src/ptlib/unix/pipechan.cxx 2016-07-14 17:02:13 UTC (rev 34874) @@ -134,7 +134,7 @@ static const int TraceLevel = 5; if (PTrace::CanTrace(TraceLevel)) { ostream & log = PTRACE_BEGIN(TraceLevel); - log << "Forked child process \"" << subProgram << '"'; + log << "Forked child process (pid=" << m_childPID << ") \"" << subProgram << '"'; for (PINDEX i = 0; i < argumentList.GetSize(); ++i) log << " \"" << argumentList[i] << '"'; log << PTrace::End; @@ -481,3 +481,43 @@ } +int PPipeChannel::Run(const PString & command, PString & output, bool includeStderr, const PTimeInterval & timeout) +{ + output.MakeEmpty(); + + PString cmdWithStderr = command; + if (includeStderr) + cmdWithStderr += " 2>&1"; + FILE * pipe = popen(cmdWithStderr, "r"); + if (pipe == NULL) { + PTRACE(2, NULL, "Could not execute command [" << command << "] - " << strerror(errno)); + return -1; + } + + int c; + while ((c = fgetc(pipe)) != EOF) + output += (char)c; + + int status = pclose(pipe); + +#if PTRACING + ostream & trace = PTRACE_BEGIN(4); + trace << "Sub-process [" << command << "] executed: status=" << WEXITSTATUS(errorCode); + if (WIFSIGNALED(errorCode)) + trace << ", signal=" << WTERMSIG(errorCode); + if (WCOREDUMP(errorCode)) + trace << ", core dumped"; + } + trace << PTrace::End; +#endif + + if (WCOREDUMP(status)) + return INT_MIN; + + if (WIFSIGNALED(status)) + return - WTERMSIG(status); + + return WEXITSTATUS(status); +} + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-14 16:59:39
|
Revision: 34873 http://sourceforge.net/p/opalvoip/code/34873 Author: rjongbloed Date: 2016-07-14 16:59:36 +0000 (Thu, 14 Jul 2016) Log Message: ----------- Fixed any src/dst dimension when cropping. Modified Paths: -------------- ptlib/trunk/src/ptlib/common/vconvert.cxx Modified: ptlib/trunk/src/ptlib/common/vconvert.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-07-14 16:59:04 UTC (rev 34872) +++ ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-07-14 16:59:36 UTC (rev 34873) @@ -712,8 +712,8 @@ if (srcWidthByDstHeight < dstWidthBySrcHeight) { unsigned outputWidth = (srcWidthByDstHeight/srcHeight)&~1; unsigned ouputX = ((dstWidth - outputWidth)/2)&~1; - FillYUV420P( 0, 0, ouputX, dstHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); - FillYUV420P(outputWidth-ouputX, 0, ouputX, dstHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); + FillYUV420P( 0, 0, ouputX, dstHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); + FillYUV420P(dstWidth-ouputX, 0, ouputX, dstHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); return CopyYUV420P(srcX, srcY, srcWidth, srcHeight, srcFrameWidth, srcFrameHeight, srcYUV, ouputX, 0, outputWidth, dstHeight, dstFrameWidth, dstFrameHeight, dstYUV, PVideoFrameInfo::eScale, verticalFlip, error); @@ -721,8 +721,8 @@ else if (srcWidthByDstHeight > dstWidthBySrcHeight) { unsigned outputHeight = (dstWidthBySrcHeight/srcWidth)&~1; unsigned outputY = ((dstHeight - outputHeight)/2)&~1; - FillYUV420P(0, 0, dstWidth, outputY, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); - FillYUV420P(0, outputHeight-outputY, dstWidth, outputY, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); + FillYUV420P(0, 0, dstWidth, outputY, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); + FillYUV420P(0, dstHeight-outputY, dstWidth, outputY, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); return CopyYUV420P(srcX, srcY, srcWidth, srcHeight, srcFrameWidth, srcFrameHeight, srcYUV, 0, outputY, dstWidth, outputHeight, dstFrameWidth, dstFrameHeight, dstYUV, PVideoFrameInfo::eScale, verticalFlip, error); @@ -788,38 +788,43 @@ break; case PVideoFrameInfo::eCropTopLeft : - if (srcWidth <= dstWidth) { + if (srcWidth >= dstWidth) + srcWidth = dstWidth; + else { FillYUV420P(dstX + srcWidth, dstY, dstWidth - srcWidth, dstHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); - if (srcHeight < dstHeight) - FillYUV420P(dstX, dstY + srcHeight, dstWidth, dstHeight - srcHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); dstWidth = srcWidth; - dstHeight = srcHeight; } + + if (srcHeight >= dstHeight) + srcHeight = dstHeight; else { - srcWidth = dstWidth; - srcHeight = dstHeight; + FillYUV420P(dstX, dstY + srcHeight, dstWidth, dstHeight - srcHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); + dstHeight = srcHeight; } break; case PVideoFrameInfo::eCropCentre : - if (srcWidth <= dstWidth) { - unsigned deltaX = (dstWidth - srcWidth)/2; - unsigned deltaY = (dstHeight - srcHeight)/2; - FillYUV420P(dstX, dstY, deltaX, dstHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); - FillYUV420P(dstX+deltaX+srcWidth, dstY, deltaX, dstHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); - if (srcHeight < dstHeight) { - FillYUV420P(dstX+deltaX, dstY, srcWidth, deltaY, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); - FillYUV420P(dstX+deltaX, dstY+deltaY+srcHeight, srcWidth, deltaY, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); - } - dstX += deltaX; - dstY += deltaY; + if (dstWidth > srcWidth) { + unsigned fillWidth = ((dstWidth - srcWidth)/2)&~1; + FillYUV420P( dstX, dstY, fillWidth, dstHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); + FillYUV420P(dstWidth-fillWidth, dstY, fillWidth, dstHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); + dstX += fillWidth; dstWidth = srcWidth; - dstHeight = srcHeight; } else { srcX += (srcWidth - dstWidth)/2; + srcWidth = dstWidth; + } + + if (dstHeight > srcHeight) { + unsigned fillHeight = ((dstHeight - srcHeight)/2)&~1; + FillYUV420P(dstX, dstY, dstWidth, fillHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); + FillYUV420P(dstX, dstHeight-fillHeight, dstWidth, fillHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); + dstY += fillHeight; + dstWidth = srcHeight; + } + else { srcY += (srcHeight - dstHeight)/2; - srcWidth = dstWidth; srcHeight = dstHeight; } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-14 16:59:06
|
Revision: 34872 http://sourceforge.net/p/opalvoip/code/34872 Author: rjongbloed Date: 2016-07-14 16:59:04 +0000 (Thu, 14 Jul 2016) Log Message: ----------- Added YUV scaling mode that maintains aspect ratio, part 2. Modified Paths: -------------- ptlib/trunk/src/ptlib/common/videoio.cxx Modified: ptlib/trunk/src/ptlib/common/videoio.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/videoio.cxx 2016-07-14 14:33:09 UTC (rev 34871) +++ ptlib/trunk/src/ptlib/common/videoio.cxx 2016-07-14 16:59:04 UTC (rev 34872) @@ -134,6 +134,8 @@ return strm << "Centred"; case PVideoFrameInfo::eCropTopLeft : return strm << "Cropped"; + case PVideoFrameInfo::eScaleKeepAspect : + return strm << "Aspect"; default : return strm << "ResizeMode<" << (int)mode << '>'; } @@ -349,7 +351,10 @@ { "centered",eCropCentre }, { "crop", eCropTopLeft }, { "cropped", eCropTopLeft }, - { "topleft", eCropTopLeft } + { "topleft", eCropTopLeft }, + { "scalekeepaspect", eScaleKeepAspect }, + { "keepaspect", eScaleKeepAspect }, + { "aspect", eScaleKeepAspect }, }; PCaselessString crop = str.Mid(resizeOffset+1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-14 14:33:12
|
Revision: 34871 http://sourceforge.net/p/opalvoip/code/34871 Author: rjongbloed Date: 2016-07-14 14:33:09 +0000 (Thu, 14 Jul 2016) Log Message: ----------- Allow for any src/dst dimension when cropping. Modified Paths: -------------- ptlib/trunk/src/ptlib/common/vconvert.cxx Modified: ptlib/trunk/src/ptlib/common/vconvert.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-07-14 12:56:09 UTC (rev 34870) +++ ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-07-14 14:33:09 UTC (rev 34871) @@ -666,6 +666,7 @@ static bool ValidateDimensions(unsigned srcFrameWidth, unsigned srcFrameHeight, unsigned dstFrameWidth, unsigned dstFrameHeight, + PVideoFrameInfo::ResizeMode resizeMode, std::ostream * error) { if (srcFrameWidth == 0 || dstFrameWidth == 0 || srcFrameHeight == 0 || dstFrameHeight == 0) { @@ -675,6 +676,9 @@ return false; } + if (resizeMode != PVideoFrameInfo::eScale) + return true; + if (srcFrameWidth <= dstFrameWidth && srcFrameHeight <= dstFrameHeight) return true; @@ -725,7 +729,7 @@ } } - if (!ValidateDimensions(srcWidth, srcHeight, dstWidth, dstHeight, error)) + if (!ValidateDimensions(srcWidth, srcHeight, dstWidth, dstHeight, resizeMode, error)) return false; if (srcFrameWidth == 0) @@ -1512,7 +1516,7 @@ PSTANDARD_COLOUR_CONVERTER(YUY2,YUV420P) { - if (!ValidateDimensions(m_srcFrameWidth, m_srcFrameHeight, m_dstFrameWidth, m_dstFrameHeight, NULL)) + if (!ValidateDimensions(m_srcFrameWidth, m_srcFrameHeight, m_dstFrameWidth, m_dstFrameHeight, m_resizeMode, NULL)) return false; if (m_dstFrameWidth == m_srcFrameWidth) @@ -1653,7 +1657,7 @@ */ PSTANDARD_COLOUR_CONVERTER(YUV422,YUV420P) { - if (!ValidateDimensions(m_srcFrameWidth, m_srcFrameHeight, m_dstFrameWidth, m_dstFrameHeight, NULL)) + if (!ValidateDimensions(m_srcFrameWidth, m_srcFrameHeight, m_dstFrameWidth, m_dstFrameHeight, m_resizeMode, NULL)) return false; if (m_dstFrameWidth == m_srcFrameWidth) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-14 12:56:12
|
Revision: 34870 http://sourceforge.net/p/opalvoip/code/34870 Author: rjongbloed Date: 2016-07-14 12:56:09 +0000 (Thu, 14 Jul 2016) Log Message: ----------- Added YUV scaling mode that maintains aspect ratio. Modified Paths: -------------- ptlib/trunk/include/ptlib/vconvert.h ptlib/trunk/include/ptlib/videoio.h ptlib/trunk/src/ptlib/common/vconvert.cxx Modified: ptlib/trunk/include/ptlib/vconvert.h =================================================================== --- ptlib/trunk/include/ptlib/vconvert.h 2016-07-14 12:06:40 UTC (rev 34869) +++ ptlib/trunk/include/ptlib/vconvert.h 2016-07-14 12:56:09 UTC (rev 34870) @@ -418,7 +418,7 @@ PJPEGConverter( unsigned width, ///< Output width, zero indicates same is JPEG input unsigned height, ///< Output height, zero indicates same is JPEG input - PVideoFrameInfo::ResizeMode resizeMode = PVideoFrameInfo::eScale, ///< How to produce output + PVideoFrameInfo::ResizeMode resizeMode = PVideoFrameInfo::eScaleKeepAspect, ///< How to produce output const PString & colourFormat = PVideoFrameInfo::YUV420P() ///< Output colour format ); /**Construct a JPEG converter. Modified: ptlib/trunk/include/ptlib/videoio.h =================================================================== --- ptlib/trunk/include/ptlib/videoio.h 2016-07-14 12:06:40 UTC (rev 34869) +++ ptlib/trunk/include/ptlib/videoio.h 2016-07-14 12:56:09 UTC (rev 34870) @@ -56,7 +56,8 @@ P_DECLARE_ENUM_EX(ResizeMode,eMaxResizeMode, eScale,0, eCropCentre, - eCropTopLeft + eCropTopLeft, + eScaleKeepAspect ); friend ostream & operator<<(ostream & strm, ResizeMode mode); Modified: ptlib/trunk/src/ptlib/common/vconvert.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-07-14 12:06:40 UTC (rev 34869) +++ ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-07-14 12:56:09 UTC (rev 34870) @@ -702,6 +702,29 @@ return true; } + if (resizeMode == PVideoFrameInfo::eScaleKeepAspect) { + unsigned srcWidthByDstHeight = srcWidth * dstHeight; + unsigned dstWidthBySrcHeight = dstWidth * srcHeight; + if (srcWidthByDstHeight < dstWidthBySrcHeight) { + unsigned outputWidth = (srcWidthByDstHeight/srcHeight)&~1; + unsigned ouputX = ((dstWidth - outputWidth)/2)&~1; + FillYUV420P( 0, 0, ouputX, dstHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); + FillYUV420P(outputWidth-ouputX, 0, ouputX, dstHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); + return CopyYUV420P(srcX, srcY, srcWidth, srcHeight, srcFrameWidth, srcFrameHeight, srcYUV, + ouputX, 0, outputWidth, dstHeight, dstFrameWidth, dstFrameHeight, dstYUV, + PVideoFrameInfo::eScale, verticalFlip, error); + } + else if (srcWidthByDstHeight > dstWidthBySrcHeight) { + unsigned outputHeight = (dstWidthBySrcHeight/srcWidth)&~1; + unsigned outputY = ((dstHeight - outputHeight)/2)&~1; + FillYUV420P(0, 0, dstWidth, outputY, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); + FillYUV420P(0, outputHeight-outputY, dstWidth, outputY, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); + return CopyYUV420P(srcX, srcY, srcWidth, srcHeight, srcFrameWidth, srcFrameHeight, srcYUV, + 0, outputY, dstWidth, outputHeight, dstFrameWidth, dstFrameHeight, dstYUV, + PVideoFrameInfo::eScale, verticalFlip, error); + } + } + if (!ValidateDimensions(srcWidth, srcHeight, dstWidth, dstHeight, error)) return false; @@ -748,7 +771,7 @@ BYTE * dstPtr, unsigned dstWidth, unsigned dstHeight, int dstFrameWidth) = CropYUV420P; switch (resizeMode) { - case PVideoFrameInfo::eScale : + default : // Scaling options if (srcWidth > dstWidth) rowFunction = ShrinkBothYUV420P; else if (srcWidth < dstWidth) @@ -760,7 +783,6 @@ // else use crop break; - default : case PVideoFrameInfo::eCropTopLeft : if (srcWidth <= dstWidth) { FillYUV420P(dstX + srcWidth, dstY, dstWidth - srcWidth, dstHeight, dstFrameWidth, dstFrameHeight, dstYUV, 0, 0, 0); @@ -3277,6 +3299,7 @@ : PColourConverter(PColourPair("JPEG", PVideoFrameInfo::YUV420P())) , m_context(new Context) { + SetResizeMode(PVideoFrameInfo::eScaleKeepAspect); } @@ -3293,6 +3316,7 @@ : PColourConverter(colours) , m_context(new Context) { + SetResizeMode(PVideoFrameInfo::eScaleKeepAspect); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-14 12:06:43
|
Revision: 34869 http://sourceforge.net/p/opalvoip/code/34869 Author: rjongbloed Date: 2016-07-14 12:06:40 +0000 (Thu, 14 Jul 2016) Log Message: ----------- Added more trace logging to PJPEGConverter Modified Paths: -------------- ptlib/trunk/src/ptlib/common/vconvert.cxx Modified: ptlib/trunk/src/ptlib/common/vconvert.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-07-14 11:14:14 UTC (rev 34868) +++ ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-07-14 12:06:40 UTC (rev 34869) @@ -2938,6 +2938,7 @@ } tinyjpeg_set_flags(m_decoder, TINYJPEG_FLAGS_MJPEG_TABLE); + PTRACE(4, NULL, "JPEG", "TinyJpeg decoder created"); } @@ -2945,6 +2946,7 @@ { if (m_decoder != NULL) free(m_decoder); + PTRACE(4, NULL, "JPEG", "TinyJpeg decoder destroyed"); } @@ -2962,7 +2964,7 @@ bool Finish(BYTE * dstFrameBuffer, unsigned width, unsigned height) { - if (dstFrameBuffer == NULL) + if (PAssertNULL(dstFrameBuffer) == NULL) return false; int componentCount = 1; @@ -3008,12 +3010,14 @@ { m_decoder.err = jpeg_std_error(&m_error_mgr); jpeg_create_decompress(&m_decoder); + PTRACE(4, NULL, "JPEG", "libjpeg decoder created"); } ~Context() { jpeg_destroy_decompress(&m_decoder); + PTRACE(4, NULL, "JPEG", "libjpeg decoder destroyed"); } @@ -3227,8 +3231,13 @@ if (!Finish(m_temporaryBuffer.GetPointer(PVideoFrameInfo::CalculateFrameBytes(nativeWidth, nativeHeight)), nativeWidth, nativeHeight)) return false; - return CopyYUV420P(0, 0, nativeWidth, nativeHeight, nativeWidth, nativeHeight, m_temporaryBuffer, - 0, 0, outputWidth, outputHeight, outputWidth, outputHeight, dstFrameBuffer, resizeMode); + PStringStream error; + if (CopyYUV420P(0, 0, nativeWidth, nativeHeight, nativeWidth, nativeHeight, m_temporaryBuffer, + 0, 0, outputWidth, outputHeight, outputWidth, outputHeight, dstFrameBuffer, resizeMode, false, &error)) + return true; + + PTRACE(3, NULL, "JPEG", "Cannot resize output: " << error); + return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-14 11:14:17
|
Revision: 34868 http://sourceforge.net/p/opalvoip/code/34868 Author: rjongbloed Date: 2016-07-14 11:14:14 +0000 (Thu, 14 Jul 2016) Log Message: ----------- Applied patch for some older MSVC compilers, thanks Cameron Elliott Modified Paths: -------------- opal/branches/v3_16/include/rtp/metrics.h opal/branches/v3_16/src/opal/mediasession.cxx opal/branches/v3_16/src/rtp/metrics.cxx Modified: opal/branches/v3_16/include/rtp/metrics.h =================================================================== --- opal/branches/v3_16/include/rtp/metrics.h 2016-07-14 09:41:38 UTC (rev 34867) +++ opal/branches/v3_16/include/rtp/metrics.h 2016-07-14 11:14:14 UTC (rev 34868) @@ -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/branches/v3_16/src/opal/mediasession.cxx =================================================================== --- opal/branches/v3_16/src/opal/mediasession.cxx 2016-07-14 09:41:38 UTC (rev 34867) +++ opal/branches/v3_16/src/opal/mediasession.cxx 2016-07-14 11:14:14 UTC (rev 34868) @@ -332,7 +332,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/branches/v3_16/src/rtp/metrics.cxx =================================================================== --- opal/branches/v3_16/src/rtp/metrics.cxx 2016-07-14 09:41:38 UTC (rev 34867) +++ opal/branches/v3_16/src/rtp/metrics.cxx 2016-07-14 11:14:14 UTC (rev 34868) @@ -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; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-14 09:41:40
|
Revision: 34867 http://sourceforge.net/p/opalvoip/code/34867 Author: rjongbloed Date: 2016-07-14 09:41:38 +0000 (Thu, 14 Jul 2016) Log Message: ----------- Fixed being able to have multiple web servers using same SSL certificate "subject". Modified Paths: -------------- ptlib/branches/v2_16/src/ptclib/pssl.cxx Modified: ptlib/branches/v2_16/src/ptclib/pssl.cxx =================================================================== --- ptlib/branches/v2_16/src/ptclib/pssl.cxx 2016-07-14 08:21:07 UTC (rev 34866) +++ ptlib/branches/v2_16/src/ptclib/pssl.cxx 2016-07-14 09:41:38 UTC (rev 34867) @@ -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) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-14 08:21:09
|
Revision: 34866 http://sourceforge.net/p/opalvoip/code/34866 Author: rjongbloed Date: 2016-07-14 08:21:07 +0000 (Thu, 14 Jul 2016) Log Message: ----------- Patch for bug #555 "Deadlock during end call while recording", thanks Kevin Verfaille Modified Paths: -------------- opal/branches/v3_16/src/ep/opalmixer.cxx Modified: opal/branches/v3_16/src/ep/opalmixer.cxx =================================================================== --- opal/branches/v3_16/src/ep/opalmixer.cxx 2016-07-14 08:19:10 UTC (rev 34865) +++ opal/branches/v3_16/src/ep/opalmixer.cxx 2016-07-14 08:21:07 UTC (rev 34866) @@ -223,6 +223,7 @@ void OpalBaseMixer::StopPushThread(bool lock) { + m_threadRunning = false; PThread::WaitAndDelete(m_workerThread, 5000, &m_mutex, lock); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-14 08:19:12
|
Revision: 34865 http://sourceforge.net/p/opalvoip/code/34865 Author: rjongbloed Date: 2016-07-14 08:19:10 +0000 (Thu, 14 Jul 2016) Log Message: ----------- Added time of arrival of HTTP request, to aid in performance analysis. Modified Paths: -------------- ptlib/trunk/include/ptclib/http.h Modified: ptlib/trunk/include/ptclib/http.h =================================================================== --- ptlib/trunk/include/ptclib/http.h 2016-07-14 08:12:50 UTC (rev 34864) +++ ptlib/trunk/include/ptclib/http.h 2016-07-14 08:19:10 UTC (rev 34865) @@ -1335,6 +1335,7 @@ PIPSocket::Address localAddr; ///< IP address of local interface for request WORD localPort; ///< Port number of local server for request PHTTPResource * m_resource; ///< HTTP resource found for the request + PTime m_arrivalTime; ///< Time of arrival of the HTTP request }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-14 08:12:53
|
Revision: 34864 http://sourceforge.net/p/opalvoip/code/34864 Author: rjongbloed Date: 2016-07-14 08:12:50 +0000 (Thu, 14 Jul 2016) Log Message: ----------- Allow the PURL::LoadResource() to add customer headers to HTTP request. Modified Paths: -------------- ptlib/trunk/include/ptclib/url.h ptlib/trunk/src/ptclib/httpclnt.cxx Modified: ptlib/trunk/include/ptclib/url.h =================================================================== --- ptlib/trunk/include/ptclib/url.h 2016-07-11 18:29:01 UTC (rev 34863) +++ ptlib/trunk/include/ptclib/url.h 2016-07-14 08:12:50 UTC (rev 34864) @@ -365,6 +365,7 @@ PString m_certificate; // File or data PString m_privateKey; // File or data #endif + PStringOptions m_customOptions; // E.g. headers for http }; /**Get the resource the URL is pointing at. The data returned is obtained according to the scheme and the factory Modified: ptlib/trunk/src/ptclib/httpclnt.cxx =================================================================== --- ptlib/trunk/src/ptclib/httpclnt.cxx 2016-07-11 18:29:01 UTC (rev 34863) +++ ptlib/trunk/src/ptclib/httpclnt.cxx 2016-07-14 08:12:50 UTC (rev 34864) @@ -381,6 +381,8 @@ strm << '/'; else strm << url; + if (PTrace::CanTrace(4)) + strm << '\n' << outMIME; strm << PTrace::End; } #endif @@ -1263,7 +1265,7 @@ #if P_SSL http.SetSSLCredentials(params.m_authority, params.m_certificate, params.m_privateKey); #endif - PMIMEInfo outMIME, replyMIME; + PMIMEInfo outMIME = params.m_customOptions, replyMIME; if (!http.GetDocument(url, outMIME, replyMIME)) return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-11 18:29:04
|
Revision: 34863 http://sourceforge.net/p/opalvoip/code/34863 Author: rjongbloed Date: 2016-07-11 18:29:01 +0000 (Mon, 11 Jul 2016) Log Message: ----------- 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. Modified Paths: -------------- opal/branches/v3_16/include/ep/opalmixer.h opal/branches/v3_16/include/opal/recording.h opal/branches/v3_16/src/opal/recording.cxx Modified: opal/branches/v3_16/include/ep/opalmixer.h =================================================================== --- opal/branches/v3_16/include/ep/opalmixer.h 2016-07-11 18:24:56 UTC (rev 34862) +++ opal/branches/v3_16/include/ep/opalmixer.h 2016-07-11 18:29:01 UTC (rev 34863) @@ -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/branches/v3_16/include/opal/recording.h =================================================================== --- opal/branches/v3_16/include/opal/recording.h 2016-07-11 18:24:56 UTC (rev 34862) +++ opal/branches/v3_16/include/opal/recording.h 2016-07-11 18:29:01 UTC (rev 34863) @@ -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/branches/v3_16/src/opal/recording.cxx =================================================================== --- opal/branches/v3_16/src/opal/recording.cxx 2016-07-11 18:24:56 UTC (rev 34862) +++ opal/branches/v3_16/src/opal/recording.cxx 2016-07-11 18:29:01 UTC (rev 34863) @@ -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); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-11 18:24:59
|
Revision: 34862 http://sourceforge.net/p/opalvoip/code/34862 Author: rjongbloed Date: 2016-07-11 18:24:56 +0000 (Mon, 11 Jul 2016) Log Message: ----------- Increased range for detection of duplicate packets when decoding PCAP file. Also enhanced the trace logging during the discovery phase. 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-11 18:24:05 UTC (rev 34861) +++ opal/branches/v3_16/include/rtp/pcapfile.h 2016-07-11 18:24:56 UTC (rev 34862) @@ -115,6 +115,7 @@ DiscoveredRTPKey(); Comparison Compare(const PObject & obj) const; + void PrintOn(ostream & strm) const; }; struct DiscoveredRTPInfo : DiscoveredRTPKey { Modified: opal/branches/v3_16/src/rtp/pcapfile.cxx =================================================================== --- opal/branches/v3_16/src/rtp/pcapfile.cxx 2016-07-11 18:24:05 UTC (rev 34861) +++ opal/branches/v3_16/src/rtp/pcapfile.cxx 2016-07-11 18:24:56 UTC (rev 34862) @@ -281,7 +281,7 @@ RTP_SequenceNumber sequenceDelta = thisSequenceNumber - expectedSequenceNumber; if (context.m_lastSequenceNumber != 0) { - if (sequenceDelta > (1<<16)-100) { + if (sequenceDelta > (1<<16)-500) { PTRACE(3, "Skipping duplicate or out of order RTP packet " << thisSequenceNumber); return 0; } @@ -345,6 +345,12 @@ } +void OpalPCAPFile::DiscoveredRTPKey::PrintOn(ostream & strm) const +{ + strm << m_src << " -> " << m_dst << " src=" << RTP_TRACE_SRC(m_ssrc); +} + + OpalPCAPFile::DiscoveredRTPInfo::DiscoveredRTPInfo() : m_payloadType(RTP_DataFrame::IllegalPayloadType) { @@ -421,16 +427,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 +451,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 +509,7 @@ if (!Restart()) return false; - PTRACE(4, "Starting RTP discovery"); + PTRACE(3, "Starting RTP discovery"); map<DiscoveredRTPKey, DiscoveryInfo> discoveryMap; @@ -519,10 +533,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 +551,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-11 18:24:08
|
Revision: 34861 http://sourceforge.net/p/opalvoip/code/34861 Author: rjongbloed Date: 2016-07-11 18:24:05 +0000 (Mon, 11 Jul 2016) Log Message: ----------- Fixed step button enable in OpalShark Modified Paths: -------------- opal/branches/v3_16/samples/opalshark/main.cxx Modified: opal/branches/v3_16/samples/opalshark/main.cxx =================================================================== --- opal/branches/v3_16/samples/opalshark/main.cxx 2016-07-11 18:21:19 UTC (rev 34860) +++ opal/branches/v3_16/samples/opalshark/main.cxx 2016-07-11 18:24:05 UTC (rev 34861) @@ -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(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-11 18:21:22
|
Revision: 34860 http://sourceforge.net/p/opalvoip/code/34860 Author: rjongbloed Date: 2016-07-11 18:21:19 +0000 (Mon, 11 Jul 2016) Log Message: ----------- Improved trace logging around DLL load failure. Modified Paths: -------------- ptlib/branches/v2_16/src/ptlib/msos/win32.cxx Modified: ptlib/branches/v2_16/src/ptlib/msos/win32.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/msos/win32.cxx 2016-07-10 12:20:43 UTC (rev 34859) +++ ptlib/branches/v2_16/src/ptlib/msos/win32.cxx 2016-07-11 18:21:19 UTC (rev 34860) @@ -1945,7 +1945,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; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-10 12:20:46
|
Revision: 34859 http://sourceforge.net/p/opalvoip/code/34859 Author: rjongbloed Date: 2016-07-10 12:20:43 +0000 (Sun, 10 Jul 2016) Log Message: ----------- Enhancements to thread sample (and regression test) application. Thanks Derek Smithies. Modified Paths: -------------- ptlib/branches/v2_16/samples/threadex/Makefile ptlib/branches/v2_16/samples/threadex/main.cxx ptlib/branches/v2_16/samples/threadex/main.h Modified: ptlib/branches/v2_16/samples/threadex/Makefile =================================================================== --- ptlib/branches/v2_16/samples/threadex/Makefile 2016-07-05 10:22:38 UTC (rev 34858) +++ ptlib/branches/v2_16/samples/threadex/Makefile 2016-07-10 12:20:43 UTC (rev 34859) @@ -31,5 +31,6 @@ else include $(shell pkg-config ptlib --variable=makedir)/ptlib.mak endif +LIBS += -lpthread # End of Makefile Modified: ptlib/branches/v2_16/samples/threadex/main.cxx =================================================================== --- ptlib/branches/v2_16/samples/threadex/main.cxx 2016-07-05 10:22:38 UTC (rev 34858) +++ ptlib/branches/v2_16/samples/threadex/main.cxx 2016-07-10 12:20:43 UTC (rev 34859) @@ -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/branches/v2_16/samples/threadex/main.h =================================================================== --- ptlib/branches/v2_16/samples/threadex/main.h 2016-07-05 10:22:38 UTC (rev 34858) +++ ptlib/branches/v2_16/samples/threadex/main.h 2016-07-10 12:20:43 UTC (rev 34859) @@ -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; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-05 10:22:41
|
Revision: 34858 http://sourceforge.net/p/opalvoip/code/34858 Author: rjongbloed Date: 2016-07-05 10:22:38 +0000 (Tue, 05 Jul 2016) Log Message: ----------- Merged revision(s) 34856-34857 from ptlib/branches/v2_16: Fixed another race condition handling auto delete threads, thanks Derek Smithies Modified Paths: -------------- ptlib/trunk/src/ptlib/unix/tlibthrd.cxx Property Changed: ---------------- ptlib/trunk/ Index: ptlib/trunk =================================================================== --- ptlib/trunk 2016-07-05 10:21:19 UTC (rev 34857) +++ ptlib/trunk 2016-07-05 10:22:38 UTC (rev 34858) 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-34855 +/ptlib/branches/v2_16:34085-34857 /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/unix/tlibthrd.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2016-07-05 10:21:19 UTC (rev 34857) +++ ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2016-07-05 10:22:38 UTC (rev 34858) @@ -324,9 +324,10 @@ PProcess & process = PProcess::Current(); process.OnThreadEnded(*this); + + PX_state = PX_finished; process.InternalThreadEnded(this); - - PX_state = PX_finished; // Must be last thing to avoid races + // "this" may have been deleted at this point } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-05 10:21:21
|
Revision: 34857 http://sourceforge.net/p/opalvoip/code/34857 Author: rjongbloed Date: 2016-07-05 10:21:19 +0000 (Tue, 05 Jul 2016) Log Message: ----------- Fixed another race condition handling auto delete threads, thanks Derek Smithies Modified Paths: -------------- ptlib/branches/v2_16/src/ptlib/unix/tlibthrd.cxx Modified: ptlib/branches/v2_16/src/ptlib/unix/tlibthrd.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/unix/tlibthrd.cxx 2016-07-05 07:59:51 UTC (rev 34856) +++ ptlib/branches/v2_16/src/ptlib/unix/tlibthrd.cxx 2016-07-05 10:21:19 UTC (rev 34857) @@ -324,9 +324,10 @@ PProcess & process = PProcess::Current(); process.OnThreadEnded(*this); + + PX_state = PX_finished; process.InternalThreadEnded(this); - - PX_state = PX_finished; // Must be last thing to avoid races + // "this" may have been deleted at this point } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-05 07:59:54
|
Revision: 34856 http://sourceforge.net/p/opalvoip/code/34856 Author: rjongbloed Date: 2016-07-05 07:59:51 +0000 (Tue, 05 Jul 2016) Log Message: ----------- Merged revision(s) 34840-34855 from ptlib/branches/v2_16: Fixed race condition handling removing of auto delete threads, thanks Derek Smithies Modified Paths: -------------- ptlib/trunk/src/ptlib/common/osutils.cxx Property Changed: ---------------- ptlib/trunk/ Index: ptlib/trunk =================================================================== --- ptlib/trunk 2016-07-05 07:56:17 UTC (rev 34855) +++ ptlib/trunk 2016-07-05 07:59:51 UTC (rev 34856) 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-34839 +/ptlib/branches/v2_16:34085-34855 /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/osutils.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/osutils.cxx 2016-07-05 07:56:17 UTC (rev 34855) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-07-05 07:59:51 UTC (rev 34856) @@ -2540,17 +2540,20 @@ if (PAssertNULL(thread) == NULL) return; - if (thread->IsAutoDelete()) { - PTRACE(5, thread, "Queuing auto-delete of thread " << *thread); - thread->SetNoAutoDelete(); - m_autoDeleteThreads.Enqueue(thread); - } + // Do the log before mutex and thread being removed from m_activeThreads + PTRACE_IF(5, thread->IsAutoDelete(), thread, "Queuing auto-delete of thread " << *thread); PWaitAndSignal mutex(m_threadMutex); ThreadMap::iterator it = m_activeThreads.find(thread->GetThreadId()); if (it != m_activeThreads.end() && it->second == thread) m_activeThreads.erase(it); // Not already gone, or re-used the thread ID for new thread. + + // Must be last thing to avoid race condition + if (thread->IsAutoDelete()) { + thread->SetNoAutoDelete(); + m_autoDeleteThreads.Enqueue(thread); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-07-05 07:56:19
|
Revision: 34855 http://sourceforge.net/p/opalvoip/code/34855 Author: rjongbloed Date: 2016-07-05 07:56:17 +0000 (Tue, 05 Jul 2016) Log Message: ----------- Fixed race condition handling removing of auto delete threads, thanks Derek Smithies Modified Paths: -------------- ptlib/branches/v2_16/src/ptlib/common/osutils.cxx Modified: ptlib/branches/v2_16/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-06-30 11:37:09 UTC (rev 34854) +++ ptlib/branches/v2_16/src/ptlib/common/osutils.cxx 2016-07-05 07:56:17 UTC (rev 34855) @@ -2529,17 +2529,20 @@ if (PAssertNULL(thread) == NULL) return; - if (thread->IsAutoDelete()) { - PTRACE(5, thread, "Queuing auto-delete of thread " << *thread); - thread->SetNoAutoDelete(); - m_autoDeleteThreads.Enqueue(thread); - } + // Do the log before mutex and thread being removed from m_activeThreads + PTRACE_IF(5, thread->IsAutoDelete(), thread, "Queuing auto-delete of thread " << *thread); PWaitAndSignal mutex(m_threadMutex); ThreadMap::iterator it = m_activeThreads.find(thread->GetThreadId()); if (it != m_activeThreads.end() && it->second == thread) m_activeThreads.erase(it); // Not already gone, or re-used the thread ID for new thread. + + // Must be last thing to avoid race condition + if (thread->IsAutoDelete()) { + thread->SetNoAutoDelete(); + m_autoDeleteThreads.Enqueue(thread); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-06-30 11:37:11
|
Revision: 34854 http://sourceforge.net/p/opalvoip/code/34854 Author: rjongbloed Date: 2016-06-30 11:37:09 +0000 (Thu, 30 Jun 2016) Log Message: ----------- Priorities outputting Assert text with trace info over write to error stream. Modified Paths: -------------- ptlib/trunk/src/ptlib/unix/assert.cxx Modified: ptlib/trunk/src/ptlib/unix/assert.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/assert.cxx 2016-06-24 14:56:16 UTC (rev 34853) +++ ptlib/trunk/src/ptlib/unix/assert.cxx 2016-06-30 11:37:09 UTC (rev 34854) @@ -301,9 +301,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-06-24 14:56:19
|
Revision: 34853 http://sourceforge.net/p/opalvoip/code/34853 Author: rjongbloed Date: 2016-06-24 14:56:16 +0000 (Fri, 24 Jun 2016) Log Message: ----------- Fixed statistics trace log for last packet time. Modified Paths: -------------- opal/trunk/src/rtp/rtp_session.cxx Modified: opal/trunk/src/rtp/rtp_session.cxx =================================================================== --- opal/trunk/src/rtp/rtp_session.cxx 2016-06-24 08:57:58 UTC (rev 34852) +++ opal/trunk/src/rtp/rtp_session.cxx 2016-06-24 14:56:16 UTC (rev 34853) @@ -365,7 +365,7 @@ << m_direction << " statistics:\n" " Sync Source ID = " << RTP_TRACE_SRC(m_sourceIdentifier) << "\n" " first packet = " << m_firstPacketTime << "\n" - " last packet = " << m_lastPacketTimestamp << "\n" + " last packet = " << m_lastPacketAbsTime << "\n" " total packets = " << m_packets << "\n" " total octets = " << m_octets << "\n" " bitRateSent = " << (8 * m_octets / duration) << "\n" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-06-24 08:58:01
|
Revision: 34852 http://sourceforge.net/p/opalvoip/code/34852 Author: rjongbloed Date: 2016-06-24 08:57:58 +0000 (Fri, 24 Jun 2016) Log Message: ----------- Allow PColourConverter::FillYUV420P() to take a YUV instead of RGB colour Modified Paths: -------------- ptlib/trunk/include/ptlib/vconvert.h ptlib/trunk/src/ptlib/common/vconvert.cxx Modified: ptlib/trunk/include/ptlib/vconvert.h =================================================================== --- ptlib/trunk/include/ptlib/vconvert.h 2016-06-23 10:17:17 UTC (rev 34851) +++ ptlib/trunk/include/ptlib/vconvert.h 2016-06-24 08:57:58 UTC (rev 34852) @@ -319,7 +319,8 @@ static bool FillYUV420P( unsigned x, unsigned y, unsigned width, unsigned height, unsigned frameWidth, unsigned frameHeight, BYTE * yuv, - unsigned r, unsigned g, unsigned b + unsigned r_or_y, unsigned g_or_u, unsigned b_or_v, + bool rgb = true ); protected: Modified: ptlib/trunk/src/ptlib/common/vconvert.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-06-23 10:17:17 UTC (rev 34851) +++ ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-06-24 08:57:58 UTC (rev 34852) @@ -925,7 +925,7 @@ bool PColourConverter::FillYUV420P(unsigned x, unsigned y, unsigned width, unsigned height, unsigned frameWidth, unsigned frameHeight, BYTE * yuv, - unsigned r, unsigned g, unsigned b) + unsigned r_or_y, unsigned g_or_u, unsigned b_or_v, bool rgb) { if (frameWidth == 0) frameWidth = width; @@ -938,7 +938,13 @@ } BYTE Y, U, V; - PColourConverter::RGBtoYUV(r, g, b, Y, U, V); + if (rgb) + PColourConverter::RGBtoYUV(r_or_y, g_or_u, b_or_v, Y, U, V); + else { + Y = (BYTE)r_or_y; + U = (BYTE)g_or_u; + V = (BYTE)b_or_v; + } unsigned planeWidth = (frameWidth+1)&~1; unsigned planeHeight = (frameHeight+1)&~1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |