opalvoip-svn Mailing List for OpalVOIP (Page 11)
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-03-11 10:57:04
|
Revision: 34676 http://sourceforge.net/p/opalvoip/code/34676 Author: rjongbloed Date: 2016-03-11 10:57:02 +0000 (Fri, 11 Mar 2016) Log Message: ----------- Fixed Avaya compatibility with Gatekeeper authentication. They seem to think the OpenSSL implementation has the 56 bit key in the first 7 bytes, when it is actually the low 7 bits of all 8 bytes. Due to this bug, they only really have 48 bit encryption. Modified Paths: -------------- opal/trunk/src/h323/h235auth1.cxx Modified: opal/trunk/src/h323/h235auth1.cxx =================================================================== --- opal/trunk/src/h323/h235auth1.cxx 2016-03-11 10:40:34 UTC (rev 34675) +++ opal/trunk/src/h323/h235auth1.cxx 2016-03-11 10:57:02 UTC (rev 34676) @@ -526,10 +526,16 @@ PBYTEArray key(cipher.GetKeyLength()); - // Build key from password according to H.235.0/8.2.1 - memcpy(key.GetPointer(), password.GetPointer(), std::min(key.GetSize(), password.GetLength())); - for (PINDEX i = key.GetSize(); i < password.GetLength(); ++i) - key[i%key.GetSize()] ^= password[i]; + /* Build key from password according to H.235.0/8.2.1 + At least we would, except, Avaya do not follow those rules quite correctly. + They seem to think the OpenSSL implementation has the 56 bit key in the + first 7 bytes, when it is actually the low 7 bits of all 8 bytes. Due to + this bug, they only really have 48 bit encryption. + */ + PINDEX keySize = key.GetSize()-1; + memcpy(key.GetPointer(), password.GetPointer(), std::min(keySize, password.GetLength())); + for (PINDEX i = keySize; i < password.GetLength(); ++i) + key[i%keySize] ^= password[i]; #if 0 // But some things imply LSB of OpenSSL DES key is parity bit ... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-11 10:40:36
|
Revision: 34675 http://sourceforge.net/p/opalvoip/code/34675 Author: rjongbloed Date: 2016-03-11 10:40:34 +0000 (Fri, 11 Mar 2016) Log Message: ----------- When looking up individual passwords for H.323 aliases, also allow alias only match. Modified Paths: -------------- opal/trunk/src/h323/h323ep.cxx Modified: opal/trunk/src/h323/h323ep.cxx =================================================================== --- opal/trunk/src/h323/h323ep.cxx 2016-03-10 14:18:03 UTC (rev 34674) +++ opal/trunk/src/h323/h323ep.cxx 2016-03-11 10:40:34 UTC (rev 34675) @@ -744,6 +744,10 @@ PIPSocket::Address ip; PString gkAddress = (gatekeeperAddress.GetIpAddress(ip) && !ip.IsAny()) ? ip.AsString() : m_aliasPwdDefaultAddress; PStringToString::const_iterator pwdIter = m_aliasPasswords.find(alias + '@' + gkAddress); + + if (pwdIter == m_aliasPasswords.end()) + pwdIter = m_aliasPasswords.find(alias); + if (pwdIter != m_aliasPasswords.end()) { gatekeeper.SetPassword(pwdIter->second, GetGatekeeperUsername()); return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-10 14:18:06
|
Revision: 34674 http://sourceforge.net/p/opalvoip/code/34674 Author: rjongbloed Date: 2016-03-10 14:18:03 +0000 (Thu, 10 Mar 2016) Log Message: ----------- Fixed Opus FEC detection so works correctly when "Tx Frames Per Packet" > 1 Modified Paths: -------------- opal/trunk/plugins/audio/Opus/OpusCodec.cpp Modified: opal/trunk/plugins/audio/Opus/OpusCodec.cpp =================================================================== --- opal/trunk/plugins/audio/Opus/OpusCodec.cpp 2016-03-09 15:44:29 UTC (rev 34673) +++ opal/trunk/plugins/audio/Opus/OpusCodec.cpp 2016-03-10 14:18:03 UTC (rev 34674) @@ -286,41 +286,35 @@ if (payload == NULL || length == 0) return false; - /* In CELT_ONLY mode, packets should not have FEC. */ + // In CELT_ONLY mode, packets does not have FEC. if (payload[0] & 0x80) return false; - int frames; - switch (opus_packet_get_samples_per_frame(payload, m_sampleRate)) { - case 480: - case 960: - frames = 1; - break; - case 960*2: - frames = 2; - break; - case 960*3: - frames = 3; - break; - default: - return false; // invalid packet. - } - - /* The following is to parse the LBRR flags. */ + // Get the individual SILK frames in the packet. opus_int16 frame_sizes[48]; const opus_uint8 *frame_data[48]; - if (opus_packet_parse(payload, length, NULL, frame_data, frame_sizes, NULL) < 0) + int frames = opus_packet_parse(payload, length, NULL, frame_data, frame_sizes, NULL); + if (frames < 0) { + PTRACE(1, MY_CODEC_LOG, "Packet parse error " << frames << ' ' << opus_strerror(frames)); return false; + } - if (frame_sizes[0] <= 1) - return false; + // "frames" is over used. We have the frames in the packet from above, then we + // have the SILK encoded 20ms of audio frame, I'm calling them a sub-Frames. + int subFrames = (opus_packet_get_samples_per_frame(payload, m_sampleRate)*1000/m_sampleRate+19)/20; + int channels = opus_packet_get_nb_channels(payload); - int channels = opus_packet_get_nb_channels(payload); - for (int n = 0; n < channels; n++) { - if (frame_data[0][0] & (0x80 >> ((n + 1) * (frames + 1) - 1))) { - PTRACE(6, MY_CODEC_LOG, "FEC packet detected"); - ++m_countFEC; - return true; + // The following is to parse the LBRR flags. + for (int frame = 0; frame < frames; ++frame) { + if (frame_sizes[frame] > 0) { + for (int chan = 0; chan < channels; chan++) { + // Highest "subFrames" bits are VAD, next bit is LDDR flag, repeated for each channel + if (frame_data[frame][0] & (0x80 >> ((subFrames+1)*chan + subFrames))) { + PTRACE(6, MY_CODEC_LOG, "FEC packet detected"); + ++m_countFEC; + return true; + } + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-09 15:44:33
|
Revision: 34673 http://sourceforge.net/p/opalvoip/code/34673 Author: rjongbloed Date: 2016-03-09 15:44:29 +0000 (Wed, 09 Mar 2016) Log Message: ----------- Added statistics for Opus (or any other) FEC. Modified Paths: -------------- opal/trunk/include/opal/mediasession.h opal/trunk/plugins/audio/Opus/OpusCodec.cpp opal/trunk/src/codec/opalpluginmgr.cxx opal/trunk/src/opal/mediasession.cxx Modified: opal/trunk/include/opal/mediasession.h =================================================================== --- opal/trunk/include/opal/mediasession.h 2016-03-09 12:16:19 UTC (rev 34672) +++ opal/trunk/include/opal/mediasession.h 2016-03-09 15:44:29 UTC (rev 34673) @@ -79,6 +79,7 @@ unsigned m_controlPacketsIn; // RTCP received for this channel unsigned m_controlPacketsOut; // RTCP sent for this channel int m_NACKs; // (-1 is N/A) + int m_FEC; // (-1 is N/A, for tx is number of FEC frame sent, for rx is number of frames recovered via FEC) int m_packetsLost; // (-1 is N/A) int m_packetsOutOfOrder; // (-1 is N/A) int m_lateOutOfOrder; // (-1 is N/A) Modified: opal/trunk/plugins/audio/Opus/OpusCodec.cpp =================================================================== --- opal/trunk/plugins/audio/Opus/OpusCodec.cpp 2016-03-09 12:16:19 UTC (rev 34672) +++ opal/trunk/plugins/audio/Opus/OpusCodec.cpp 2016-03-09 15:44:29 UTC (rev 34673) @@ -40,7 +40,12 @@ #include <vector> +#ifdef _MSC_VER +#pragma warning(disable:4505) +#define snprintf _snprintf +#endif + #define MY_CODEC Opus // Name of codec (use C variable characters) #define MY_CODEC_LOG STRINGIZE(MY_CODEC) @@ -239,12 +244,14 @@ protected: unsigned m_sampleRate; bool m_useInBandFEC; + int m_countFEC; unsigned m_channels; public: OpusPluginCodec(const PluginCodec_Definition * defn) : PluginCodec<MY_CODEC>(defn) , m_useInBandFEC(true) + , m_countFEC(0) { const OpusPluginMediaFormat *mediaFormat = reinterpret_cast<const OpusPluginMediaFormat *>(m_definition->userData); m_sampleRate = mediaFormat->m_actualSampleRate; @@ -257,6 +264,8 @@ if (strcasecmp(optionName, UseInBandFEC.m_name) == 0) { if (!SetOptionBoolean(m_useInBandFEC, optionValue)) return false; + if (!m_useInBandFEC) + m_countFEC = -1; PTRACE(4, MY_CODEC_LOG, "In band FEC set to " << std::boolalpha << m_useInBandFEC); return true; } @@ -266,6 +275,12 @@ } + virtual int GetStatistics(char * bufferPtr, unsigned bufferSize) + { + return snprintf(bufferPtr, bufferSize, "FEC=%u\n", m_countFEC); + } + + bool PacketHasFec(const opus_uint8 * payload, unsigned length) { if (payload == NULL || length == 0) @@ -303,7 +318,8 @@ int channels = opus_packet_get_nb_channels(payload); for (int n = 0; n < channels; n++) { if (frame_data[0][0] & (0x80 >> ((n + 1) * (frames + 1) - 1))) { - PTRACE(5, MY_CODEC_LOG, "FEC packet detected"); + PTRACE(6, MY_CODEC_LOG, "FEC packet detected"); + ++m_countFEC; return true; } } @@ -409,6 +425,7 @@ toLen = result; fromLen = opus_packet_get_samples_per_frame((const opus_uint8 *)toPtr, m_sampleRate) * opus_packet_get_nb_frames((const opus_uint8 *)toPtr, toLen) * m_channels * 2; + PacketHasFec((opus_uint8 *)toPtr, toLen); return true; } }; Modified: opal/trunk/src/codec/opalpluginmgr.cxx =================================================================== --- opal/trunk/src/codec/opalpluginmgr.cxx 2016-03-09 12:16:19 UTC (rev 34672) +++ opal/trunk/src/codec/opalpluginmgr.cxx 2016-03-09 15:44:29 UTC (rev 34673) @@ -744,11 +744,9 @@ if (getCodecStatistics.Call(buf, sizeof(buf), context) > 0) { PConstString str(buf); PStringOptions stats(str); -#if OPAL_VIDEO - statistics.m_videoQuality = stats.GetInteger("Quality", statistics.m_videoQuality); -#endif statistics.m_targetBitRate = stats.GetInteger("BitRate", statistics.m_targetBitRate); statistics.m_targetFrameRate = (float)stats.GetReal ("FrameRate", statistics.m_targetFrameRate); + statistics.m_FEC = stats.GetInteger("FEC", statistics.m_FEC); } } #endif // OPAL_STATISTICS Modified: opal/trunk/src/opal/mediasession.cxx =================================================================== --- opal/trunk/src/opal/mediasession.cxx 2016-03-09 12:16:19 UTC (rev 34672) +++ opal/trunk/src/opal/mediasession.cxx 2016-03-09 15:44:29 UTC (rev 34673) @@ -64,6 +64,7 @@ , m_controlPacketsIn(0) , m_controlPacketsOut(0) , m_NACKs(-1) + , m_FEC(-1) , m_packetsLost(-1) , m_packetsOutOfOrder(-1) , m_lateOutOfOrder(-1) @@ -366,7 +367,9 @@ << setw(indent) << "Maximum packet time" << " = " << m_maximumPacketTime << "ms\n" << setw(indent) << "Packets lost" << " = " << m_packetsLost << '\n' << setw(indent) << "Restored out of order" << " = " << m_packetsOutOfOrder << '\n' - << setw(indent) << "Late out of order" << " = " << m_lateOutOfOrder << '\n'; + << setw(indent) << "Late out of order" << " = " << m_lateOutOfOrder << '\n' + << setw(indent) << "NACK" << " = " << m_NACKs << '\n' + << setw(indent) << "FEC" << " = " << m_FEC << '\n'; if (m_roundTripTime >= 0) strm << setw(indent) << "Round Trip Time" << " = " << m_roundTripTime << '\n'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-09 12:16:21
|
Revision: 34672 http://sourceforge.net/p/opalvoip/code/34672 Author: rjongbloed Date: 2016-03-09 12:16:19 +0000 (Wed, 09 Mar 2016) Log Message: ----------- Fixed handling FEC in Opus codec. Modified Paths: -------------- opal/trunk/plugins/audio/Opus/OpusCodec.cpp opal/trunk/plugins/audio/Opus/OpusCodec_2013.vcxproj Modified: opal/trunk/plugins/audio/Opus/OpusCodec.cpp =================================================================== --- opal/trunk/plugins/audio/Opus/OpusCodec.cpp 2016-03-08 17:55:37 UTC (rev 34671) +++ opal/trunk/plugins/audio/Opus/OpusCodec.cpp 2016-03-09 12:16:19 UTC (rev 34672) @@ -38,7 +38,9 @@ #include "opus.h" +#include <vector> + #define MY_CODEC Opus // Name of codec (use C variable characters) #define MY_CODEC_LOG STRINGIZE(MY_CODEC) @@ -152,7 +154,12 @@ PLUGINCODEC_OPTION_DYNAMIC_PACKET_LOSS, false, PluginCodec_NoMerge, - "0" + "0", + NULL, + NULL, + 0, + "0", + "100" }; static struct PluginCodec_Option const * const MyOptions[] = { @@ -257,6 +264,52 @@ // Base class sets bit rate and frame time return PluginCodec<MY_CODEC>::SetOption(optionName, optionValue); } + + + bool PacketHasFec(const opus_uint8 * payload, unsigned length) + { + if (payload == NULL || length == 0) + return false; + + /* In CELT_ONLY mode, packets should not have FEC. */ + if (payload[0] & 0x80) + return false; + + int frames; + switch (opus_packet_get_samples_per_frame(payload, m_sampleRate)) { + case 480: + case 960: + frames = 1; + break; + case 960*2: + frames = 2; + break; + case 960*3: + frames = 3; + break; + default: + return false; // invalid packet. + } + + /* The following is to parse the LBRR flags. */ + opus_int16 frame_sizes[48]; + const opus_uint8 *frame_data[48]; + if (opus_packet_parse(payload, length, NULL, frame_data, frame_sizes, NULL) < 0) + return false; + + if (frame_sizes[0] <= 1) + return false; + + int channels = opus_packet_get_nb_channels(payload); + for (int n = 0; n < channels; n++) { + if (frame_data[0][0] & (0x80 >> ((n + 1) * (frames + 1) - 1))) { + PTRACE(5, MY_CODEC_LOG, "FEC packet detected"); + return true; + } + } + + return false; + } }; @@ -325,10 +378,16 @@ if (m_encoder == NULL) return false; + //opus_encoder_ctl(m_encoder, OPUS_SET_MAX_BANDWIDTH(m_definition->sampleRate)); opus_encoder_ctl(m_encoder, OPUS_SET_INBAND_FEC(m_useInBandFEC)); opus_encoder_ctl(m_encoder, OPUS_SET_PACKET_LOSS_PERC(m_dynamicPacketLoss)); opus_encoder_ctl(m_encoder, OPUS_SET_DTX(m_useDTX)); opus_encoder_ctl(m_encoder, OPUS_SET_BITRATE(m_bitRate)); + PTRACE(4, MY_CODEC_LOG, "Encoder options set:" + " fec=" << std::boolalpha << m_useInBandFEC << "," + " pkt-loss=" << m_dynamicPacketLoss << "%," + " dtx=" << m_useDTX << "," + " bitrate=" << m_bitRate); return true; } @@ -341,15 +400,15 @@ { opus_int32 result = opus_encode(m_encoder, (const opus_int16 *)fromPtr, fromLen/m_channels/2, - (unsigned char *)toPtr, toLen); + (opus_uint8 *)toPtr, toLen); if (result < 0) { PTRACE(1, MY_CODEC_LOG, "Encoder error " << result << ' ' << opus_strerror(result)); return false; } toLen = result; - fromLen = opus_packet_get_samples_per_frame((const unsigned char *)toPtr, m_sampleRate) * - opus_packet_get_nb_frames((const unsigned char *)toPtr, toLen) * m_channels * 2; + fromLen = opus_packet_get_samples_per_frame((const opus_uint8 *)toPtr, m_sampleRate) * + opus_packet_get_nb_frames((const opus_uint8 *)toPtr, toLen) * m_channels * 2; return true; } }; @@ -360,12 +419,15 @@ class OpusPluginDecoder : public OpusPluginCodec { protected: - OpusDecoder * m_decoder; + OpusDecoder * m_decoder; + unsigned m_lostPackets; + std::vector<opus_int16> m_previousFrame; public: OpusPluginDecoder(const PluginCodec_Definition * defn) : OpusPluginCodec(defn) , m_decoder(NULL) + , m_lostPackets(0) { PTRACE(4, MY_CODEC_LOG, "Decoder created: $Revision$, version \"" << opus_get_version_string() << '"'); } @@ -395,17 +457,18 @@ unsigned & toLen, unsigned & flags) { - bool fec; int samples; - const unsigned char * packet; + const opus_uint8 * packet; if (fromLen == 0) { - fec = m_useInBandFEC; + if (m_useInBandFEC && m_lostPackets++ == 0) { + toLen = 0; + return true; + } packet = NULL; // As per opus_decode() API opus_decoder_ctl(m_decoder, OPUS_GET_LAST_PACKET_DURATION(&samples)); } else { - fec = false; - packet = (const unsigned char *)fromPtr; + packet = (const opus_uint8 *)fromPtr; samples = opus_decoder_get_nb_samples(m_decoder, packet, fromLen); if (samples < 0) { PTRACE(1, MY_CODEC_LOG, "Decoding error " << samples << ' ' << opus_strerror(samples)); @@ -413,20 +476,44 @@ } } - if ((unsigned)samples*m_channels*2U > toLen) { - PTRACE(1, MY_CODEC_LOG, "Provided sample buffer too small, " << toLen << " bytes"); + unsigned outputBytes = samples*m_channels*2U; + if (outputBytes*2 > toLen) { + PTRACE(1, MY_CODEC_LOG, "Provided sample buffer too small, " << toLen << " bytes, need " << outputBytes); return false; } - int result = opus_decode(m_decoder, packet, fromLen, (opus_int16 *)toPtr, samples, fec); - if (result < 0) { - PTRACE(1, MY_CODEC_LOG, "Decoder error " << result << ' ' << opus_strerror(result)); - return false; + if (!m_useInBandFEC) { + toLen = outputBytes; + return DecodeFrame(packet, fromLen, toPtr, samples, false); } - toLen = result*m_channels*2; - return true; + if (m_previousFrame.empty()) { + m_previousFrame.resize(samples*m_channels); + toLen = 0; + } + else { + toLen = outputBytes; + memcpy(toPtr, m_previousFrame.data(), outputBytes); + + if (m_lostPackets > 0 && --m_lostPackets == 0) { + if (!DecodeFrame(packet, fromLen, ((char *)toPtr)+outputBytes, samples, PacketHasFec(packet, fromLen))) + return false; + toLen += outputBytes; + } + } + + return DecodeFrame(packet, fromLen, m_previousFrame.data(), samples, false); } + + bool DecodeFrame(const void * packet, unsigned bytes, void * pcm, unsigned samples, bool fec) + { + int result = opus_decode(m_decoder, (const opus_uint8 *)packet, bytes, (opus_int16 *)pcm, samples, fec); + if (result > 0) + return true; + + PTRACE(1, MY_CODEC_LOG, "Decoder error " << result << ' ' << opus_strerror(result)); + return false; + } }; Modified: opal/trunk/plugins/audio/Opus/OpusCodec_2013.vcxproj =================================================================== --- opal/trunk/plugins/audio/Opus/OpusCodec_2013.vcxproj 2016-03-08 17:55:37 UTC (rev 34671) +++ opal/trunk/plugins/audio/Opus/OpusCodec_2013.vcxproj 2016-03-09 12:16:19 UTC (rev 34672) @@ -217,6 +217,9 @@ </ClCompile> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\..\..\samples\codectest\codectest_2013.vcxproj"> + <Project>{7bcc8831-22e0-4d87-8e8b-f6da0aefbed0}</Project> + </ProjectReference> <ProjectReference Include="opus\win32\VS2013\celt.vcxproj"> <Project>{245603e3-f580-41a5-9632-b25fe3372cbf}</Project> </ProjectReference> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-08 17:55:39
|
Revision: 34671 http://sourceforge.net/p/opalvoip/code/34671 Author: rjongbloed Date: 2016-03-08 17:55:37 +0000 (Tue, 08 Mar 2016) Log Message: ----------- Allow codec test application to simulate packet loss for audio codecs as well as video. Modified Paths: -------------- opal/trunk/samples/codectest/main.cxx opal/trunk/samples/codectest/main.h Modified: opal/trunk/samples/codectest/main.cxx =================================================================== --- opal/trunk/samples/codectest/main.cxx 2016-03-08 17:54:35 UTC (rev 34670) +++ opal/trunk/samples/codectest/main.cxx 2016-03-08 17:55:37 UTC (rev 34671) @@ -287,6 +287,10 @@ OpalMediaFormat & mediaFormat, OpalMediaFormat & rawFormat) { + m_dropPercent = args.GetOptionString('d').AsInteger(); + if (m_dropPercent > 0) + cout << "Dropping " << m_dropPercent << "% of encoded frames" << endl; + if (args.HasOption('m')) m_markerHandling = SuppressMarkers; else if (args.HasOption('M')) @@ -751,9 +755,6 @@ m_snrCount = 0; m_running = true; - m_dropPercent = args.GetOptionString('d').AsInteger(); - cout << "Dropping " << m_dropPercent << "% of encoded frames" << endl; - return true; } @@ -1077,12 +1078,17 @@ if (m_dropPercent > 0) { RTP_DataFrameList::iterator it = encFrames.begin(); while (it != encFrames.end()) { - int n = PRandom::Number() % 100; - if (n >= m_dropPercent) + if (PRandom::Number(100) >= m_dropPercent) ++it; else { ++totalDroppedPacketCount; - encFrames.erase(it++); + if (isVideo) + encFrames.erase(it++); + else { + it->SetPayloadSize(0); + it->SetDiscontinuity(1); + ++it; + } } } } Modified: opal/trunk/samples/codectest/main.h =================================================================== --- opal/trunk/samples/codectest/main.h 2016-03-08 17:54:35 UTC (rev 34670) +++ opal/trunk/samples/codectest/main.h 2016-03-08 17:55:37 UTC (rev 34671) @@ -99,7 +99,7 @@ int m_frameTime; bool m_calcSNR; BYTE m_extensionHeader; - int m_dropPercent; + uint32_t m_dropPercent; OpalPCAPFile m_pcapFile; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-08 17:54:37
|
Revision: 34670 http://sourceforge.net/p/opalvoip/code/34670 Author: rjongbloed Date: 2016-03-08 17:54:35 +0000 (Tue, 08 Mar 2016) Log Message: ----------- Fix empty audio frames (indicating audio missing) being passed to codec, if it indicates it can accept them, e.g. for packet loss concealment. Modified Paths: -------------- opal/trunk/src/opal/transcoders.cxx Modified: opal/trunk/src/opal/transcoders.cxx =================================================================== --- opal/trunk/src/opal/transcoders.cxx 2016-03-08 14:31:19 UTC (rev 34669) +++ opal/trunk/src/opal/transcoders.cxx 2016-03-08 17:54:35 UTC (rev 34670) @@ -590,14 +590,6 @@ return true; } - const BYTE * inputPtr = input.GetPayloadPtr(); - PINDEX inputLength = input.GetPayloadSize(); - - if (inputLength == 0) { - output.SetPayloadSize(outputBytesPerFrame); - return ConvertSilentFrame (output.GetPayloadPtr()); - } - // set maximum output payload size if (!output.SetPayloadSize(maxOutputDataSize)) return false; @@ -605,22 +597,39 @@ BYTE * outputPtr = output.GetPayloadPtr(); PINDEX outLen = 0; - while (inputLength > 0 && outLen < maxOutputDataSize) { + const BYTE * inputPtr = input.GetPayloadPtr(); + PINDEX inputLength = input.GetPayloadSize(); - PINDEX consumed = inputLength; - PINDEX created = maxOutputDataSize - outLen; + if (inputLength == 0) { + if (AcceptEmptyPayload()) { + outLen = maxOutputDataSize; + if (!ConvertFrame(inputPtr, inputLength, outputPtr, outLen)) + return false; + } + else { + if (!ConvertSilentFrame(outputPtr)) + return false; + outLen = outputBytesPerFrame; + } + } + else { + while (inputLength > 0 && outLen < maxOutputDataSize) { - if (!ConvertFrame(inputPtr, consumed, outputPtr, created)) - return false; + PINDEX consumed = inputLength; + PINDEX created = maxOutputDataSize - outLen; - // If did not consume or produce any data, codec has gone wrong, abort! - if (consumed == 0 && created == 0) - break; + if (!ConvertFrame(inputPtr, consumed, outputPtr, created)) + return false; - outputPtr += created; - outLen += created; - inputPtr += consumed; - inputLength -= consumed; + // If did not consume or produce any data, codec has gone wrong, abort! + if (consumed == 0 && created == 0) + break; + + outputPtr += created; + outLen += created; + inputPtr += consumed; + inputLength -= consumed; + } } // set actual output payload size This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-08 14:31:21
|
Revision: 34669 http://sourceforge.net/p/opalvoip/code/34669 Author: rjongbloed Date: 2016-03-08 14:31:19 +0000 (Tue, 08 Mar 2016) Log Message: ----------- Fixed resampling WAV file used as sound device. Modified Paths: -------------- ptlib/trunk/src/ptclib/pwavfiledev.cxx Modified: ptlib/trunk/src/ptclib/pwavfiledev.cxx =================================================================== --- ptlib/trunk/src/ptclib/pwavfiledev.cxx 2016-03-08 10:23:57 UTC (rev 34668) +++ ptlib/trunk/src/ptclib/pwavfiledev.cxx 2016-03-08 14:31:19 UTC (rev 34669) @@ -132,8 +132,10 @@ return false; } - if (params.m_sampleRate >= 8000 && m_WAVFile.GetSampleSize() == params.m_bitsPerSample) + if (params.m_sampleRate >= 8000 && m_WAVFile.GetSampleSize() == params.m_bitsPerSample) { + SetFormat(params.m_channels, params.m_sampleRate, params.m_bitsPerSample); return true; + } Close(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-08 10:23:59
|
Revision: 34668 http://sourceforge.net/p/opalvoip/code/34668 Author: rjongbloed Date: 2016-03-08 10:23:57 +0000 (Tue, 08 Mar 2016) Log Message: ----------- More compiler warning fixes Modified Paths: -------------- opal/trunk/samples/server/h323serv.cxx Modified: opal/trunk/samples/server/h323serv.cxx =================================================================== --- opal/trunk/samples/server/h323serv.cxx 2016-03-08 10:07:04 UTC (rev 34667) +++ opal/trunk/samples/server/h323serv.cxx 2016-03-08 10:23:57 UTC (rev 34668) @@ -112,7 +112,7 @@ cfg.DeleteKey(H323RegistrationNewSection, newPwdIter->first); } - clearPwd.Merge(newPwd, PStringToString::MergeAction::e_MergeOverwrite); + clearPwd.Merge(newPwd, PStringToString::e_MergeOverwrite); return clearPwd; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-08 10:07:06
|
Revision: 34667 http://sourceforge.net/p/opalvoip/code/34667 Author: rjongbloed Date: 2016-03-08 10:07:04 +0000 (Tue, 08 Mar 2016) Log Message: ----------- Fixed MSVC 32 bit compile Modified Paths: -------------- ptlib/trunk/include/ptlib/dict.h Modified: ptlib/trunk/include/ptlib/dict.h =================================================================== --- ptlib/trunk/include/ptlib/dict.h 2016-03-08 10:04:56 UTC (rev 34666) +++ ptlib/trunk/include/ptlib/dict.h 2016-03-08 10:07:04 UTC (rev 34667) @@ -107,7 +107,7 @@ virtual PINDEX HashFunction() const { #if PINDEX_SIGNED - return ((PINDEX)(this->m_key<0?-this->m_key:this->m_key))%23; + return std::abs((PINDEX)this->m_key)%23; #else return ((PINDEX)this->m_key)%23; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-08 10:04:58
|
Revision: 34666 http://sourceforge.net/p/opalvoip/code/34666 Author: rjongbloed Date: 2016-03-08 10:04:56 +0000 (Tue, 08 Mar 2016) Log Message: ----------- Fixed misinterpretation of Opus codec maxplaybackrate as sample rate. Is encoded bit rate. Modified Paths: -------------- opal/trunk/plugins/audio/Opus/OpusCodec.cpp Modified: opal/trunk/plugins/audio/Opus/OpusCodec.cpp =================================================================== --- opal/trunk/plugins/audio/Opus/OpusCodec.cpp 2016-03-08 08:35:26 UTC (rev 34665) +++ opal/trunk/plugins/audio/Opus/OpusCodec.cpp 2016-03-08 10:04:56 UTC (rev 34666) @@ -104,7 +104,7 @@ "Max Playback Rate", true, PluginCodec_NoMerge, - "48000", + "64000", "maxplaybackrate", "", 0, @@ -118,7 +118,7 @@ "Max Capture Rate", true, PluginCodec_NoMerge, - "48000", + "64000", "sprop-maxcapturerate", "", 0, @@ -190,19 +190,19 @@ } virtual bool IsValidForProtocol(const char * protocol) const - { - return strcasecmp(protocol, PLUGINCODEC_OPTION_PROTOCOL_SIP) == 0; - } + { + return strcasecmp(protocol, PLUGINCODEC_OPTION_PROTOCOL_SIP) == 0; + } - virtual bool ToNormalised(OptionMap & /*original*/, OptionMap & /*changed*/) const - { - return true; - } + virtual bool ToNormalised(OptionMap & /*original*/, OptionMap & /*changed*/) const + { + return true; + } - virtual bool ToCustomised(OptionMap &, OptionMap & changed) const + virtual bool ToCustomised(OptionMap & original, OptionMap & changed) const { - Unsigned2String(m_actualSampleRate, changed[MaxPlaybackRate.m_name]); - changed[MaxCaptureRate.m_name] = changed[MaxPlaybackRate.m_name]; + changed[MaxPlaybackRate.m_name] = original[PLUGINCODEC_OPTION_MAX_BIT_RATE]; + changed[MaxCaptureRate.m_name] = original[PLUGINCODEC_OPTION_TARGET_BIT_RATE]; changed[PlaybackStereo.m_name] = changed[CaptureStereo.m_name] = m_actualChannels == 1 ? "0" : "1"; return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-08 08:35:29
|
Revision: 34665 http://sourceforge.net/p/opalvoip/code/34665 Author: rjongbloed Date: 2016-03-08 08:35:26 +0000 (Tue, 08 Mar 2016) Log Message: ----------- Fixed PAESContext for decryption mode. 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-03-07 19:16:24 UTC (rev 34664) +++ ptlib/branches/v2_16/src/ptclib/pssl.cxx 2016-03-08 08:35:26 UTC (rev 34665) @@ -986,7 +986,7 @@ if (encrypt) SetEncrypt(data, numBits); else - SetEncrypt(data, numBits); + SetDecrypt(data, numBits); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-07 19:16:27
|
Revision: 34664 http://sourceforge.net/p/opalvoip/code/34664 Author: rjongbloed Date: 2016-03-07 19:16:24 +0000 (Mon, 07 Mar 2016) Log Message: ----------- More compiler warning fixes Modified Paths: -------------- ptlib/trunk/include/ptlib/dict.h ptlib/trunk/src/ptclib/httpclnt.cxx ptlib/trunk/src/ptclib/memfile.cxx ptlib/trunk/src/ptclib/psoap.cxx ptlib/trunk/src/ptclib/pwavfile.cxx ptlib/trunk/src/ptlib/common/pluginmgr.cxx ptlib/trunk/src/ptlib/common/syslog.cxx Modified: ptlib/trunk/include/ptlib/dict.h =================================================================== --- ptlib/trunk/include/ptlib/dict.h 2016-03-07 18:52:38 UTC (rev 34663) +++ ptlib/trunk/include/ptlib/dict.h 2016-03-07 19:16:24 UTC (rev 34664) @@ -107,7 +107,7 @@ virtual PINDEX HashFunction() const { #if PINDEX_SIGNED - return ((PINDEX)std::abs(this->m_key))%23; + return ((PINDEX)(this->m_key<0?-this->m_key:this->m_key))%23; #else return ((PINDEX)this->m_key)%23; #endif Modified: ptlib/trunk/src/ptclib/httpclnt.cxx =================================================================== --- ptlib/trunk/src/ptclib/httpclnt.cxx 2016-03-07 18:52:38 UTC (rev 34663) +++ ptlib/trunk/src/ptclib/httpclnt.cxx 2016-03-07 19:16:24 UTC (rev 34664) @@ -424,7 +424,7 @@ PString body; if (lastResponseCode >= 300) { #if PTRACING - if (replyMIME.GetVar(ContentLengthTag(), numeric_limits<int64_t>::max()) <= MaxTraceContentSize) + if (replyMIME.GetVar(ContentLengthTag(), numeric_limits<int64_t>::max()) <= (int64_t)MaxTraceContentSize) ReadContentBody(replyMIME, body); else #endif Modified: ptlib/trunk/src/ptclib/memfile.cxx =================================================================== --- ptlib/trunk/src/ptclib/memfile.cxx 2016-03-07 18:52:38 UTC (rev 34663) +++ ptlib/trunk/src/ptclib/memfile.cxx 2016-03-07 19:16:24 UTC (rev 34664) @@ -140,7 +140,7 @@ break; case Current: - if (pos < -m_position || pos > (m_data.GetSize() - m_position)) + if (pos < -m_position || pos > ((off_t)m_data.GetSize() - m_position)) return false; m_position += pos; break; Modified: ptlib/trunk/src/ptclib/psoap.cxx =================================================================== --- ptlib/trunk/src/ptclib/psoap.cxx 2016-03-07 18:52:38 UTC (rev 34663) +++ ptlib/trunk/src/ptclib/psoap.cxx 2016-03-07 19:16:24 UTC (rev 34664) @@ -565,9 +565,8 @@ PStringArray lines = replyBody.Lines(); for ( int offset = -2; offset <= 2; offset++ ) { int line = response.GetErrorLine() + offset; - - if ( line >= 0 && line < lines.GetSize() ) - txt << lines[ ( PINDEX ) line ]; + if (line >= 0 && (PINDEX)line < lines.GetSize()) + txt << lines[(PINDEX)line]; } } } Modified: ptlib/trunk/src/ptclib/pwavfile.cxx =================================================================== --- ptlib/trunk/src/ptclib/pwavfile.cxx 2016-03-07 18:52:38 UTC (rev 34663) +++ ptlib/trunk/src/ptclib/pwavfile.cxx 2016-03-07 19:16:24 UTC (rev 34664) @@ -267,7 +267,7 @@ return false; } - if ((pos + len) > fileLength) + if ((pos + (off_t)len) > fileLength) len = fileLength - pos; if (m_formatHandler != NULL) Modified: ptlib/trunk/src/ptlib/common/pluginmgr.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/pluginmgr.cxx 2016-03-07 18:52:38 UTC (rev 34663) +++ ptlib/trunk/src/ptlib/common/pluginmgr.cxx 2016-03-07 19:16:24 UTC (rev 34664) @@ -95,7 +95,7 @@ bool PPluginDeviceDescriptor::ValidateDeviceName(const PString & name, P_INT_PTR userData) const { PStringArray devices = GetDeviceNames(userData); - if (name.GetLength() == 2 && name[0] == '#' && isdigit(name[1]) && (name[1]-'0') < devices.GetSize()) + if (name.GetLength() == 2 && name[0] == '#' && isdigit(name[1]) && (PINDEX)(name[1]-'0') < devices.GetSize()) return true; for (PINDEX i = 0; i < devices.GetSize(); i++) { Modified: ptlib/trunk/src/ptlib/common/syslog.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/syslog.cxx 2016-03-07 18:52:38 UTC (rev 34663) +++ ptlib/trunk/src/ptlib/common/syslog.cxx 2016-03-07 19:16:24 UTC (rev 34664) @@ -229,7 +229,7 @@ "Warning", "Info" }; - if (level < PARRAYSIZE(levelName)) + if ((PINDEX)level < PARRAYSIZE(levelName)) stream << levelName[level]; else stream << "Debug" << (level - PSystemLog::Info); @@ -589,7 +589,7 @@ "WARNING", // LogWarning, "INFO", // LogInfo, }; - if (level < PARRAYSIZE(levelName)) + if ((PINDEX)level < PARRAYSIZE(levelName)) syslog(priority, "%-8s%s", levelName[level], msg); else syslog(priority, "DEBUG%-3u%s", level - PSystemLog::Info, msg); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-07 18:52:41
|
Revision: 34663 http://sourceforge.net/p/opalvoip/code/34663 Author: rjongbloed Date: 2016-03-07 18:52:38 +0000 (Mon, 07 Mar 2016) Log Message: ----------- Further fixes for using size_t for PINDEX under latest GCC Modified Paths: -------------- ptlib/trunk/configure ptlib/trunk/configure.ac ptlib/trunk/include/ptlib/dict.h ptlib/trunk/include/ptlib/msos/ptlib/platform.h ptlib/trunk/include/ptlib/object.h ptlib/trunk/include/ptlib/unix/ptlib/platform.h ptlib/trunk/samples/dnstest/main.cxx ptlib/trunk/src/ptclib/asner.cxx ptlib/trunk/src/ptclib/enum.cxx ptlib/trunk/src/ptclib/vxml.cxx ptlib/trunk/src/ptlib/common/contain.cxx ptlib/trunk/src/ptlib/unix/osutil.cxx ptlib/trunk/src/ptlib/unix/socket.cxx Modified: ptlib/trunk/configure =================================================================== --- ptlib/trunk/configure 2016-03-07 15:48:10 UTC (rev 34662) +++ ptlib/trunk/configure 2016-03-07 18:52:38 UTC (rev 34663) @@ -938,6 +938,7 @@ enable_sanitize_thread enable_exceptions with_allocator +enable_pindex_is_size_t enable_pthread_kill enable_ipv6 enable_backtrace @@ -1693,6 +1694,8 @@ --enable-sanitize-thread Enable GCC/clang Thread Sanitizer --enable-exceptions enable C++ exceptions + --enable-pindex-is-size_t + enable PINDEX set to size_t --disable-pthread_kill Disable use of pthread_kill for checking on thread terminated --disable-ipv6 disable IPV6 support @@ -8204,6 +8207,58 @@ fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking enable PINDEX set to size_t" >&5 +$as_echo_n "checking enable PINDEX set to size_t... " >&6; } + + # Check whether --enable-pindex-is-size_t was given. +if test "${enable_pindex_is_size_t+set}" = set; then : + enableval=$enable_pindex_is_size_t; if test "x$enableval" = xno; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled by user" >&5 +$as_echo "disabled by user" >&6; } +fi +else + + enableval=no + if test "x$enableval" = xno; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled by default" >&5 +$as_echo "disabled by default" >&6; } +fi + + +fi + + + + + + + + + + + + + + + + if test "x$enableval" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi + + if test "x$enableval" = "xyes"; then : + $as_echo "#define P_PINDEX_IS_SIZE_T 1" >>confdefs.h + + +fi + + + enable_pindex-is-size_t="$enableval" + + + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' Modified: ptlib/trunk/configure.ac =================================================================== --- ptlib/trunk/configure.ac 2016-03-07 15:48:10 UTC (rev 34662) +++ ptlib/trunk/configure.ac 2016-03-07 18:52:38 UTC (rev 34663) @@ -472,9 +472,16 @@ fi -PTLIB_SIMPLE_OPTION([pindex-is-size_t], [P_PINDEX_IS_SIZE_T], [Set PINDEX to be size_t]) +dnl ######################################################################## +MY_ARG_ENABLE( + [pindex-is-size_t], + [enable PINDEX set to size_t], + [no], + [AC_DEFINE(P_PINDEX_IS_SIZE_T, 1)] +) + dnl ######################################################################## dnl check for headers AC_CHECK_HEADERS(limits.h alloca.h signal.h fcntl.h sys/time.h termios.h sys/termios.h \ Modified: ptlib/trunk/include/ptlib/dict.h =================================================================== --- ptlib/trunk/include/ptlib/dict.h 2016-03-07 15:48:10 UTC (rev 34662) +++ ptlib/trunk/include/ptlib/dict.h 2016-03-07 18:52:38 UTC (rev 34663) @@ -104,7 +104,14 @@ @return hash table bucket number. */ - virtual PINDEX HashFunction() const { return PABSINDEX(this->m_key)%23; } + virtual PINDEX HashFunction() const + { +#if PINDEX_SIGNED + return ((PINDEX)std::abs(this->m_key))%23; +#else + return ((PINDEX)this->m_key)%23; +#endif + } /**Output the ordinal index to the specified stream. This is identical to outputting the PINDEX, i.e. integer, value. Modified: ptlib/trunk/include/ptlib/msos/ptlib/platform.h =================================================================== --- ptlib/trunk/include/ptlib/msos/ptlib/platform.h 2016-03-07 15:48:10 UTC (rev 34662) +++ ptlib/trunk/include/ptlib/msos/ptlib/platform.h 2016-03-07 18:52:38 UTC (rev 34663) @@ -174,8 +174,7 @@ #if P_64BIT typedef size_t PINDEX; const PINDEX P_MAX_INDEX = 0xffffffffffffffff; - inline PINDEX PABSINDEX(PINDEX idx) { return idx; } - #define PASSERTINDEX(idx) + #define PINDEX_SIGNED 0 #else #define PINDEX int #if defined(_WIN32) || defined(_WIN32_WCE) @@ -183,8 +182,7 @@ #else const PINDEX P_MAX_INDEX = 0x7fff; #endif - inline PINDEX PABSINDEX(PINDEX idx) { return (idx < 0 ? -idx : idx)&P_MAX_INDEX; } - #define PASSERTINDEX(idx) PAssert((idx) >= 0, PInvalidArrayIndex) + #define PINDEX_SIGNED 1 #endif #else @@ -195,8 +193,7 @@ #else const PINDEX P_MAX_INDEX = 0xffffffff; #endif - #define PABSINDEX(idx) (idx) - #define PASSERTINDEX(idx) + #define PINDEX_SIGNED 0 #endif Modified: ptlib/trunk/include/ptlib/object.h =================================================================== --- ptlib/trunk/include/ptlib/object.h 2016-03-07 15:48:10 UTC (rev 34662) +++ ptlib/trunk/include/ptlib/object.h 2016-03-07 18:52:38 UTC (rev 34663) @@ -76,6 +76,14 @@ #endif +#if PINDEX_SIGNED + #define PASSERTINDEX(idx) PAssert((idx) >= 0, PInvalidArrayIndex) +#else + #define PASSERTINDEX(idx) +#endif + + + /////////////////////////////////////////////////////////////////////////////// #define P_REMOVE_VIRTUAL_INTERNAL_BASE(fn) __inline virtual struct ptlib_virtual_function_changed_or_removed ****** fn { return 0; } Modified: ptlib/trunk/include/ptlib/unix/ptlib/platform.h =================================================================== --- ptlib/trunk/include/ptlib/unix/ptlib/platform.h 2016-03-07 15:48:10 UTC (rev 34662) +++ ptlib/trunk/include/ptlib/unix/ptlib/platform.h 2016-03-07 18:52:38 UTC (rev 34663) @@ -578,21 +578,24 @@ #if P_PINDEX_IS_SIZE_T typedef size_t PINDEX; - #define P_MAX_INDEX (std::numeric_limits<size_t>::max()) + #if P_64BIT + const size_t P_MAX_INDEX = 0xffffffffffffffff; + #else + const size_t P_MAX_INDEX = 0xffffffff; + #endif - #define PABSINDEX(idx) (idx) - #define PASSERTINDEX(idx) + #define PINDEX_SIGNED 0 #else // P_PINDEX_IS_SIZE_T typedef int PINDEX; #define P_MAX_INDEX INT_MAX - inline PINDEX PABSINDEX(PINDEX idx) { return (idx < 0 ? -idx : idx)&P_MAX_INDEX; } - #define PASSERTINDEX(idx) PAssert((idx) >= 0, PInvalidArrayIndex) + #define PINDEX_SIGNED 1 #endif // P_PINDEX_IS_SIZE_T #endif // PTLIB_PLATFORM_H + // End of file Modified: ptlib/trunk/samples/dnstest/main.cxx =================================================================== --- ptlib/trunk/samples/dnstest/main.cxx 2016-03-07 15:48:10 UTC (rev 34662) +++ ptlib/trunk/samples/dnstest/main.cxx 2016-03-07 18:52:38 UTC (rev 34663) @@ -157,7 +157,7 @@ #if P_URL if (args.HasOption('u')) { - if (args.GetCount() < 0) { + if (args.GetCount() == 0) { Usage(); return; } Modified: ptlib/trunk/src/ptclib/asner.cxx =================================================================== --- ptlib/trunk/src/ptclib/asner.cxx 2016-03-07 15:48:10 UTC (rev 34662) +++ ptlib/trunk/src/ptclib/asner.cxx 2016-03-07 18:52:38 UTC (rev 34663) @@ -68,7 +68,11 @@ inline PBoolean CheckByteOffset(PINDEX offset, PINDEX upper = MaximumStringSize) { // a 1mbit PDU has got to be an error - return (0 <= offset && offset <= upper); +#if PINDEX_SIGNED + if (offset < 0) + return false; +#endif + return offset <= upper; } static PINDEX FindNameByValue(const PASN_Names *names, PINDEX namesCount, unsigned value) @@ -495,7 +499,7 @@ void PASN_Enumeration::PrintOn(ostream & strm) const { - unsigned idx = FindNameByValue(names, namesCount, value); + PINDEX idx = FindNameByValue(names, namesCount, value); if (idx != P_MAX_INDEX) strm << names[idx].name; else @@ -1294,8 +1298,6 @@ if (memchr(set, canonicalSet[i], setSize) != NULL) characterSet[count++] = canonicalSet[i]; } - if (count < 0) - return; characterSet.SetSize(count); } Modified: ptlib/trunk/src/ptclib/enum.cxx =================================================================== --- ptlib/trunk/src/ptclib/enum.cxx 2016-03-07 15:48:10 UTC (rev 34662) +++ ptlib/trunk/src/ptclib/enum.cxx 2016-03-07 18:52:38 UTC (rev 34663) @@ -263,10 +263,10 @@ // replace variables in the second string PString value = strings[1]; for (pos = 0; pos < value.GetLength(); pos++) { - if (value[pos] == '\\' && pos < value.GetLength()-1) { - PINDEX var = value[pos+1]-'1'+1; + if (value[pos] == '\\' && pos < value.GetLength()-1 && isdigit(value[pos+1])) { + PINDEX var = value[pos+1]-'0'; PString str; - if (var >= 0 && var < starts.GetSize() && var < ends.GetSize()) + if (var < starts.GetSize() && var < ends.GetSize()) str = orig(starts[var], ends[var]); value = value.Left(pos) + str + value.Mid(pos+2); } Modified: ptlib/trunk/src/ptclib/vxml.cxx =================================================================== --- ptlib/trunk/src/ptclib/vxml.cxx 2016-03-07 15:48:10 UTC (rev 34662) +++ ptlib/trunk/src/ptclib/vxml.cxx 2016-03-07 18:52:38 UTC (rev 34663) @@ -350,7 +350,7 @@ m_currentIndex = 0; - return PVXMLPlayable::Open(chan, PString::Empty(), delay, ((repeat >= 0) ? repeat : 1) * m_fileNames.GetSize(), autoDelete); + return PVXMLPlayable::Open(chan, PString::Empty(), delay, ((repeat > 0) ? repeat : 1) * m_fileNames.GetSize(), autoDelete); } Modified: ptlib/trunk/src/ptlib/common/contain.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/contain.cxx 2016-03-07 15:48:10 UTC (rev 34662) +++ ptlib/trunk/src/ptlib/common/contain.cxx 2016-03-07 18:52:38 UTC (rev 34663) @@ -147,9 +147,11 @@ PBoolean PContainer::SetMinSize(PINDEX minSize) { +#if PINDEX_SIGNED PASSERTINDEX(minSize); if (minSize < 0) minSize = 0; +#endif if (minSize < GetSize()) minSize = GetSize(); return SetSize(minSize); @@ -343,8 +345,10 @@ PBoolean PAbstractArray::InternalSetSize(PINDEX newSize, PBoolean force) { +#if PINDEX_SIGNED if (newSize < 0) - newSize = 0; + return false; +#endif PINDEX newsizebytes = elementSize*newSize; PINDEX oldsizebytes = elementSize*GetSize(); @@ -1206,13 +1210,13 @@ static const PINDEX MaxCount = 18; // Make sure big enough to cover whole PGloballyUniqueID::AsString() PINDEX count = std::min(m_length / 2, MaxCount); - PINDEX hash = 0; + unsigned hash = 0; PINDEX i; for (i = 0; i < count; i++) hash = (hash << 5) ^ tolower(theArray[i] & 0xff) ^ hash; for (i = m_length - count - 1; i < m_length; i++) hash = (hash << 5) ^ tolower(theArray[i] & 0xff) ^ hash; - return PABSINDEX(hash) % 127; + return hash % 127; } @@ -1377,7 +1381,11 @@ PString & PString::Delete(PINDEX start, PINDEX len) { - if (start < 0 || len < 0) +#if PINDEX_SIGNED + if (start < 0 || len <= 0) +#else + if (len == 0) +#endif return *this; MakeUnique(); @@ -1403,9 +1411,14 @@ PString PString::operator()(PINDEX start, PINDEX end) const { - if (end < 0 || start < 0 || end < start) +#if PINDEX_SIGNED + if (end < 0 || start < 0) return Empty(); +#endif + if (end < start) + return Empty(); + PINDEX len = GetLength(); if (start > len) return Empty(); @@ -1447,7 +1460,11 @@ PString PString::Mid(PINDEX start, PINDEX len) const { +#if PINDEX_SIGNED if (len <= 0 || start < 0) +#else + if (len == 0) +#endif return Empty(); if (len == P_MAX_INDEX || start+len < start) // If open ended or check for wraparound @@ -1475,8 +1492,11 @@ PObject::Comparison PString::NumCompare(const PString & str, PINDEX count, PINDEX offset) const { +#if PINDEX_SIGNED if (offset < 0 || count < 0) return LessThan; +#endif + PINDEX len = str.GetLength(); if (count > len) count = len; @@ -1486,8 +1506,11 @@ PObject::Comparison PString::NumCompare(const char * cstr, PINDEX count, PINDEX offset) const { +#if PINDEX_SIGNED if (offset < 0 || count < 0) return LessThan; +#endif + PINDEX len = ::strlen(cstr); if (count > len) count = len; @@ -1497,8 +1520,11 @@ PObject::Comparison PString::InternalCompare(PINDEX offset, char c) const { +#if PINDEX_SIGNED if (offset < 0) return LessThan; +#endif + const int ch = theArray[offset] & 0xff; if (ch < (c & 0xff)) return LessThan; @@ -1510,13 +1536,15 @@ PObject::Comparison PString::InternalCompare(PINDEX offset, PINDEX length, const char * cstr) const { +#if PINDEX_SIGNED if (offset < 0 || length < 0) return LessThan; +#endif if (offset == 0 && theArray == cstr) return EqualTo; - if (offset < 0 || cstr == NULL) + if (cstr == NULL) return IsEmpty() ? EqualTo : LessThan; int retval; @@ -1537,8 +1565,10 @@ PINDEX PString::Find(char ch, PINDEX offset) const { +#if PINDEX_SIGNED if (offset < 0) return P_MAX_INDEX; +#endif PINDEX len = GetLength(); while (offset < len) { @@ -1552,9 +1582,14 @@ PINDEX PString::Find(const char * cstr, PINDEX offset) const { - if (cstr == NULL || *cstr == '\0' || offset < 0) +#if PINDEX_SIGNED + if (offset < 0) return P_MAX_INDEX; +#endif + if (cstr == NULL || *cstr == '\0') + return P_MAX_INDEX; + PINDEX len = GetLength(); PINDEX clen = strlen(cstr); if (clen > len) @@ -1594,9 +1629,15 @@ PINDEX PString::FindLast(char ch, PINDEX offset) const { +#if PINDEX_SIGNED + if (offset < 0) + return P_MAX_INDEX; +#endif + PINDEX len = GetLength(); - if (len == 0 || offset < 0) + if (len == 0) return P_MAX_INDEX; + if (offset >= len) offset = len-1; @@ -1612,9 +1653,14 @@ PINDEX PString::FindLast(const char * cstr, PINDEX offset) const { - if (cstr == NULL || *cstr == '\0' || offset < 0) +#if PINDEX_SIGNED + if (offset < 0) return P_MAX_INDEX; +#endif + if (cstr == NULL || *cstr == '\0') + return P_MAX_INDEX; + PINDEX len = GetLength(); PINDEX clen = strlen(cstr); if (clen > len) @@ -1645,9 +1691,14 @@ PINDEX PString::FindOneOf(const char * cset, PINDEX offset) const { - if (cset == NULL || *cset == '\0' || offset < 0) +#if PINDEX_SIGNED + if (offset < 0) return P_MAX_INDEX; +#endif + if (cset == NULL || *cset == '\0') + return P_MAX_INDEX; + PINDEX len = GetLength(); while (offset < len) { const char * p = cset; @@ -1664,9 +1715,14 @@ PINDEX PString::FindSpan(const char * cset, PINDEX offset) const { - if (cset == NULL || *cset == '\0' || offset < 0) +#if PINDEX_SIGNED + if (offset < 0) return P_MAX_INDEX; +#endif + if (cset == NULL || *cset == '\0') + return P_MAX_INDEX; + PINDEX len = GetLength(); while (offset < len) { const char * p = cset; @@ -1682,8 +1738,10 @@ PINDEX PString::FindRegEx(const PRegularExpression & regex, PINDEX offset) const { +#if PINDEX_SIGNED if (offset < 0) return P_MAX_INDEX; +#endif PINDEX pos = 0; PINDEX len = 0; @@ -1700,8 +1758,13 @@ PINDEX offset, PINDEX maxPos) const { +#if PINDEX_SIGNED + if (offset < 0 || maxPos < 0) + return false; +#endif + PINDEX olen = GetLength(); - if (offset < 0 || maxPos < 0 || offset > olen) + if (offset > olen) return false; if (offset == olen) { @@ -1733,8 +1796,10 @@ PString & PString::Replace(const PString & target, const PString & subs, PBoolean all, PINDEX offset) { +#if PINDEX_SIGNED if (offset < 0) return *this; +#endif MakeUnique(); @@ -1754,8 +1819,10 @@ PString & PString::Splice(const char * cstr, PINDEX pos, PINDEX len) { +#if PINDEX_SIGNED if (len < 0 || pos < 0) return *this; +#endif PINDEX slen = GetLength(); if (pos >= slen) @@ -2264,8 +2331,10 @@ PObject::Comparison PCaselessString::InternalCompare(PINDEX offset, char c) const { +#if PINDEX_SIGNED if (offset < 0) return LessThan; +#endif int c1 = toupper(theArray[offset] & 0xff); int c2 = toupper(c & 0xff); @@ -2280,8 +2349,10 @@ PObject::Comparison PCaselessString::InternalCompare( PINDEX offset, PINDEX length, const char * cstr) const { +#if PINDEX_SIGNED if (offset < 0 || length < 0) return LessThan; +#endif if (cstr == NULL) return IsEmpty() ? EqualTo : LessThan; Modified: ptlib/trunk/src/ptlib/unix/osutil.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/osutil.cxx 2016-03-07 15:48:10 UTC (rev 34662) +++ ptlib/trunk/src/ptlib/unix/osutil.cxx 2016-03-07 18:52:38 UTC (rev 34663) @@ -1028,13 +1028,8 @@ PString PFilePath::GetType() const { - PINDEX p = FindLast('.'); - PINDEX l = (p == P_MAX_INDEX) ? 0 : (GetLength() - p); - - if (p < 0 || l < 2) - return PString::Empty(); - else - return Mid(p); + PINDEX pos = FindLast('.'); + return pos == P_MAX_INDEX || (GetLength()-pos) < 2 ? PString::Empty() : Mid(pos); } @@ -1052,15 +1047,14 @@ { PINDEX pos = FindLast('/'); - return pos == P_MAX_INDEX ? *this : Mid(pos+1); + return pos == P_MAX_INDEX ? static_cast<PString>(*this) : Mid(pos+1); } PDirectory PFilePath::GetDirectory() const { - static const PConstString curdir("./"); PINDEX pos = FindLast('/'); - return pos == P_MAX_INDEX ? curdir : Left(i); + return pos == P_MAX_INDEX ? PString("./") : Left(pos); } Modified: ptlib/trunk/src/ptlib/unix/socket.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/socket.cxx 2016-03-07 15:48:10 UTC (rev 34662) +++ ptlib/trunk/src/ptlib/unix/socket.cxx 2016-03-07 18:52:38 UTC (rev 34663) @@ -676,7 +676,7 @@ return false; flush(); - return os_vwrite(slices, sliceCount, 0, NULL, 0) && GetLastWriteCount() >= 0; + return os_vwrite(slices, sliceCount, 0, NULL, 0) && GetLastWriteCount() > 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-07 15:48:12
|
Revision: 34662 http://sourceforge.net/p/opalvoip/code/34662 Author: rjongbloed Date: 2016-03-07 15:48:10 +0000 (Mon, 07 Mar 2016) Log Message: ----------- Allow option to build Unix version with PINDEX being size_t rather than int. Modified Paths: -------------- ptlib/trunk/configure.ac ptlib/trunk/include/ptlib_config.h.in Modified: ptlib/trunk/configure.ac =================================================================== --- ptlib/trunk/configure.ac 2016-03-07 15:43:04 UTC (rev 34661) +++ ptlib/trunk/configure.ac 2016-03-07 15:48:10 UTC (rev 34662) @@ -472,6 +472,9 @@ fi +PTLIB_SIMPLE_OPTION([pindex-is-size_t], [P_PINDEX_IS_SIZE_T], [Set PINDEX to be size_t]) + + dnl ######################################################################## dnl check for headers AC_CHECK_HEADERS(limits.h alloca.h signal.h fcntl.h sys/time.h termios.h sys/termios.h \ Modified: ptlib/trunk/include/ptlib_config.h.in =================================================================== --- ptlib/trunk/include/ptlib_config.h.in 2016-03-07 15:43:04 UTC (rev 34661) +++ ptlib/trunk/include/ptlib_config.h.in 2016-03-07 15:48:10 UTC (rev 34662) @@ -82,6 +82,8 @@ // Integer/char types // +#undef P_PINDEX_IS_SIZE_T + #if defined(_WIN64) && !defined(P_64BIT) #define P_64BIT 1 #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-07 15:43:06
|
Revision: 34661 http://sourceforge.net/p/opalvoip/code/34661 Author: rjongbloed Date: 2016-03-07 15:43:04 +0000 (Mon, 07 Mar 2016) Log Message: ----------- Allow option to build Unix version with PINDEX being size_t rather than int. Fixed consequent warnings. Modified Paths: -------------- ptlib/trunk/include/ptlib/unix/ptlib/platform.h ptlib/trunk/src/ptclib/pssl.cxx ptlib/trunk/src/ptclib/pstun.cxx ptlib/trunk/src/ptclib/pwavfile.cxx ptlib/trunk/src/ptclib/pxmlrpc.cxx ptlib/trunk/src/ptlib/common/sockets.cxx ptlib/trunk/src/ptlib/unix/osutil.cxx Modified: ptlib/trunk/include/ptlib/unix/ptlib/platform.h =================================================================== --- ptlib/trunk/include/ptlib/unix/ptlib/platform.h 2016-03-07 15:39:06 UTC (rev 34660) +++ ptlib/trunk/include/ptlib/unix/ptlib/platform.h 2016-03-07 15:43:04 UTC (rev 34661) @@ -575,13 +575,24 @@ /////////////////////////////////////////// // Type used for array indexes and sizes -typedef int PINDEX; -#define P_MAX_INDEX INT_MAX +#if P_PINDEX_IS_SIZE_T -inline PINDEX PABSINDEX(PINDEX idx) { return (idx < 0 ? -idx : idx)&P_MAX_INDEX; } -#define PASSERTINDEX(idx) PAssert((idx) >= 0, PInvalidArrayIndex) + typedef size_t PINDEX; + #define P_MAX_INDEX (std::numeric_limits<size_t>::max()) + #define PABSINDEX(idx) (idx) + #define PASSERTINDEX(idx) +#else // P_PINDEX_IS_SIZE_T + + typedef int PINDEX; + #define P_MAX_INDEX INT_MAX + + inline PINDEX PABSINDEX(PINDEX idx) { return (idx < 0 ? -idx : idx)&P_MAX_INDEX; } + #define PASSERTINDEX(idx) PAssert((idx) >= 0, PInvalidArrayIndex) + +#endif // P_PINDEX_IS_SIZE_T + #endif // PTLIB_PLATFORM_H // End of file Modified: ptlib/trunk/src/ptclib/pssl.cxx =================================================================== --- ptlib/trunk/src/ptclib/pssl.cxx 2016-03-07 15:39:06 UTC (rev 34660) +++ ptlib/trunk/src/ptclib/pssl.cxx 2016-03-07 15:43:04 UTC (rev 34661) @@ -1078,7 +1078,7 @@ { PTRACE(4, "Setting key: " << hex << fixed << setfill('0') << PBYTEArray(keyPtr, keyLen, false)); - if (keyLen < EVP_CIPHER_CTX_key_length(m_context)) { + if (keyLen < (PINDEX)EVP_CIPHER_CTX_key_length(m_context)) { PTRACE(2, "Incorrect key length for encryption"); return false; } @@ -1100,7 +1100,7 @@ bool PSSLCipherContext::SetIV(const BYTE * ivPtr, PINDEX ivLen) { - if (ivLen < EVP_CIPHER_CTX_iv_length(m_context)) { + if (ivLen < (PINDEX)EVP_CIPHER_CTX_iv_length(m_context)) { PTRACE(2, "Incorrect inital vector length for encryption"); return false; } Modified: ptlib/trunk/src/ptclib/pstun.cxx =================================================================== --- ptlib/trunk/src/ptclib/pstun.cxx 2016-03-07 15:39:06 UTC (rev 34660) +++ ptlib/trunk/src/ptclib/pstun.cxx 2016-03-07 15:43:04 UTC (rev 34661) @@ -487,7 +487,7 @@ if (length < (int)sizeof(PSTUNAttribute)) return NULL; - if (GetSize() < ((int)sizeof(PSTUNMessageHeader) + length)) + if (GetSize() < (PINDEX)(sizeof(PSTUNMessageHeader) + length)) return NULL; PSTUNAttribute * attr = (PSTUNAttribute *)(theArray+sizeof(PSTUNMessageHeader)); @@ -525,7 +525,7 @@ int length = header->msgLength; - if (GetSize() < ((int)sizeof(PSTUNMessageHeader) + length)) + if (GetSize() < (PINDEX)(sizeof(PSTUNMessageHeader) + length)) return false; // check attributes Modified: ptlib/trunk/src/ptclib/pwavfile.cxx =================================================================== --- ptlib/trunk/src/ptclib/pwavfile.cxx 2016-03-07 15:39:06 UTC (rev 34660) +++ ptlib/trunk/src/ptclib/pwavfile.cxx 2016-03-07 15:43:04 UTC (rev 34661) @@ -257,7 +257,7 @@ // Some wav files have extra data after the sound samples in a LIST chunk. // e.g. WAV files made in GoldWave have a copyright and a URL in this chunk. // We do not want to return this data by mistake. - PINDEX fileLength = m_headerLength + m_dataLength; + off_t fileLength = m_headerLength + m_dataLength; off_t pos = PFile::GetPosition(); if (pos >= fileLength) { Modified: ptlib/trunk/src/ptclib/pxmlrpc.cxx =================================================================== --- ptlib/trunk/src/ptclib/pxmlrpc.cxx 2016-03-07 15:39:06 UTC (rev 34660) +++ ptlib/trunk/src/ptclib/pxmlrpc.cxx 2016-03-07 15:43:04 UTC (rev 34661) @@ -984,7 +984,7 @@ PStringArray lines = replyXML.Lines(); for (int offset = -2; offset <= 2; offset++) { int line = response.GetErrorLine() + offset; - if (line >= 0 && line < lines.GetSize()) + if (line >= 0 && (PINDEX)line < lines.GetSize()) txt << lines[(PINDEX)line] << '\n'; } Modified: ptlib/trunk/src/ptlib/common/sockets.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/sockets.cxx 2016-03-07 15:39:06 UTC (rev 34660) +++ ptlib/trunk/src/ptlib/common/sockets.cxx 2016-03-07 15:43:04 UTC (rev 34661) @@ -2946,7 +2946,7 @@ return true; } - if (numSockets >= (m_max - m_base)) { + if (numSockets >= (PINDEX)(m_max - m_base)) { PTRACE(2, NULL, PTraceModule(), "Listen failed, not enough room from " << m_base << " to " << m_max << " for " << numSockets << " sockets"); return false; Modified: ptlib/trunk/src/ptlib/unix/osutil.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/osutil.cxx 2016-03-07 15:39:06 UTC (rev 34660) +++ ptlib/trunk/src/ptlib/unix/osutil.cxx 2016-03-07 15:43:04 UTC (rev 34661) @@ -1012,17 +1012,14 @@ PString PFilePath::GetPath() const - { - int i; - - PAssert((i = FindLast('/')) != P_MAX_INDEX, PInvalidArrayIndex); - return Left(i+1); + PINDEX pos = FindLast('/'); + PAssert(pos != P_MAX_INDEX, PInvalidArrayIndex); + return Left(pos+1); } PString PFilePath::GetTitle() const - { PString fn(GetFileName()); return fn(0, fn.FindLast('.')-1); @@ -1030,15 +1027,14 @@ PString PFilePath::GetType() const - { - int p = FindLast('.'); - int l = (p == P_MAX_INDEX) ? 0 : (GetLength() - p); + PINDEX p = FindLast('.'); + PINDEX l = (p == P_MAX_INDEX) ? 0 : (GetLength() - p); if (p < 0 || l < 2) - return PString(""); + return PString::Empty(); else - return (*this)(p, P_MAX_INDEX); + return Mid(p); } @@ -1055,23 +1051,16 @@ PString PFilePath::GetFileName() const { - int i; - - if ((i = FindLast('/')) == P_MAX_INDEX) - return *this; - else - return Right(GetLength()-i-1); + PINDEX pos = FindLast('/'); + return pos == P_MAX_INDEX ? *this : Mid(pos+1); } PDirectory PFilePath::GetDirectory() const { - int i; - - if ((i = FindLast('/')) == P_MAX_INDEX) - return "./"; - else - return Left(i); + static const PConstString curdir("./"); + PINDEX pos = FindLast('/'); + return pos == P_MAX_INDEX ? curdir : Left(i); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-07 15:39:09
|
Revision: 34660 http://sourceforge.net/p/opalvoip/code/34660 Author: rjongbloed Date: 2016-03-07 15:39:06 +0000 (Mon, 07 Mar 2016) Log Message: ----------- Fixed being able to receive >2Gb data over HTTP. Modified Paths: -------------- ptlib/trunk/src/ptclib/httpclnt.cxx Modified: ptlib/trunk/src/ptclib/httpclnt.cxx =================================================================== --- ptlib/trunk/src/ptclib/httpclnt.cxx 2016-03-07 15:12:31 UTC (rev 34659) +++ ptlib/trunk/src/ptclib/httpclnt.cxx 2016-03-07 15:39:06 UTC (rev 34660) @@ -424,7 +424,7 @@ PString body; if (lastResponseCode >= 300) { #if PTRACING - if ((int)replyMIME.GetInteger(ContentLengthTag(), INT_MAX) <= MaxTraceContentSize) + if (replyMIME.GetVar(ContentLengthTag(), numeric_limits<int64_t>::max()) <= MaxTraceContentSize) ReadContentBody(replyMIME, body); else #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-07 15:12:34
|
Revision: 34659 http://sourceforge.net/p/opalvoip/code/34659 Author: rjongbloed Date: 2016-03-07 15:12:31 +0000 (Mon, 07 Mar 2016) Log Message: ----------- Fixed being able to send >2Gb data over HTTP. Modified Paths: -------------- ptlib/trunk/src/ptclib/httpclnt.cxx Modified: ptlib/trunk/src/ptclib/httpclnt.cxx =================================================================== --- ptlib/trunk/src/ptclib/httpclnt.cxx 2016-03-07 13:09:23 UTC (rev 34658) +++ ptlib/trunk/src/ptclib/httpclnt.cxx 2016-03-07 15:12:31 UTC (rev 34659) @@ -356,11 +356,11 @@ { if (!outMIME.Contains(ContentLengthTag())) { processor.Reset(); - PINDEX total = 0; + uint64_t total = 0; PINDEX len; while (processor.GetBuffer(len) != NULL) total += len; - outMIME.SetInteger(ContentLengthTag(), total); + outMIME.SetVar(ContentLengthTag(), total); } PString cmdName = commandNames[cmd]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-07 13:09:26
|
Revision: 34658 http://sourceforge.net/p/opalvoip/code/34658 Author: rjongbloed Date: 2016-03-07 13:09:23 +0000 (Mon, 07 Mar 2016) Log Message: ----------- Added "Assertion fail" text to possible/phantom deadlock detection output so monitoring software of servers can pick it up with other asserts. Modified Paths: -------------- ptlib/trunk/include/ptlib/mutex.h ptlib/trunk/src/ptlib/common/osutils.cxx ptlib/trunk/src/ptlib/msos/win32.cxx ptlib/trunk/src/ptlib/unix/tlibthrd.cxx Modified: ptlib/trunk/include/ptlib/mutex.h =================================================================== --- ptlib/trunk/include/ptlib/mutex.h 2016-03-04 13:44:21 UTC (rev 34657) +++ ptlib/trunk/include/ptlib/mutex.h 2016-03-07 13:09:23 UTC (rev 34658) @@ -53,6 +53,8 @@ PMutexExcessiveLockInfo(const char * name, unsigned line, unsigned timeout); PMutexExcessiveLockInfo(const PMutexExcessiveLockInfo & other); void PrintOn(ostream &strm) const; + void ExcessiveLockPhantom(const PObject & mutex) const; + void LockReleased(const PObject & mutex); }; Modified: ptlib/trunk/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/trunk/src/ptlib/common/osutils.cxx 2016-03-04 13:44:21 UTC (rev 34657) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-03-07 13:09:23 UTC (rev 34658) @@ -2969,6 +2969,29 @@ } +void PMutexExcessiveLockInfo::ExcessiveLockPhantom(const PObject & mutex) const +{ +#if PTRACING + PTRACE_BEGIN(0, "PTLib") << "Assertion fail: Phantom deadlock in " << mutex << PTrace::End; +#else + PAssertAlways(PSTRSTRM("Phantom deadlock in mutex " << mutex)); +#endif +} + + +void PMutexExcessiveLockInfo::LockReleased(const PObject & mutex) +{ + if (m_excessiveLockActive) { +#if PTRACING + PTRACE_BEGIN(0, "PTLib") << "Assertion fail: Released phantom deadlock in " << mutex << PTrace::End; +#else + PAssertAlways(PSTRSTRM("Released phantom deadlock in mutex " << *this)); +#endif + m_excessiveLockActive = false; + } +} + + void PTimedMutex::ExcessiveLockWait() { #if PTRACING @@ -2977,7 +3000,7 @@ PUniqueThreadIdentifier lastUniqueId = m_lastUniqueId; ostream & trace = PTRACE_BEGIN(0, "PTLib"); - trace << "Possible deadlock in mutex " << *this << "\n Blocked Thread"; + trace << "Assertion fail: Possible deadlock in " << *this << "\n Blocked Thread"; OutputThreadInfo(trace, PThread::GetCurrentThreadId(), PThread::GetCurrentUniqueIdentifier(), EnableDeadlockStackWalk); trace << "\n Owner Thread "; if (lockerId != PNullThreadIdentifier) @@ -2988,7 +3011,7 @@ } trace << PTrace::End; #else - PAssertAlways(PSTRSTRM("Possible deadlock in mutex " << *this)); + PAssertAlways(PSTRSTRM("Possible deadlock in " << *this)); #endif m_excessiveLockActive = true; @@ -2997,18 +3020,14 @@ void PTimedMutex::CommonSignal() { - if (m_excessiveLockActive) { - PTRACE(0, "Released phantom deadlock in mutex " << *this); - m_excessiveLockActive = false; - } - + LockReleased(*this); m_lockerId = PNullThreadIdentifier; } void PTimedMutex::PrintOn(ostream &strm) const { - strm << this; + strm << "mutex " << this; PMutexExcessiveLockInfo::PrintOn(strm); } @@ -3247,7 +3266,6 @@ { nest.m_waiting = true; -#if PTRACING if (sync.Wait(m_excessiveLockTimeout)) { nest.m_waiting = false; return; @@ -3261,9 +3279,10 @@ nestedThreadsToDump = m_nestedThreads; } +#if PTRACING { ostream & trace = PTRACE_BEGIN(0, "PTLib"); - trace << "Possible deadlock in read/write mutex " << *this << " :\n"; + trace << "Assertion fail: Possible deadlock in " << *this << " :\n"; for (NestMap::const_iterator it = nestedThreadsToDump.begin(); it != nestedThreadsToDump.end(); ++it) { if (it != nestedThreadsToDump.begin()) trace << '\n'; @@ -3278,14 +3297,12 @@ } trace << PTrace::End; } - - sync.Wait(); - - PTRACE_BEGIN(0, "PTLib") << "Phantom deadlock in read/write mutex " << *this << PTrace::End; #else - sync.Wait(); + PAssertAlways(PSTRSTRM("Possible deadlock in " << *this)); #endif + sync.Wait(); + ExcessiveLockPhantom(*this); nest.m_waiting = false; } @@ -3312,10 +3329,7 @@ if (nest->m_readerCount > 0 || nest->m_writerCount > 0) return; - if (m_excessiveLockActive) { - PTRACE(0, "Released phantom deadlock in read/write mutex " << *this); - m_excessiveLockActive = false; - } + LockReleased(*this); // Do text book read lock InternalEndRead(*nest); @@ -3340,10 +3354,7 @@ if (nest.m_writerCount > 1) return; - if (m_excessiveLockActive) { - PTRACE(0, "Released phantom deadlock in read/write mutex " << *this); - m_excessiveLockActive = false; - } + LockReleased(*this); // If have a read lock already in this thread then do the "real" unlock code // but do not change the lock count, calls to EndRead() will now just @@ -3478,7 +3489,7 @@ void PReadWriteMutex::PrintOn(ostream & strm) const { - strm << this; + strm << "read/write mutex " << this; PMutexExcessiveLockInfo::PrintOn(strm); } Modified: ptlib/trunk/src/ptlib/msos/win32.cxx =================================================================== --- ptlib/trunk/src/ptlib/msos/win32.cxx 2016-03-04 13:44:21 UTC (rev 34657) +++ ptlib/trunk/src/ptlib/msos/win32.cxx 2016-03-07 13:09:23 UTC (rev 34658) @@ -1769,7 +1769,7 @@ if (!m_handle.Wait(m_excessiveLockTimeout)) { ExcessiveLockWait(); m_handle.Wait(INFINITE); - PTRACE(0, "PTLib", "Phantom deadlock in mutex " << *this); + ExcessiveLockPhantom(*this); } if (m_lockCount++ == 0) Modified: ptlib/trunk/src/ptlib/unix/tlibthrd.cxx =================================================================== --- ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2016-03-04 13:44:21 UTC (rev 34657) +++ ptlib/trunk/src/ptlib/unix/tlibthrd.cxx 2016-03-07 13:09:23 UTC (rev 34658) @@ -1313,9 +1313,7 @@ else { ExcessiveLockWait(); PAssertPTHREAD(pthread_mutex_lock, (&m_mutex)); -#if PTRACING - PTRACE_BEGIN(0, "PTLib") << "Phantom deadlock in mutex " << *this << PTrace::End; -#endif + ExcessiveLockPhantom(*this); } PPROFILE_POST_SYSTEM(); #else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-04 13:44:24
|
Revision: 34657 http://sourceforge.net/p/opalvoip/code/34657 Author: rjongbloed Date: 2016-03-04 13:44:21 +0000 (Fri, 04 Mar 2016) Log Message: ----------- Fixed issue where PTimedMutex::ExcessiveLockWaitTime is not guaranteed to be initialised yet. 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-03-03 19:14:48 UTC (rev 34656) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-03-04 13:44:21 UTC (rev 34657) @@ -2927,22 +2927,23 @@ #endif -static unsigned InitExcessiveLockWaitTime() -{ - const char * env = getenv("PTLIB_DEADLOCK_TIME"); - int seconds = env != NULL ? atoi(env) : 0; - return seconds > 0 ? seconds : 15; -} +unsigned PTimedMutex::ExcessiveLockWaitTime; -unsigned PTimedMutex::ExcessiveLockWaitTime = InitExcessiveLockWaitTime()*1000; - PMutexExcessiveLockInfo::PMutexExcessiveLockInfo(const char * name, unsigned line, unsigned timeout) : m_fileOrName(name) , m_fileLine(line) - , m_excessiveLockTimeout(timeout > 0 ? timeout : PTimedMutex::ExcessiveLockWaitTime) + , m_excessiveLockTimeout(timeout) , m_excessiveLockActive(false) { + if (m_excessiveLockTimeout == 0) { + if (PTimedMutex::ExcessiveLockWaitTime == 0) { + const char * env = getenv("PTLIB_DEADLOCK_TIME"); + int seconds = env != NULL ? atoi(env) : 0; + PTimedMutex::ExcessiveLockWaitTime = seconds > 0 ? seconds*1000 : 15000; + } + m_excessiveLockTimeout = PTimedMutex::ExcessiveLockWaitTime; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-03 19:14:50
|
Revision: 34656 http://sourceforge.net/p/opalvoip/code/34656 Author: rjongbloed Date: 2016-03-03 19:14:48 +0000 (Thu, 03 Mar 2016) Log Message: ----------- Improved the temporal spatial trade off for VP8, but the vpx rc_dropframe_thresh does not seem to actually work, which makes it pointless. Modified Paths: -------------- opal/trunk/plugins/video/VP8-WebM/vp8_webm.cxx Modified: opal/trunk/plugins/video/VP8-WebM/vp8_webm.cxx =================================================================== --- opal/trunk/plugins/video/VP8-WebM/vp8_webm.cxx 2016-03-02 11:32:21 UTC (rev 34655) +++ opal/trunk/plugins/video/VP8-WebM/vp8_webm.cxx 2016-03-03 19:14:48 UTC (rev 34656) @@ -408,6 +408,8 @@ protected: vpx_codec_enc_cfg_t m_config; unsigned m_initFlags; + unsigned m_maxQ; + unsigned m_rateControlPeriod; vpx_codec_ctx_t m_codec; vpx_codec_iter_t m_iterator; const vpx_codec_cx_pkt_t * m_packet; @@ -419,6 +421,8 @@ VP8Encoder(const PluginCodec_Definition * defn) : BaseClass(defn) , m_initFlags(0) + , m_maxQ(31) + , m_rateControlPeriod(1000) , m_iterator(NULL) , m_packet(NULL) , m_offset(0) @@ -439,6 +443,7 @@ return false; m_maxBitRate = m_config.rc_target_bitrate*1000; + m_maxQ = m_config.rc_max_quantizer; m_config.g_w = 0; // Forces OnChangedOptions to initialise encoder m_config.g_h = 0; @@ -459,6 +464,9 @@ virtual bool SetOption(const char * optionName, const char * optionValue) { + if (strcasecmp(optionName, PLUGINCODEC_OPTION_RATE_CONTROL_PERIOD) == 0) + return SetOptionUnsigned(m_rateControlPeriod, optionValue, 100, 60000); + if (strcasecmp(optionName, SpatialResampling.m_name) == 0) return SetOptionBoolean(m_config.rc_resize_allowed, optionValue); @@ -485,12 +493,30 @@ } m_config.rc_target_bitrate = m_maxBitRate/1000; + m_config.rc_buf_sz = m_rateControlPeriod; + m_config.rc_buf_optimal_sz = m_rateControlPeriod*4/5; // Take simple temporal/spatial trade off and set multiple variables - m_config.rc_dropframe_thresh = (31-m_tsto)*2; // m_tsto==31 is maintain frame rate, so threshold is zero - m_config.rc_resize_allowed = m_tsto < 16; - m_config.rc_max_quantizer = 32 + m_tsto; + m_config.rc_resize_allowed = m_tsto > 29; + if (m_tsto < 31) { + m_config.rc_dropframe_thresh = 60 + m_tsto; // Range from 60% to 90% + m_config.rc_max_quantizer = m_maxQ*m_tsto/31; + } + else { + m_config.rc_dropframe_thresh = 0; // m_tsto==31 is maintain frame rate, so threshold is zero + m_config.rc_max_quantizer = m_maxQ; // Allow Q to get as bad as it can get + } + PTRACE(4, MY_CODEC_LOG, "Config: " << m_width << 'x' << m_height << "," + " rc_target_bitrate=" << m_config.rc_target_bitrate << "," + " kf_dist=" << m_config.kf_min_dist << '-' << m_config.kf_max_dist << "," + " rc_dropframe_thresh=" << m_config.rc_dropframe_thresh << "," + " rc_resize_allowed=" << m_config.rc_resize_allowed << "," + " rc_max_quantizer=" << m_config.rc_max_quantizer << "," + " rc_buf_sz=" << m_config.rc_buf_sz << "," + " rc_buf_optimal_sz=" << m_config.rc_buf_optimal_sz << "," + " rc_undershoot_pct=" << m_config.rc_undershoot_pct); + if (m_config.g_w == m_width && m_config.g_h == m_height) return !IS_ERROR(vpx_codec_enc_config_set, (&m_codec, &m_config)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-02 11:32:23
|
Revision: 34655 http://sourceforge.net/p/opalvoip/code/34655 Author: rjongbloed Date: 2016-03-02 11:32:21 +0000 (Wed, 02 Mar 2016) Log Message: ----------- Remove old workaround for GCC pthreads "bug", is compensated for elsewhere and clearing external threads arbitrarily (with thread still running) is profoundly dangerous to the thread local storage code. 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-03-01 20:02:54 UTC (rev 34654) +++ ptlib/trunk/src/ptlib/common/osutils.cxx 2016-03-02 11:32:21 UTC (rev 34655) @@ -2215,17 +2215,12 @@ cleanExternalThreads = CleanExternalThreadsTime; if (!m_externalThreads.IsEmpty()) { m_threadMutex.Wait(); -#ifdef __GLIBC__ - // Cannot rely on IsTerminated() not crashing in GLIBC due to a dickhead developer there - m_externalThreads.RemoveAll(); -#else for (ThreadList::iterator it = m_externalThreads.begin(); it != m_externalThreads.end();) { if (it->IsTerminated()) m_externalThreads.erase(it++); else ++it; } -#endif m_threadMutex.Signal(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-01 20:02:57
|
Revision: 34654 http://sourceforge.net/p/opalvoip/code/34654 Author: rjongbloed Date: 2016-03-01 20:02:54 +0000 (Tue, 01 Mar 2016) Log Message: ----------- Allow override of version number during configure, part 2 Modified Paths: -------------- opal/trunk/configure opal/trunk/make/my_macros.m4 opal/trunk/plugins/configure Modified: opal/trunk/configure =================================================================== --- opal/trunk/configure 2016-03-01 20:02:00 UTC (rev 34653) +++ opal/trunk/configure 2016-03-01 20:02:54 UTC (rev 34654) @@ -6536,22 +6536,22 @@ if ${OPAL_MAJOR+:} false; then : - major=$OPAL[_MAJOR] + major=${OPAL_MAJOR} else major=`cat $VERSION_DIR/version.h | grep MAJOR_VERSION | cut -f3 -d' '` fi if ${OPAL_MINOR+:} false; then : - minor=$OPAL[_MINOR] + minor=${OPAL_MINOR} else minor=`cat $VERSION_DIR/version.h | grep MINOR_VERSION | cut -f3 -d' '` fi if ${OPAL_BUILD+:} false; then : - build=$OPAL[_BUILD] + build=${OPAL_BUILD} else build=`cat $VERSION_DIR/version.h | grep BUILD_NUMBER | cut -f3 -d' '` fi if ${OPAL_STAGE+:} false; then : - stage=$OPAL[_STAGE] + stage=${OPAL_STAGE} else stage=`cat $VERSION_DIR/version.h | grep BUILD_TYPE | cut -f 3 -d ' ' | sed 's/BetaCode/-beta/' | sed 's/AlphaCode/-alpha/' | sed 's/ReleaseCode/\./'` fi Modified: opal/trunk/make/my_macros.m4 =================================================================== --- opal/trunk/make/my_macros.m4 2016-03-01 20:02:00 UTC (rev 34653) +++ opal/trunk/make/my_macros.m4 2016-03-01 20:02:54 UTC (rev 34654) @@ -302,10 +302,10 @@ dnl $1 file location dnl $2 variable prefix AC_DEFUN([MY_VERSION_FILE],[ - AS_VAR_SET_IF([$2[_MAJOR]],[major=$[$2[_MAJOR]]],[major=`cat $1 | grep MAJOR_VERSION | cut -f3 -d' '`]) - AS_VAR_SET_IF([$2[_MINOR]],[minor=$[$2[_MINOR]]],[minor=`cat $1 | grep MINOR_VERSION | cut -f3 -d' '`]) - AS_VAR_SET_IF([$2[_BUILD]],[build=$[$2[_BUILD]]],[build=`cat $1 | grep BUILD_NUMBER | cut -f3 -d' '`]) - AS_VAR_SET_IF([$2[_STAGE]],[stage=$[$2[_STAGE]]],[stage=`cat $1 | grep BUILD_TYPE | cut -f 3 -d ' ' | sed 's/BetaCode/-beta/' | sed 's/AlphaCode/-alpha/' | sed 's/ReleaseCode/\./'`]) + AS_VAR_SET_IF([$2[_MAJOR]],[major=${$2[_MAJOR]}],[major=`cat $1 | grep MAJOR_VERSION | cut -f3 -d' '`]) + AS_VAR_SET_IF([$2[_MINOR]],[minor=${$2[_MINOR]}],[minor=`cat $1 | grep MINOR_VERSION | cut -f3 -d' '`]) + AS_VAR_SET_IF([$2[_BUILD]],[build=${$2[_BUILD]}],[build=`cat $1 | grep BUILD_NUMBER | cut -f3 -d' '`]) + AS_VAR_SET_IF([$2[_STAGE]],[stage=${$2[_STAGE]}],[stage=`cat $1 | grep BUILD_TYPE | cut -f 3 -d ' ' | sed 's/BetaCode/-beta/' | sed 's/AlphaCode/-alpha/' | sed 's/ReleaseCode/\./'`]) version="${major}.${minor}.${build}" AS_IF([test -z "$major" -o -z "$minor" -o -z "$build"], AC_MSG_ERROR(Could not determine version number from $1)) Modified: opal/trunk/plugins/configure =================================================================== --- opal/trunk/plugins/configure 2016-03-01 20:02:00 UTC (rev 34653) +++ opal/trunk/plugins/configure 2016-03-01 20:02:54 UTC (rev 34654) @@ -6885,22 +6885,22 @@ if ${OPAL_MAJOR+:} false; then : - major=$OPAL[_MAJOR] + major=${OPAL_MAJOR} else major=`cat $VERSION_DIR/version.h | grep MAJOR_VERSION | cut -f3 -d' '` fi if ${OPAL_MINOR+:} false; then : - minor=$OPAL[_MINOR] + minor=${OPAL_MINOR} else minor=`cat $VERSION_DIR/version.h | grep MINOR_VERSION | cut -f3 -d' '` fi if ${OPAL_BUILD+:} false; then : - build=$OPAL[_BUILD] + build=${OPAL_BUILD} else build=`cat $VERSION_DIR/version.h | grep BUILD_NUMBER | cut -f3 -d' '` fi if ${OPAL_STAGE+:} false; then : - stage=$OPAL[_STAGE] + stage=${OPAL_STAGE} else stage=`cat $VERSION_DIR/version.h | grep BUILD_TYPE | cut -f 3 -d ' ' | sed 's/BetaCode/-beta/' | sed 's/AlphaCode/-alpha/' | sed 's/ReleaseCode/\./'` fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-01 20:02:03
|
Revision: 34653 http://sourceforge.net/p/opalvoip/code/34653 Author: rjongbloed Date: 2016-03-01 20:02:00 +0000 (Tue, 01 Mar 2016) Log Message: ----------- Allow override of version number during configure, part 2 Modified Paths: -------------- ptlib/trunk/configure ptlib/trunk/make/my_macros.m4 Modified: ptlib/trunk/configure =================================================================== --- ptlib/trunk/configure 2016-03-01 19:48:03 UTC (rev 34652) +++ ptlib/trunk/configure 2016-03-01 20:02:00 UTC (rev 34653) @@ -7274,22 +7274,22 @@ if ${PTLIB_MAJOR+:} false; then : - major=$PTLIB[_MAJOR] + major=${PTLIB_MAJOR} else major=`cat $VERSION_DIR/version.h | grep MAJOR_VERSION | cut -f3 -d' '` fi if ${PTLIB_MINOR+:} false; then : - minor=$PTLIB[_MINOR] + minor=${PTLIB_MINOR} else minor=`cat $VERSION_DIR/version.h | grep MINOR_VERSION | cut -f3 -d' '` fi if ${PTLIB_BUILD+:} false; then : - build=$PTLIB[_BUILD] + build=${PTLIB_BUILD} else build=`cat $VERSION_DIR/version.h | grep BUILD_NUMBER | cut -f3 -d' '` fi if ${PTLIB_STAGE+:} false; then : - stage=$PTLIB[_STAGE] + stage=${PTLIB_STAGE} else stage=`cat $VERSION_DIR/version.h | grep BUILD_TYPE | cut -f 3 -d ' ' | sed 's/BetaCode/-beta/' | sed 's/AlphaCode/-alpha/' | sed 's/ReleaseCode/\./'` fi Modified: ptlib/trunk/make/my_macros.m4 =================================================================== --- ptlib/trunk/make/my_macros.m4 2016-03-01 19:48:03 UTC (rev 34652) +++ ptlib/trunk/make/my_macros.m4 2016-03-01 20:02:00 UTC (rev 34653) @@ -302,10 +302,10 @@ dnl $1 file location dnl $2 variable prefix AC_DEFUN([MY_VERSION_FILE],[ - AS_VAR_SET_IF([$2[_MAJOR]],[major=$[$2[_MAJOR]]],[major=`cat $1 | grep MAJOR_VERSION | cut -f3 -d' '`]) - AS_VAR_SET_IF([$2[_MINOR]],[minor=$[$2[_MINOR]]],[minor=`cat $1 | grep MINOR_VERSION | cut -f3 -d' '`]) - AS_VAR_SET_IF([$2[_BUILD]],[build=$[$2[_BUILD]]],[build=`cat $1 | grep BUILD_NUMBER | cut -f3 -d' '`]) - AS_VAR_SET_IF([$2[_STAGE]],[stage=$[$2[_STAGE]]],[stage=`cat $1 | grep BUILD_TYPE | cut -f 3 -d ' ' | sed 's/BetaCode/-beta/' | sed 's/AlphaCode/-alpha/' | sed 's/ReleaseCode/\./'`]) + AS_VAR_SET_IF([$2[_MAJOR]],[major=${$2[_MAJOR]}],[major=`cat $1 | grep MAJOR_VERSION | cut -f3 -d' '`]) + AS_VAR_SET_IF([$2[_MINOR]],[minor=${$2[_MINOR]}],[minor=`cat $1 | grep MINOR_VERSION | cut -f3 -d' '`]) + AS_VAR_SET_IF([$2[_BUILD]],[build=${$2[_BUILD]}],[build=`cat $1 | grep BUILD_NUMBER | cut -f3 -d' '`]) + AS_VAR_SET_IF([$2[_STAGE]],[stage=${$2[_STAGE]}],[stage=`cat $1 | grep BUILD_TYPE | cut -f 3 -d ' ' | sed 's/BetaCode/-beta/' | sed 's/AlphaCode/-alpha/' | sed 's/ReleaseCode/\./'`]) version="${major}.${minor}.${build}" AS_IF([test -z "$major" -o -z "$minor" -o -z "$build"], AC_MSG_ERROR(Could not determine version number from $1)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rjo...@us...> - 2016-03-01 19:48:06
|
Revision: 34652 http://sourceforge.net/p/opalvoip/code/34652 Author: rjongbloed Date: 2016-03-01 19:48:03 +0000 (Tue, 01 Mar 2016) Log Message: ----------- Allow override of version number during configure Modified Paths: -------------- opal/trunk/configure opal/trunk/make/my_macros.m4 opal/trunk/plugins/configure Modified: opal/trunk/configure =================================================================== --- opal/trunk/configure 2016-03-01 19:45:51 UTC (rev 34651) +++ opal/trunk/configure 2016-03-01 19:48:03 UTC (rev 34652) @@ -6535,10 +6535,26 @@ - major=`cat $VERSION_DIR/version.h | grep MAJOR_VERSION | cut -f3 -d' '` - minor=`cat $VERSION_DIR/version.h | grep MINOR_VERSION | cut -f3 -d' '` - build=`cat $VERSION_DIR/version.h | grep BUILD_NUMBER | cut -f3 -d' '` - stage=`cat $VERSION_DIR/version.h | grep BUILD_TYPE | cut -f 3 -d ' ' | sed 's/BetaCode/-beta/' | sed 's/AlphaCode/-alpha/' | sed 's/ReleaseCode/\./'` + if ${OPAL_MAJOR+:} false; then : + major=$OPAL[_MAJOR] +else + major=`cat $VERSION_DIR/version.h | grep MAJOR_VERSION | cut -f3 -d' '` +fi + if ${OPAL_MINOR+:} false; then : + minor=$OPAL[_MINOR] +else + minor=`cat $VERSION_DIR/version.h | grep MINOR_VERSION | cut -f3 -d' '` +fi + if ${OPAL_BUILD+:} false; then : + build=$OPAL[_BUILD] +else + build=`cat $VERSION_DIR/version.h | grep BUILD_NUMBER | cut -f3 -d' '` +fi + if ${OPAL_STAGE+:} false; then : + stage=$OPAL[_STAGE] +else + stage=`cat $VERSION_DIR/version.h | grep BUILD_TYPE | cut -f 3 -d ' ' | sed 's/BetaCode/-beta/' | sed 's/AlphaCode/-alpha/' | sed 's/ReleaseCode/\./'` +fi version="${major}.${minor}.${build}" if test -z "$major" -o -z "$minor" -o -z "$build"; then : @@ -6553,7 +6569,7 @@ OPAL_STAGE=$stage - OPAL_VERSION="${major}.${minor}.${build}" + OPAL_VERSION="${version}" Modified: opal/trunk/make/my_macros.m4 =================================================================== --- opal/trunk/make/my_macros.m4 2016-03-01 19:45:51 UTC (rev 34651) +++ opal/trunk/make/my_macros.m4 2016-03-01 19:48:03 UTC (rev 34652) @@ -302,10 +302,10 @@ dnl $1 file location dnl $2 variable prefix AC_DEFUN([MY_VERSION_FILE],[ - major=`cat $1 | grep MAJOR_VERSION | cut -f3 -d' '` - minor=`cat $1 | grep MINOR_VERSION | cut -f3 -d' '` - build=`cat $1 | grep BUILD_NUMBER | cut -f3 -d' '` - stage=`cat $1 | grep BUILD_TYPE | cut -f 3 -d ' ' | sed 's/BetaCode/-beta/' | sed 's/AlphaCode/-alpha/' | sed 's/ReleaseCode/\./'` + AS_VAR_SET_IF([$2[_MAJOR]],[major=$[$2[_MAJOR]]],[major=`cat $1 | grep MAJOR_VERSION | cut -f3 -d' '`]) + AS_VAR_SET_IF([$2[_MINOR]],[minor=$[$2[_MINOR]]],[minor=`cat $1 | grep MINOR_VERSION | cut -f3 -d' '`]) + AS_VAR_SET_IF([$2[_BUILD]],[build=$[$2[_BUILD]]],[build=`cat $1 | grep BUILD_NUMBER | cut -f3 -d' '`]) + AS_VAR_SET_IF([$2[_STAGE]],[stage=$[$2[_STAGE]]],[stage=`cat $1 | grep BUILD_TYPE | cut -f 3 -d ' ' | sed 's/BetaCode/-beta/' | sed 's/AlphaCode/-alpha/' | sed 's/ReleaseCode/\./'`]) version="${major}.${minor}.${build}" AS_IF([test -z "$major" -o -z "$minor" -o -z "$build"], AC_MSG_ERROR(Could not determine version number from $1)) @@ -314,7 +314,7 @@ AC_SUBST($2[_MINOR], $minor) AC_SUBST($2[_BUILD], $build) AC_SUBST($2[_STAGE], $stage) - AC_SUBST($2[_VERSION], "${major}.${minor}.${build}") + AC_SUBST($2[_VERSION], "${version}") AC_DEFINE_UNQUOTED([$2[_MAJOR]], [${major}], [Major version]) AC_DEFINE_UNQUOTED([$2[_MINOR]], [${minor}], [Minor version]) Modified: opal/trunk/plugins/configure =================================================================== --- opal/trunk/plugins/configure 2016-03-01 19:45:51 UTC (rev 34651) +++ opal/trunk/plugins/configure 2016-03-01 19:48:03 UTC (rev 34652) @@ -6884,10 +6884,26 @@ - major=`cat $VERSION_DIR/version.h | grep MAJOR_VERSION | cut -f3 -d' '` - minor=`cat $VERSION_DIR/version.h | grep MINOR_VERSION | cut -f3 -d' '` - build=`cat $VERSION_DIR/version.h | grep BUILD_NUMBER | cut -f3 -d' '` - stage=`cat $VERSION_DIR/version.h | grep BUILD_TYPE | cut -f 3 -d ' ' | sed 's/BetaCode/-beta/' | sed 's/AlphaCode/-alpha/' | sed 's/ReleaseCode/\./'` + if ${OPAL_MAJOR+:} false; then : + major=$OPAL[_MAJOR] +else + major=`cat $VERSION_DIR/version.h | grep MAJOR_VERSION | cut -f3 -d' '` +fi + if ${OPAL_MINOR+:} false; then : + minor=$OPAL[_MINOR] +else + minor=`cat $VERSION_DIR/version.h | grep MINOR_VERSION | cut -f3 -d' '` +fi + if ${OPAL_BUILD+:} false; then : + build=$OPAL[_BUILD] +else + build=`cat $VERSION_DIR/version.h | grep BUILD_NUMBER | cut -f3 -d' '` +fi + if ${OPAL_STAGE+:} false; then : + stage=$OPAL[_STAGE] +else + stage=`cat $VERSION_DIR/version.h | grep BUILD_TYPE | cut -f 3 -d ' ' | sed 's/BetaCode/-beta/' | sed 's/AlphaCode/-alpha/' | sed 's/ReleaseCode/\./'` +fi version="${major}.${minor}.${build}" if test -z "$major" -o -z "$minor" -o -z "$build"; then : @@ -6902,7 +6918,7 @@ OPAL_STAGE=$stage - OPAL_VERSION="${major}.${minor}.${build}" + OPAL_VERSION="${version}" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |