update to jrtp 3.5.2 and jthread 1.2.0

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@954 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2006-03-28 15:58:06 +00:00
parent ee0dd13ca7
commit 2f322f615f
45 changed files with 1076 additions and 939 deletions

View File

@ -1,10 +1,35 @@
January 19, 2006
March 26, 2006
JRTPLIB ChangeLog
-----------
3.5.2 (March 2006)
* Fixed bug in the random number functions which are used with
MS Visual Studio 2005. Thanks to Jun Ohasi (jun@jnb.odn.ne.jp)
for bringing the incorrect use of rand_s to my attention.
* Changed types like u_int32_t to types like uint32_t in the
documentation.
3.5.1 (March 2006)
* Fixed bug in RTCP scheduler. Due to -= operation on an RTPTime
instance, an incredibly large scheduling interval could be
calculated.
3.5.0 (March 2006)
* Now, the define RTP_SNPRINTF is used instead of snprintf,
_snprintf or _snprintf_s.
* In the RTPSources member function MultipleTimeouts, I neglected
to call the OnRemoveSource virtual function. Thanks to Adam Love
(alove@exceptionalinnovation.com) for bringing this to my attention.
* Added a OnSendRTCPCompoundPacket member function to the RTPSession
class. Useful for inspecting outgoing data.
* Modified the templates somewhat. Should cause less compiler problems
this way. Thanks tot Chris Hamilton (chamilton@cs.dal.ca) for
providing this solution.
* On Win32, if possible the functions rand_s and srand_s are now used.
3.4.0 (January 2006)
* Changed u_int32_t like types to uint32_t like types. Thanks to
Panagiotis Issaris (takis.issaris@uhasselt.be) for informing me

View File

@ -1,8 +1,8 @@
------------------------------------------------------------------------------
January 19, 2006
March 26, 2006
JRTPLIB (v3.4.0)
JRTPLIB (v3.5.2)
Developed at the The Expertise Centre for
@ -15,6 +15,7 @@
LIBRARY LOCATION AND CONTACT
============================
Normally, you should be able to download the latest version of the library
from this url:
http://research.edm.uhasselt.be/jori/jrtplib/jrtplib.html
@ -29,6 +30,7 @@ instructions.
ACKNOWLEDGMENT
==============
I would like thank the people at the Expertise Centre for Digital Media
for giving me the opportunity to create this rewrite of the library.
@ -104,9 +106,6 @@ INSTALLATION NOTES
Enables support for JThread.
- RTP_SUPPORT_SDESPRIV:
Enables support for RTCP SDES private items.
- RTP_SUPPORT_INLINETEMPLATEPARAM:
If set, the compiler should be able to handle an inline
function as a template parameter.
- RTP_SUPPORT_PROBATION:
If set, a few consecutive RTP packets are needed to validate
a member.

View File

@ -1804,7 +1804,7 @@ fi
# Define the identity of the package.
PACKAGE=jrtplib
VERSION=3.4.0
VERSION=3.5.2
cat >>confdefs.h <<_ACEOF
@ -1944,7 +1944,6 @@ RTP_SUPPORT_IPV4MULTICAST="// No IPv4 multicasting support"
RTP_SUPPORT_IPV6MULTICAST="// No IPv6 multicasting support"
RTP_SUPPORT_THREAD="// No support for jthread"
RTP_SUPPORT_SDESPRIV="// No support for SDES PRIV items"
RTP_SUPPORT_INLINETEMPLATEPARAM="// Compiler doesn't support inline functions as template parameter"
RTP_SUPPORT_PROBATION="// Do not wait for a number of consecutive packets to validate source"
RTP_SUPPORT_GNUDRAND="// Not using drand48_r and srand48_r"
RTP_SUPPORT_RANDR="// Not using rand_r"
@ -20546,62 +20545,6 @@ fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: checking if compiler supports an inline function as a template argument" >&5
echo $ECHO_N "checking if compiler supports an inline function as a template argument... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include "src/rtphashtable.h"
inline int GetIndex(const int &elem) { return elem%10; }
int
main ()
{
RTPHashTable<int,GetIndex,10> table;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
RTP_SUPPORT_INLINETEMPLATEPARAM="#define RTP_SUPPORT_INLINETEMPLATEPARAM"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: checking if types like uint32_t exist" >&5
echo $ECHO_N "checking if types like uint32_t exist... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF

View File

@ -1,5 +1,5 @@
AC_INIT(configure.in)
AM_INIT_AUTOMAKE(jrtplib,3.4.0)
AM_INIT_AUTOMAKE(jrtplib,3.5.2)
RTP_FILIO="// Don't have <sys/filio.h>"
RTP_SOCKIO="// Don't have <sys/sockio.h>"
@ -10,7 +10,6 @@ RTP_SUPPORT_IPV4MULTICAST="// No IPv4 multicasting support"
RTP_SUPPORT_IPV6MULTICAST="// No IPv6 multicasting support"
RTP_SUPPORT_THREAD="// No support for jthread"
RTP_SUPPORT_SDESPRIV="// No support for SDES PRIV items"
RTP_SUPPORT_INLINETEMPLATEPARAM="// Compiler doesn't support inline functions as template parameter"
RTP_SUPPORT_PROBATION="// Do not wait for a number of consecutive packets to validate source"
RTP_SUPPORT_GNUDRAND="// Not using drand48_r and srand48_r"
RTP_SUPPORT_RANDR="// Not using rand_r"
@ -201,21 +200,7 @@ AC_TRY_COMPILE([
])
dnl ---------------------------------------------------------------------------
dnl Check if compiler can handle inline function in template argument
dnl ---------------------------------------------------------------------------
AC_MSG_CHECKING(if compiler supports an inline function as a template argument)
AC_TRY_COMPILE([
#include "src/rtphashtable.h"
inline int GetIndex(const int &elem) { return elem%10; }],[
RTPHashTable<int,GetIndex,10> table; ],
[AC_MSG_RESULT(yes)
RTP_SUPPORT_INLINETEMPLATEPARAM="#define RTP_SUPPORT_INLINETEMPLATEPARAM"],
AC_MSG_RESULT(no)
)
dnl ---------------------------------------------------------------------------
dnl Check for u_int32_t etc
dnl Check for uint32_t etc
dnl ---------------------------------------------------------------------------
AC_MSG_CHECKING(if types like uint32_t exist)

File diff suppressed because it is too large Load Diff

View File

@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\jthread-1.1.2\src" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\jthread-1.2.0\src" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x813 /d "NDEBUG"
# ADD RSC /l 0x813 /d "NDEBUG"
BSC32=bscmake.exe
@ -64,7 +64,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\jthread-1.1.2\src" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\jthread-1.2.0\src" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x813 /d "_DEBUG"
# ADD RSC /l 0x813 /d "_DEBUG"
BSC32=bscmake.exe

View File

@ -1,482 +1,481 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="jrtplib_wce"
ProjectGUID="{93374307-119F-404E-9B09-3642C6FC96C1}"
Keyword="Win32Proj"
SignManifests="true"
>
<Platforms>
<Platform
Name="Pocket PC 2003 (ARMV4)"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Pocket PC 2003 (ARMV4)"
OutputDirectory="$(PlatformName)\Debug"
IntermediateDirectory="$(PlatformName)\Debug"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="0"
AdditionalIncludeDirectories="../jthread-1.1.2/src"
PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
MinimalRebuild="true"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM"
OutputFile="$(OutDir)/jrtplib_wce.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Release|Pocket PC 2003 (ARMV4)"
OutputDirectory="$(PlatformName)\Release"
IntermediateDirectory="$(PlatformName)\Release"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="2"
AdditionalIncludeDirectories="../jthread-1.1.2/src"
PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM"
OutputFile="$(OutDir)/jrtplib_wce.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\src\rtcpapppacket.cpp"
>
</File>
<File
RelativePath=".\src\rtcpbyepacket.cpp"
>
</File>
<File
RelativePath=".\src\rtcpcompoundpacket.cpp"
>
</File>
<File
RelativePath=".\src\rtcpcompoundpacketbuilder.cpp"
>
</File>
<File
RelativePath=".\src\rtcppacket.cpp"
>
</File>
<File
RelativePath=".\src\rtcppacketbuilder.cpp"
>
</File>
<File
RelativePath=".\src\rtcprrpacket.cpp"
>
</File>
<File
RelativePath=".\src\rtcpscheduler.cpp"
>
</File>
<File
RelativePath=".\src\rtcpsdesinfo.cpp"
>
</File>
<File
RelativePath=".\src\rtcpsdespacket.cpp"
>
</File>
<File
RelativePath=".\src\rtcpsrpacket.cpp"
>
</File>
<File
RelativePath=".\src\rtpcollisionlist.cpp"
>
</File>
<File
RelativePath=".\src\rtpdebug.cpp"
>
</File>
<File
RelativePath=".\src\rtperrors.cpp"
>
</File>
<File
RelativePath=".\src\rtpinternalsourcedata.cpp"
>
</File>
<File
RelativePath=".\src\rtpipv4address.cpp"
>
</File>
<File
RelativePath=".\src\rtpipv6address.cpp"
>
</File>
<File
RelativePath=".\src\rtplibraryversion.cpp"
>
</File>
<File
RelativePath=".\src\rtppacket.cpp"
>
</File>
<File
RelativePath=".\src\rtppacketbuilder.cpp"
>
</File>
<File
RelativePath=".\src\rtppollthread.cpp"
>
</File>
<File
RelativePath=".\src\rtprandom.cpp"
>
</File>
<File
RelativePath=".\src\rtpsession.cpp"
>
</File>
<File
RelativePath=".\src\rtpsessionparams.cpp"
>
</File>
<File
RelativePath=".\src\rtpsessionsources.cpp"
>
</File>
<File
RelativePath=".\src\rtpsourcedata.cpp"
>
</File>
<File
RelativePath=".\src\rtpsources.cpp"
>
</File>
<File
RelativePath=".\src\rtptimeutilities.cpp"
>
</File>
<File
RelativePath=".\src\rtpudpv4transmitter.cpp"
>
</File>
<File
RelativePath=".\src\rtpudpv6transmitter.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\src\rtcpapppacket.h"
>
</File>
<File
RelativePath=".\src\rtcpbyepacket.h"
>
</File>
<File
RelativePath=".\src\rtcpcompoundpacket.h"
>
</File>
<File
RelativePath=".\src\rtcpcompoundpacketbuilder.h"
>
</File>
<File
RelativePath=".\src\rtcppacket.h"
>
</File>
<File
RelativePath=".\src\rtcppacketbuilder.h"
>
</File>
<File
RelativePath=".\src\rtcprrpacket.h"
>
</File>
<File
RelativePath=".\src\rtcpscheduler.h"
>
</File>
<File
RelativePath=".\src\rtcpsdesinfo.h"
>
</File>
<File
RelativePath=".\src\rtcpsdespacket.h"
>
</File>
<File
RelativePath=".\src\rtcpsrpacket.h"
>
</File>
<File
RelativePath=".\src\rtcpunknownpacket.h"
>
</File>
<File
RelativePath=".\src\rtpaddress.h"
>
</File>
<File
RelativePath=".\src\rtpcollisionlist.h"
>
</File>
<File
RelativePath=".\src\rtpconfig.h"
>
</File>
<File
RelativePath=".\src\rtpconfig_win.h"
>
</File>
<File
RelativePath=".\src\rtpdebug.h"
>
</File>
<File
RelativePath=".\src\rtpdefines.h"
>
</File>
<File
RelativePath=".\src\rtperrors.h"
>
</File>
<File
RelativePath=".\src\rtphashtable.h"
>
</File>
<File
RelativePath=".\src\rtpinternalsourcedata.h"
>
</File>
<File
RelativePath=".\src\rtpipv4address.h"
>
</File>
<File
RelativePath=".\src\rtpipv4destination.h"
>
</File>
<File
RelativePath=".\src\rtpipv6address.h"
>
</File>
<File
RelativePath=".\src\rtpipv6destination.h"
>
</File>
<File
RelativePath=".\src\rtpkeyhashtable.h"
>
</File>
<File
RelativePath=".\src\rtplibraryversion.h"
>
</File>
<File
RelativePath=".\src\rtppacket.h"
>
</File>
<File
RelativePath=".\src\rtppacketbuilder.h"
>
</File>
<File
RelativePath=".\src\rtppollthread.h"
>
</File>
<File
RelativePath=".\src\rtprandom.h"
>
</File>
<File
RelativePath=".\src\rtprawpacket.h"
>
</File>
<File
RelativePath=".\src\rtpsession.h"
>
</File>
<File
RelativePath=".\src\rtpsessionparams.h"
>
</File>
<File
RelativePath=".\src\rtpsessionsources.h"
>
</File>
<File
RelativePath=".\src\rtpsourcedata.h"
>
</File>
<File
RelativePath=".\src\rtpsources.h"
>
</File>
<File
RelativePath=".\src\rtpstructs.h"
>
</File>
<File
RelativePath=".\src\rtptimeutilities.h"
>
</File>
<File
RelativePath=".\src\rtptransmitter.h"
>
</File>
<File
RelativePath=".\src\rtptypes.h"
>
</File>
<File
RelativePath=".\src\rtptypes_win.h"
>
</File>
<File
RelativePath=".\src\rtpudpv4transmitter.h"
>
</File>
<File
RelativePath=".\src\rtpudpv6transmitter.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="jrtplib_wce"
ProjectGUID="{93374307-119F-404E-9B09-3642C6FC96C1}"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Pocket PC 2003 (ARMV4)"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Pocket PC 2003 (ARMV4)"
OutputDirectory="$(PlatformName)\Debug"
IntermediateDirectory="$(PlatformName)\Debug"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="0"
AdditionalIncludeDirectories="../jthread-1.2.0/src"
PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
MinimalRebuild="true"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM"
OutputFile="$(OutDir)/jrtplib_wce.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Release|Pocket PC 2003 (ARMV4)"
OutputDirectory="$(PlatformName)\Release"
IntermediateDirectory="$(PlatformName)\Release"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="2"
AdditionalIncludeDirectories="../jthread-1.2.0/src"
PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM"
OutputFile="$(OutDir)/jrtplib_wce.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\src\rtcpapppacket.cpp"
>
</File>
<File
RelativePath=".\src\rtcpbyepacket.cpp"
>
</File>
<File
RelativePath=".\src\rtcpcompoundpacket.cpp"
>
</File>
<File
RelativePath=".\src\rtcpcompoundpacketbuilder.cpp"
>
</File>
<File
RelativePath=".\src\rtcppacket.cpp"
>
</File>
<File
RelativePath=".\src\rtcppacketbuilder.cpp"
>
</File>
<File
RelativePath=".\src\rtcprrpacket.cpp"
>
</File>
<File
RelativePath=".\src\rtcpscheduler.cpp"
>
</File>
<File
RelativePath=".\src\rtcpsdesinfo.cpp"
>
</File>
<File
RelativePath=".\src\rtcpsdespacket.cpp"
>
</File>
<File
RelativePath=".\src\rtcpsrpacket.cpp"
>
</File>
<File
RelativePath=".\src\rtpcollisionlist.cpp"
>
</File>
<File
RelativePath=".\src\rtpdebug.cpp"
>
</File>
<File
RelativePath=".\src\rtperrors.cpp"
>
</File>
<File
RelativePath=".\src\rtpinternalsourcedata.cpp"
>
</File>
<File
RelativePath=".\src\rtpipv4address.cpp"
>
</File>
<File
RelativePath=".\src\rtpipv6address.cpp"
>
</File>
<File
RelativePath=".\src\rtplibraryversion.cpp"
>
</File>
<File
RelativePath=".\src\rtppacket.cpp"
>
</File>
<File
RelativePath=".\src\rtppacketbuilder.cpp"
>
</File>
<File
RelativePath=".\src\rtppollthread.cpp"
>
</File>
<File
RelativePath=".\src\rtprandom.cpp"
>
</File>
<File
RelativePath=".\src\rtpsession.cpp"
>
</File>
<File
RelativePath=".\src\rtpsessionparams.cpp"
>
</File>
<File
RelativePath=".\src\rtpsessionsources.cpp"
>
</File>
<File
RelativePath=".\src\rtpsourcedata.cpp"
>
</File>
<File
RelativePath=".\src\rtpsources.cpp"
>
</File>
<File
RelativePath=".\src\rtptimeutilities.cpp"
>
</File>
<File
RelativePath=".\src\rtpudpv4transmitter.cpp"
>
</File>
<File
RelativePath=".\src\rtpudpv6transmitter.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\src\rtcpapppacket.h"
>
</File>
<File
RelativePath=".\src\rtcpbyepacket.h"
>
</File>
<File
RelativePath=".\src\rtcpcompoundpacket.h"
>
</File>
<File
RelativePath=".\src\rtcpcompoundpacketbuilder.h"
>
</File>
<File
RelativePath=".\src\rtcppacket.h"
>
</File>
<File
RelativePath=".\src\rtcppacketbuilder.h"
>
</File>
<File
RelativePath=".\src\rtcprrpacket.h"
>
</File>
<File
RelativePath=".\src\rtcpscheduler.h"
>
</File>
<File
RelativePath=".\src\rtcpsdesinfo.h"
>
</File>
<File
RelativePath=".\src\rtcpsdespacket.h"
>
</File>
<File
RelativePath=".\src\rtcpsrpacket.h"
>
</File>
<File
RelativePath=".\src\rtcpunknownpacket.h"
>
</File>
<File
RelativePath=".\src\rtpaddress.h"
>
</File>
<File
RelativePath=".\src\rtpcollisionlist.h"
>
</File>
<File
RelativePath=".\src\rtpconfig.h"
>
</File>
<File
RelativePath=".\src\rtpconfig_win.h"
>
</File>
<File
RelativePath=".\src\rtpdebug.h"
>
</File>
<File
RelativePath=".\src\rtpdefines.h"
>
</File>
<File
RelativePath=".\src\rtperrors.h"
>
</File>
<File
RelativePath=".\src\rtphashtable.h"
>
</File>
<File
RelativePath=".\src\rtpinternalsourcedata.h"
>
</File>
<File
RelativePath=".\src\rtpipv4address.h"
>
</File>
<File
RelativePath=".\src\rtpipv4destination.h"
>
</File>
<File
RelativePath=".\src\rtpipv6address.h"
>
</File>
<File
RelativePath=".\src\rtpipv6destination.h"
>
</File>
<File
RelativePath=".\src\rtpkeyhashtable.h"
>
</File>
<File
RelativePath=".\src\rtplibraryversion.h"
>
</File>
<File
RelativePath=".\src\rtppacket.h"
>
</File>
<File
RelativePath=".\src\rtppacketbuilder.h"
>
</File>
<File
RelativePath=".\src\rtppollthread.h"
>
</File>
<File
RelativePath=".\src\rtprandom.h"
>
</File>
<File
RelativePath=".\src\rtprawpacket.h"
>
</File>
<File
RelativePath=".\src\rtpsession.h"
>
</File>
<File
RelativePath=".\src\rtpsessionparams.h"
>
</File>
<File
RelativePath=".\src\rtpsessionsources.h"
>
</File>
<File
RelativePath=".\src\rtpsourcedata.h"
>
</File>
<File
RelativePath=".\src\rtpsources.h"
>
</File>
<File
RelativePath=".\src\rtpstructs.h"
>
</File>
<File
RelativePath=".\src\rtptimeutilities.h"
>
</File>
<File
RelativePath=".\src\rtptransmitter.h"
>
</File>
<File
RelativePath=".\src\rtptypes.h"
>
</File>
<File
RelativePath=".\src\rtptypes_win.h"
>
</File>
<File
RelativePath=".\src\rtpudpv4transmitter.h"
>
</File>
<File
RelativePath=".\src\rtpudpv6transmitter.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -16,7 +16,7 @@ libjrtp_la_SOURCES = rtpdebug.cpp rtpsession.cpp rtpconfig_win.h \
rtpudpv6transmitter.cpp rtptimeutilities.cpp \
extratransmitters/rtpfaketransmitter.cpp \
pthread/jmutex.cpp pthread/jthread.cpp
libjrtp_la_LDFLAGS = -release 3.4.0 @RTP_LINKLIBS@
libjrtp_la_LDFLAGS = -release 3.5.2 @RTP_LINKLIBS@
libjrtpinclude_HEADERS = rtcpapppacket.h rtcpbyepacket.h rtcpcompoundpacket.h \
rtcpcompoundpacketbuilder.h rtcppacket.h rtcppacketbuilder.h \
rtcprrpacket.h rtcpscheduler.h rtcpsdesinfo.h rtcpsdespacket.h \
@ -31,7 +31,7 @@ libjrtpinclude_HEADERS = rtcpapppacket.h rtcpbyepacket.h rtcpcompoundpacket.h \
rtpcollisionlist.h rtpipv6address.h rtpipv6destination.h \
rtpudpv6transmitter.h rtptypes.h rtptypes_unix.h \
extratransmitters/rtpfaketransmitter.h \
jmutex.h jthread.h jrtp4c.h
jmutex.h jthread.h jrtp4c.h jmutexautolock.h
EXTRA_DIST = rtpconfig_unix.h.in win32/jthread.cpp win32/jmutex.cpp
libjrtpincludedir = ${includedir}/jrtplib3

View File

@ -229,7 +229,7 @@ libjrtp_la_SOURCES = rtpdebug.cpp rtpsession.cpp rtpconfig_win.h \
extratransmitters/rtpfaketransmitter.cpp \
pthread/jmutex.cpp pthread/jthread.cpp
libjrtp_la_LDFLAGS = -release 3.4.0 @RTP_LINKLIBS@
libjrtp_la_LDFLAGS = -release 3.5.2 @RTP_LINKLIBS@
libjrtpinclude_HEADERS = rtcpapppacket.h rtcpbyepacket.h rtcpcompoundpacket.h \
rtcpcompoundpacketbuilder.h rtcppacket.h rtcppacketbuilder.h \
rtcprrpacket.h rtcpscheduler.h rtcpsdesinfo.h rtcpsdespacket.h \
@ -244,7 +244,7 @@ libjrtpinclude_HEADERS = rtcpapppacket.h rtcpbyepacket.h rtcpcompoundpacket.h \
rtpcollisionlist.h rtpipv6address.h rtpipv6destination.h \
rtpudpv6transmitter.h rtptypes.h rtptypes_unix.h \
extratransmitters/rtpfaketransmitter.h \
jmutex.h jthread.h jrtp4c.h
jmutex.h jthread.h jrtp4c.h jmutexautolock.h
EXTRA_DIST = rtpconfig_unix.h.in win32/jthread.cpp win32/jmutex.cpp
libjrtpincludedir = ${includedir}/jrtplib3

View File

@ -3,7 +3,7 @@
This file is a part of the JThread package, which contains some object-
oriented thread wrappers for different thread implementations.
Copyright (c) 2000-2005 Jori Liesenborgs (jori@lumumba.uhasselt.be)
Copyright (c) 2000-2006 Jori Liesenborgs (jori@lumumba.uhasselt.be)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@ -30,18 +30,19 @@
#define JMUTEX_H
#if (defined(WIN32) || defined(_WIN32_WCE))
#ifndef _WIN32_WCE
#include <process.h>
#endif // _WIN32_WCE
#include <winsock2.h>
#include <windows.h>
//#define JMUTEX_CRITICALSECTION
#else // using pthread
#include <pthread.h>
#endif // WIN32
#define ERR_JMUTEX_ALREADYINIT -1
#define ERR_JMUTEX_NOTINIT -2
#define ERR_JMUTEX_NOTINIT -2
#define ERR_JMUTEX_CANTCREATEMUTEX -3
class JMutex
@ -55,7 +56,11 @@ public:
bool IsInitialized() { return initialized; }
private:
#if (defined(WIN32) || defined(_WIN32_WCE))
#ifdef JMUTEX_CRITICALSECTION
CRITICAL_SECTION mutex;
#else // Use standard mutex
HANDLE mutex;
#endif // JMUTEX_CRITICALSECTION
#else // pthread mutex
pthread_mutex_t mutex;
#endif // WIN32

View File

@ -0,0 +1,43 @@
/*
This file is a part of the JThread package, which contains some object-
oriented thread wrappers for different thread implementations.
Copyright (c) 2000-2006 Jori Liesenborgs (jori@lumumba.uhasselt.be)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef JMUTEXAUTOLOCK_H
#define JMUTEXAUTOLOCK_H
#include "jmutex.h"
class JMutexAutoLock
{
public:
JMutexAutoLock(JMutex &m) : mutex(m) { mutex.Lock(); }
~JMutexAutoLock() { mutex.Unlock(); }
private:
JMutex &mutex;
};
#endif // JMUTEXAUTOLOCK_H

View File

@ -3,7 +3,7 @@
This file is a part of the JThread package, which contains some object-
oriented thread wrappers for different thread implementations.
Copyright (c) 2000-2005 Jori Liesenborgs (jori@lumumba.uhasselt.be)
Copyright (c) 2000-2006 Jori Liesenborgs (jori@lumumba.uhasselt.be)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),

View File

@ -3,7 +3,7 @@
This file is a part of the JThread package, which contains some object-
oriented thread wrappers for different thread implementations.
Copyright (c) 2000-2005 Jori Liesenborgs (jori@lumumba.uhasselt.be)
Copyright (c) 2000-2006 Jori Liesenborgs (jori@lumumba.uhasselt.be)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),

View File

@ -3,7 +3,7 @@
This file is a part of the JThread package, which contains some object-
oriented thread wrappers for different thread implementations.
Copyright (c) 2000-2005 Jori Liesenborgs (jori@lumumba.uhasselt.be)
Copyright (c) 2000-2006 Jori Liesenborgs (jori@lumumba.uhasselt.be)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@ -26,6 +26,8 @@
*/
#include "jthread.h"
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
JThread::JThread()
@ -86,6 +88,13 @@ int JThread::Start()
while (!running)
{
runningmutex.Unlock();
struct timespec req,rem;
req.tv_sec = 0;
req.tv_nsec = 1000000;
nanosleep(&req,&rem);
runningmutex.Lock();
}
runningmutex.Unlock();

View File

@ -284,7 +284,7 @@ int RTCPCompoundPacketBuilder::AddSDESNormalItem(RTCPSDESPacket::ItemType t,cons
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(buf);
sdeshdr->id = itemid;
sdeshdr->sdesid = itemid;
sdeshdr->length = itemlength;
if (itemlength != 0)
memcpy((buf + sizeof(RTCPSDESHeader)),itemdata,(size_t)itemlength);
@ -322,7 +322,7 @@ int RTCPCompoundPacketBuilder::AddSDESPrivateItem(const void *prefixdata,uint8_t
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(buf);
sdeshdr->id = RTCP_SDES_ID_PRIVATE;
sdeshdr->sdesid = RTCP_SDES_ID_PRIVATE;
sdeshdr->length = itemlength;
buf[sizeof(RTCPSDESHeader)] = prefixlength;

View File

@ -186,6 +186,11 @@ bool RTCPScheduler::IsTime()
RTPTime currenttime = RTPTime::CurrentTime();
// // TODO: for debugging
// double diff = nextrtcptime.GetDouble() - currenttime.GetDouble();
//
// std::cout << "Delay till next RTCP interval: " << diff << std::endl;
if (currenttime < nextrtcptime) // timer has not yet expired
return false;
@ -204,6 +209,8 @@ bool RTCPScheduler::IsTime()
else
checktime = CalculateBYETransmissionInterval();
// std::cout << "Calculated checktime: " << checktime.GetDouble() << std::endl;
checktime += prevrtcptime;
if (checktime <= currenttime) // Okay
@ -214,6 +221,8 @@ bool RTCPScheduler::IsTime()
CalculateNextRTCPTime();
return true;
}
// std::cout << "New delay: " << nextrtcptime.GetDouble() - currenttime.GetDouble() << std::endl;
nextrtcptime = checktime;
pmembers = sources.GetActiveMemberCount();
@ -238,6 +247,10 @@ RTPTime RTCPScheduler::CalculateDeterministicInterval(bool sender /* = false */)
int numsenders = sources.GetSenderCount();
int numtotal = sources.GetActiveMemberCount();
// std::cout << "CalculateDeterministicInterval" << std::endl;
// std::cout << " numsenders: " << numsenders << std::endl;
// std::cout << " numtotal: " << numtotal << std::endl;
// Try to avoid division by zero:
if (numtotal == 0)
numtotal++;
@ -273,6 +286,9 @@ RTPTime RTCPScheduler::CalculateDeterministicInterval(bool sender /* = false */)
double ntimesC = n*C;
double Td = (tmin>ntimesC)?tmin:ntimesC;
// TODO: for debugging
// std::cout << " Td: " << Td << std::endl;
return RTPTime(Td);
}
@ -281,10 +297,16 @@ RTPTime RTCPScheduler::CalculateTransmissionInterval(bool sender)
RTPTime Td = CalculateDeterministicInterval(sender);
double td,mul,T;
// std::cout << "CalculateTransmissionInterval" << std::endl;
td = Td.GetDouble();
mul = rtprand.GetRandomDouble()+0.5; // gives random value between 0.5 and 1.5
T = (td*mul)/1.21828; // see RFC 3550 p 30
// std::cout << " Td: " << td << std::endl;
// std::cout << " mul: " << mul << std::endl;
// std::cout << " T: " << T << std::endl;
return RTPTime(T);
}
@ -298,9 +320,22 @@ void RTCPScheduler::PerformReverseReconsideration()
RTPTime tc = RTPTime::CurrentTime();
RTPTime tn_min_tc = nextrtcptime;
tn_min_tc -= tc;
if (tn_min_tc > tc)
tn_min_tc -= tc;
else
tn_min_tc = RTPTime(0,0);
// std::cout << "+tn_min_tc0 " << nextrtcptime.GetDouble()-tc.GetDouble() << std::endl;
// std::cout << "-tn_min_tc0 " << -nextrtcptime.GetDouble()+tc.GetDouble() << std::endl;
// std::cout << "tn_min_tc " << tn_min_tc.GetDouble() << std::endl;
RTPTime tc_min_tp = tc;
tc_min_tp -= prevrtcptime;
if (tc_min_tp > prevrtcptime)
tc_min_tp -= prevrtcptime;
else
tc_min_tp = 0;
if (pmembers == 0) // avoid division by zero
pmembers++;

View File

@ -92,7 +92,7 @@ RTCPSDESPacket::RTCPSDESPacket(uint8_t *data,size_t datalength)
return;
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(chunk+chunkoffset);
if (sdeshdr->id == 0) // end of item list
if (sdeshdr->sdesid == 0) // end of item list
{
len--;
chunkoffset++;

View File

@ -114,7 +114,7 @@ inline bool RTCPSDESPacket::GotoNextChunk()
size_t offset = sizeof(uint32_t);
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+sizeof(uint32_t));
while (sdeshdr->id != 0)
while (sdeshdr->sdesid != 0)
{
offset += sizeof(RTCPSDESHeader);
offset += (size_t)(sdeshdr->length);
@ -147,7 +147,7 @@ inline bool RTCPSDESPacket::GotoFirstItem()
return false;
itemoffset = sizeof(uint32_t);
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
if (sdeshdr->id == 0)
if (sdeshdr->sdesid == 0)
return false;
return true;
}
@ -160,14 +160,14 @@ inline bool RTCPSDESPacket::GotoNextItem()
return false;
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
if (sdeshdr->id == 0)
if (sdeshdr->sdesid == 0)
return false;
size_t offset = itemoffset;
offset += sizeof(RTCPSDESHeader);
offset += (size_t)(sdeshdr->length);
sdeshdr = (RTCPSDESHeader *)(currentchunk+offset);
if (sdeshdr->id == 0)
if (sdeshdr->sdesid == 0)
return false;
itemoffset = offset;
return true;
@ -180,7 +180,7 @@ inline RTCPSDESPacket::ItemType RTCPSDESPacket::GetItemType() const
if (currentchunk == 0)
return None;
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
switch (sdeshdr->id)
switch (sdeshdr->sdesid)
{
case 0:
return None;
@ -213,7 +213,7 @@ inline size_t RTCPSDESPacket::GetItemLength() const
if (currentchunk == 0)
return None;
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
if (sdeshdr->id == 0)
if (sdeshdr->sdesid == 0)
return 0;
return (size_t)(sdeshdr->length);
}
@ -225,7 +225,7 @@ inline uint8_t *RTCPSDESPacket::GetItemData()
if (currentchunk == 0)
return 0;
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
if (sdeshdr->id == 0)
if (sdeshdr->sdesid == 0)
return 0;
return (currentchunk+itemoffset+sizeof(RTCPSDESHeader));
}
@ -238,7 +238,7 @@ inline size_t RTCPSDESPacket::GetPRIVPrefixLength() const
if (currentchunk == 0)
return 0;
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
if (sdeshdr->id != RTCP_SDES_ID_PRIVATE)
if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE)
return 0;
if (sdeshdr->length == 0)
return 0;
@ -256,7 +256,7 @@ inline uint8_t *RTCPSDESPacket::GetPRIVPrefixData()
if (currentchunk == 0)
return 0;
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
if (sdeshdr->id != RTCP_SDES_ID_PRIVATE)
if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE)
return 0;
if (sdeshdr->length == 0)
return 0;
@ -276,7 +276,7 @@ inline size_t RTCPSDESPacket::GetPRIVValueLength() const
if (currentchunk == 0)
return 0;
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
if (sdeshdr->id != RTCP_SDES_ID_PRIVATE)
if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE)
return 0;
if (sdeshdr->length == 0)
return 0;
@ -294,7 +294,7 @@ inline uint8_t *RTCPSDESPacket::GetPRIVValueData()
if (currentchunk == 0)
return 0;
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset);
if (sdeshdr->id != RTCP_SDES_ID_PRIVATE)
if (sdeshdr->sdesid != RTCP_SDES_ID_PRIVATE)
return 0;
if (sdeshdr->length == 0)
return 0;

View File

@ -72,4 +72,15 @@
#define RTCP_DEFAULTIMMEDIATEBYE true
#define RTCP_DEFAULTSRBYE true
#if (defined(WIN32) || defined(_WIN32_WCE))
#if (!defined(_WIN32_WCE)) && (defined(_MSC_VER) && _MSC_VER >= 1400 )
#define RTP_SNPRINTF _snprintf_s
#else
#define RTP_SNPRINTF _snprintf
#endif
#else
#define RTP_SNPRINTF snprintf
#endif // WIN32 || _WIN32_WCE
#endif // RTPDEFINES_H

View File

@ -31,6 +31,7 @@
*/
#include "rtperrors.h"
#include "rtpdefines.h"
#include "rtpdebug.h"
@ -219,12 +220,11 @@ std::string RTPGetErrorString(int errcode)
return std::string(ErrorDescriptions[i].description);
i++;
}
char str[16];
#if defined(WIN32) || defined(_WIN32_WCE)
_snprintf(str,16,"(%d)",errcode);
#else
snprintf(str,16,"(%d)",errcode);
#endif // WIN32 || _WIN32_WCE
RTP_SNPRINTF(str,16,"(%d)",errcode);
return std::string("Unknown error code") + std::string(str);
}

View File

@ -40,7 +40,8 @@
#include <iostream>
#endif // RTPDEBUG
template<class Element,int GetIndex(const Element &k),int hashsize>
//template<class Element,int GetIndex(const Element &k),int hashsize>
template<class Element,class GetIndex,int hashsize>
class RTPHashTable
{
public:
@ -87,7 +88,7 @@ private:
HashElement *curhashelem;
};
template<class Element,int GetIndex(const Element &e),int hashsize>
template<class Element,class GetIndex,int hashsize>
inline RTPHashTable<Element,GetIndex,hashsize>::RTPHashTable()
{
for (int i = 0 ; i < hashsize ; i++)
@ -96,7 +97,7 @@ inline RTPHashTable<Element,GetIndex,hashsize>::RTPHashTable()
lasthashelem = 0;
}
template<class Element,int GetIndex(const Element &e),int hashsize>
template<class Element,class GetIndex,int hashsize>
inline int RTPHashTable<Element,GetIndex,hashsize>::DeleteCurrentElement()
{
if (curhashelem)
@ -152,13 +153,13 @@ inline int RTPHashTable<Element,GetIndex,hashsize>::DeleteCurrentElement()
return 0;
}
template<class Element,int GetIndex(const Element &e),int hashsize>
template<class Element,class GetIndex,int hashsize>
inline int RTPHashTable<Element,GetIndex,hashsize>::GotoElement(const Element &e)
{
int index;
bool found;
index = GetIndex(e);
index = GetIndex::GetIndex(e);
if (index >= hashsize)
return ERR_RTP_HASHTABLE_FUNCTIONRETURNEDINVALIDHASHINDEX;
@ -176,14 +177,14 @@ inline int RTPHashTable<Element,GetIndex,hashsize>::GotoElement(const Element &e
return 0;
}
template<class Element,int GetIndex(const Element &e),int hashsize>
template<class Element,class GetIndex,int hashsize>
inline bool RTPHashTable<Element,GetIndex,hashsize>::HasElement(const Element &e)
{
int index;
bool found;
HashElement *tmp;
index = GetIndex(e);
index = GetIndex::GetIndex(e);
if (index >= hashsize)
return false;
@ -199,21 +200,21 @@ inline bool RTPHashTable<Element,GetIndex,hashsize>::HasElement(const Element &e
return found;
}
template<class Element,int GetIndex(const Element &e),int hashsize>
template<class Element,class GetIndex,int hashsize>
inline void RTPHashTable<Element,GetIndex,hashsize>::GotoNextElement()
{
if (curhashelem)
curhashelem = curhashelem->listnext;
}
template<class Element,int GetIndex(const Element &e),int hashsize>
template<class Element,class GetIndex,int hashsize>
inline void RTPHashTable<Element,GetIndex,hashsize>::GotoPreviousElement()
{
if (curhashelem)
curhashelem = curhashelem->listprev;
}
template<class Element,int GetIndex(const Element &e),int hashsize>
template<class Element,class GetIndex,int hashsize>
inline void RTPHashTable<Element,GetIndex,hashsize>::Clear()
{
HashElement *tmp1,*tmp2;
@ -232,14 +233,14 @@ inline void RTPHashTable<Element,GetIndex,hashsize>::Clear()
lasthashelem = 0;
}
template<class Element,int GetIndex(const Element &e),int hashsize>
template<class Element,class GetIndex,int hashsize>
inline int RTPHashTable<Element,GetIndex,hashsize>::AddElement(const Element &elem)
{
int index;
bool found;
HashElement *e,*newelem;
index = GetIndex(elem);
index = GetIndex::GetIndex(elem);
if (index >= hashsize)
return ERR_RTP_HASHTABLE_FUNCTIONRETURNEDINVALIDHASHINDEX;
@ -283,7 +284,7 @@ inline int RTPHashTable<Element,GetIndex,hashsize>::AddElement(const Element &el
return 0;
}
template<class Element,int GetIndex(const Element &e),int hashsize>
template<class Element,class GetIndex,int hashsize>
inline int RTPHashTable<Element,GetIndex,hashsize>::DeleteElement(const Element &elem)
{
int status;
@ -295,7 +296,7 @@ inline int RTPHashTable<Element,GetIndex,hashsize>::DeleteElement(const Element
}
#ifdef RTPDEBUG
template<class Element,int GetIndex(const Element &e),int hashsize>
template<class Element,class GetIndex,int hashsize>
inline void RTPHashTable<Element,GetIndex,hashsize>::Dump()
{
HashElement *e;

View File

@ -171,13 +171,13 @@ int RTPInternalSourceData::ProcessRTPPacket(RTPPacket *rtppack,const RTPTime &re
return 0;
}
int RTPInternalSourceData::ProcessSDESItem(uint8_t id,const uint8_t *data,size_t itemlen,const RTPTime &receivetime,bool *cnamecollis)
int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid,const uint8_t *data,size_t itemlen,const RTPTime &receivetime,bool *cnamecollis)
{
*cnamecollis = false;
stats.SetLastMessageTime(receivetime);
switch(id)
switch(sdesid)
{
case RTCP_SDES_ID_CNAME:
{

View File

@ -53,7 +53,7 @@ public:
uint32_t jitter,uint32_t lsr,uint32_t dlsr,
const RTPTime &receivetime) { RRprevinf = RRinf; RRinf.Set(fractionlost,lostpackets,exthighseqnr,jitter,lsr,dlsr,receivetime); stats.SetLastMessageTime(receivetime); }
void UpdateMessageTime(const RTPTime &receivetime) { stats.SetLastMessageTime(receivetime); }
int ProcessSDESItem(uint8_t id,const uint8_t *data,size_t itemlen,const RTPTime &receivetime,bool *cnamecollis);
int ProcessSDESItem(uint8_t sdesid,const uint8_t *data,size_t itemlen,const RTPTime &receivetime,bool *cnamecollis);
#ifdef RTP_SUPPORT_SDESPRIV
int ProcessPrivateSDESItem(const uint8_t *prefix,size_t prefixlen,const uint8_t *value,size_t valuelen,const RTPTime &receivetime);
#endif // RTP_SUPPORT_SDESPRIV

View File

@ -32,6 +32,7 @@
#include "rtpipv4address.h"
#ifdef RTPDEBUG
#include "rtpdefines.h"
#include <stdio.h>
#endif // RTPDEBUG
@ -74,7 +75,7 @@ std::string RTPIPv4Address::GetAddressString() const
{
char str[24];
snprintf(str,24,"%d.%d.%d.%d:%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),
RTP_SNPRINTF(str,24,"%d.%d.%d.%d:%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),
(int)(ip&0xFF),(int)port);
return std::string(str);
}

View File

@ -39,6 +39,7 @@
#include <netinet/in.h>
#endif // WIN32
#ifdef RTPDEBUG
#include "rtpdefines.h"
#include <stdio.h>
#include <string>
#endif // RTPDEBUG
@ -71,7 +72,7 @@ inline std::string RTPIPv4Destination::GetDestinationString() const
uint32_t ip = ipaddr_hbo;
uint16_t portbase = ntohs(rtpport_nbo);
snprintf(str,24,"%d.%d.%d.%d:%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF),(int)(portbase));
RTP_SNPRINTF(str,24,"%d.%d.%d.%d:%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF),(int)(portbase));
return std::string(str);
}
#endif // RTPDEBUG

View File

@ -35,6 +35,7 @@
#ifdef RTP_SUPPORT_IPV6
#ifdef RTPDEBUG
#include "rtpdefines.h"
#include <stdio.h>
#endif // RTPDEBUG
@ -97,7 +98,7 @@ std::string RTPIPv6Address::GetAddressString() const
ip16[j] |= ((uint16_t)ip.s6_addr[i+1]);
}
snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X/%d",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7],(int)port);
RTP_SNPRINTF(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X/%d",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7],(int)port);
return std::string(str);
}
#endif // RTPDEBUG

View File

@ -44,6 +44,7 @@
#include <netinet/in.h>
#endif // WIN32
#ifdef RTPDEBUG
#include "rtpdefines.h"
#include <stdio.h>
#include <string>
#endif // RTPDEBUG
@ -72,7 +73,7 @@ inline std::string RTPIPv6Destination::GetDestinationString() const
uint16_t portbase = ntohs(rtpport_nbo);
int i,j;
for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((uint16_t)ip.s6_addr[i])<<8); ip16[j] |= ((uint16_t)ip.s6_addr[i+1]); }
snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X/%d",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7],(int)portbase);
RTP_SNPRINTF(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X/%d",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7],(int)portbase);
return std::string(str);
}
#endif // RTPDEBUG

View File

@ -41,7 +41,7 @@
#include <iostream>
#endif // RTPDEBUG
template<class Key,class Element,int GetIndex(const Key &k),int hashsize>
template<class Key,class Element,class GetIndex,int hashsize>
class RTPKeyHashTable
{
public:
@ -91,7 +91,7 @@ private:
HashElement *curhashelem;
};
template<class Key,class Element,int GetIndex(const Key &k),int hashsize>
template<class Key,class Element,class GetIndex,int hashsize>
inline RTPKeyHashTable<Key,Element,GetIndex,hashsize>::RTPKeyHashTable()
{
for (int i = 0 ; i < hashsize ; i++)
@ -100,7 +100,7 @@ inline RTPKeyHashTable<Key,Element,GetIndex,hashsize>::RTPKeyHashTable()
lasthashelem = 0;
}
template<class Key,class Element,int GetIndex(const Key &k),int hashsize>
template<class Key,class Element,class GetIndex,int hashsize>
inline int RTPKeyHashTable<Key,Element,GetIndex,hashsize>::DeleteCurrentElement()
{
if (curhashelem)
@ -156,13 +156,13 @@ inline int RTPKeyHashTable<Key,Element,GetIndex,hashsize>::DeleteCurrentElement(
return 0;
}
template<class Key,class Element,int GetIndex(const Key &k),int hashsize>
template<class Key,class Element,class GetIndex,int hashsize>
inline int RTPKeyHashTable<Key,Element,GetIndex,hashsize>::GotoElement(const Key &k)
{
int index;
bool found;
index = GetIndex(k);
index = GetIndex::GetIndex(k);
if (index >= hashsize)
return ERR_RTP_KEYHASHTABLE_FUNCTIONRETURNEDINVALIDHASHINDEX;
@ -180,14 +180,14 @@ inline int RTPKeyHashTable<Key,Element,GetIndex,hashsize>::GotoElement(const Key
return 0;
}
template<class Key,class Element,int GetIndex(const Key &k),int hashsize>
template<class Key,class Element,class GetIndex,int hashsize>
inline bool RTPKeyHashTable<Key,Element,GetIndex,hashsize>::HasElement(const Key &k)
{
int index;
bool found;
HashElement *tmp;
index = GetIndex(k);
index = GetIndex::GetIndex(k);
if (index >= hashsize)
return false;
@ -203,21 +203,21 @@ inline bool RTPKeyHashTable<Key,Element,GetIndex,hashsize>::HasElement(const Key
return found;
}
template<class Key,class Element,int GetIndex(const Key &k),int hashsize>
template<class Key,class Element,class GetIndex,int hashsize>
inline void RTPKeyHashTable<Key,Element,GetIndex,hashsize>::GotoNextElement()
{
if (curhashelem)
curhashelem = curhashelem->listnext;
}
template<class Key,class Element,int GetIndex(const Key &k),int hashsize>
template<class Key,class Element,class GetIndex,int hashsize>
inline void RTPKeyHashTable<Key,Element,GetIndex,hashsize>::GotoPreviousElement()
{
if (curhashelem)
curhashelem = curhashelem->listprev;
}
template<class Key,class Element,int GetIndex(const Key &k),int hashsize>
template<class Key,class Element,class GetIndex,int hashsize>
inline void RTPKeyHashTable<Key,Element,GetIndex,hashsize>::Clear()
{
HashElement *tmp1,*tmp2;
@ -236,14 +236,14 @@ inline void RTPKeyHashTable<Key,Element,GetIndex,hashsize>::Clear()
lasthashelem = 0;
}
template<class Key,class Element,int GetIndex(const Key &k),int hashsize>
template<class Key,class Element,class GetIndex,int hashsize>
inline int RTPKeyHashTable<Key,Element,GetIndex,hashsize>::AddElement(const Key &k,const Element &elem)
{
int index;
bool found;
HashElement *e,*newelem;
index = GetIndex(k);
index = GetIndex::GetIndex(k);
if (index >= hashsize)
return ERR_RTP_KEYHASHTABLE_FUNCTIONRETURNEDINVALIDHASHINDEX;
@ -287,7 +287,7 @@ inline int RTPKeyHashTable<Key,Element,GetIndex,hashsize>::AddElement(const Key
return 0;
}
template<class Key,class Element,int GetIndex(const Key &k),int hashsize>
template<class Key,class Element,class GetIndex,int hashsize>
inline int RTPKeyHashTable<Key,Element,GetIndex,hashsize>::DeleteElement(const Key &k)
{
int status;
@ -299,7 +299,7 @@ inline int RTPKeyHashTable<Key,Element,GetIndex,hashsize>::DeleteElement(const K
}
#ifdef RTPDEBUG
template<class Key,class Element,int GetIndex(const Key &k),int hashsize>
template<class Key,class Element,class GetIndex,int hashsize>
inline void RTPKeyHashTable<Key,Element,GetIndex,hashsize>::Dump()
{
HashElement *e;

View File

@ -31,9 +31,20 @@
*/
#include "rtplibraryversion.h"
#include "rtpdefines.h"
RTPLibraryVersion RTPLibraryVersion::GetVersion()
{
return RTPLibraryVersion(3,4,0);
return RTPLibraryVersion(3,5,2);
}
std::string RTPLibraryVersion::GetVersionString() const
{
char str[16];
RTP_SNPRINTF(str,16,"%d.%d.%d",majornr,minornr,debugnr);
return std::string(str);
}

View File

@ -52,17 +52,5 @@ private:
int debugnr,minornr,majornr;
};
inline std::string RTPLibraryVersion::GetVersionString() const
{
char str[16];
#if (defined(WIN32) || defined(_WIN32_WCE))
_snprintf(str,16,"%d.%d.%d",majornr,minornr,debugnr);
#else
snprintf(str,16,"%d.%d.%d",majornr,minornr,debugnr);
#endif // WIN32 || _WIN32_WCE
return std::string(str);
}
#endif // RTPLIBRARYVERSION_H

View File

@ -175,7 +175,7 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack)
RTPPacket::hasextension = hasextension;
if (hasextension)
{
RTPPacket::extid = ntohs(rtpextheader->id);
RTPPacket::extid = ntohs(rtpextheader->extid);
RTPPacket::extensionlength = ((int)ntohs(rtpextheader->length))*sizeof(uint32_t);
RTPPacket::extension = ((uint8_t *)rtpextheader)+sizeof(RTPExtensionHeader);
}
@ -305,7 +305,7 @@ int RTPPacket::BuildPacket(uint8_t payloadtype,const void *payloaddata,size_t pa
{
RTPExtensionHeader *rtpexthdr = (RTPExtensionHeader *)payload;
rtpexthdr->id = htons(extensionid);
rtpexthdr->extid = htons(extensionid);
rtpexthdr->length = htons((uint16_t)extensionlen_numwords);
payload += sizeof(RTPExtensionHeader);

View File

@ -30,6 +30,10 @@
*/
#if defined(WIN32) && !defined(_WIN32_WCE)
#define _CRT_RAND_S
#endif // WIN32 || _WIN32_WCE
#include "rtprandom.h"
#include <time.h>
#ifndef WIN32
@ -46,30 +50,29 @@
#include "rtpdebug.h"
#if !defined(RTP_SUPPORT_GNUDRAND) && !defined(RTP_SUPPORT_RANDR)
bool RTPRandom::init = false;
#endif // WIN32
#if (!defined(_WIN32_WCE)) && (defined(_MSC_VER) && _MSC_VER >= 1400 )
#define RTP_SUPPORT_RANDS
#endif
RTPRandom::RTPRandom()
{
#ifndef RTP_SUPPORT_RANDS
#if defined(RTP_SUPPORT_GNUDRAND) || defined(RTP_SUPPORT_RANDR)
uint32_t x;
x = (uint32_t)getpid();
x += (uint32_t)time(0);
x -= (uint32_t)clock();
x ^= (uint32_t)(this);
x ^= (uint32_t)((uint8_t *)this - (uint8_t *)0);
#ifdef RTP_SUPPORT_GNUDRAND
srand48_r(x,&drandbuffer);
#else
state = (unsigned int)x;
#endif
#endif // RTP_SUPPORT_GNUDRAND
#else // use simple rand and srand functions
if (init)
return;
uint32_t x;
#ifndef _WIN32_WCE
@ -87,18 +90,20 @@ RTPRandom::RTPRandom()
x += ft.dwLowDateTime;
#endif // _WIN32_WCE
x ^= (uint32_t)(this);
x ^= (uint32_t)((uint8_t *)this - (uint8_t *)0);
srand((unsigned int)x);
#endif // RTP_SUPPORT_GNUDRAND || RTP_SUPPORT_RANDR
init = true;
#endif
#endif // RTP_SUPPORT_RANDS
// Note: the rand_s function does not require initialization of a seed
}
RTPRandom::~RTPRandom()
{
}
#ifdef RTP_SUPPORT_GNUDRAND
#if defined(RTP_SUPPORT_GNUDRAND)
uint8_t RTPRandom::GetRandom8()
{
@ -131,8 +136,7 @@ double RTPRandom::GetRandomDouble()
return x;
}
#else
#ifdef RTP_SUPPORT_RANDR
#elif defined(RTP_SUPPORT_RANDR)
uint8_t RTPRandom::GetRandom8()
{
@ -170,7 +174,56 @@ double RTPRandom::GetRandomDouble()
return x;
}
#else
#elif defined(RTP_SUPPORT_RANDS)
uint8_t RTPRandom::GetRandom8()
{
uint8_t x;
unsigned int r;
rand_s(&r);
x = (uint8_t)(256.0*((double)r)/((double)UINT_MAX+1.0));
return x;
}
uint16_t RTPRandom::GetRandom16()
{
uint16_t x;
unsigned int r;
rand_s(&r);
x = (uint16_t)(65536.0*((double)r)/((double)UINT_MAX+1.0));
return x;
}
uint32_t RTPRandom::GetRandom32()
{
uint32_t x,y;
unsigned int r;
rand_s(&r);
x = (uint32_t)(65536.0*((double)r)/((double)UINT_MAX+1.0));
y = x;
rand_s(&r);
x = (uint32_t)(65536.0*((double)r)/((double)UINT_MAX+1.0));
y ^= (x<<8);
rand_s(&r);
x = (uint32_t)(65536.0*((double)r)/((double)UINT_MAX+1.0));
y ^= (x<<16);
return y;
}
double RTPRandom::GetRandomDouble()
{
unsigned int r;
rand_s(&r);
double x = ((double)r)/((double)UINT_MAX+1.0);
return x;
}
#else // use rand()
uint8_t RTPRandom::GetRandom8()
{
@ -208,6 +261,5 @@ double RTPRandom::GetRandomDouble()
return x;
}
#endif // RTP_SUPPORT_RANDR
#endif // RTP_SUPPORT_GNUDRAND

View File

@ -48,15 +48,12 @@ public:
uint32_t GetRandom32();
double GetRandomDouble(); // returns random value between 0.0 and 1.0
private:
#ifdef RTP_SUPPORT_GNUDRAND
#if defined(RTP_SUPPORT_GNUDRAND)
struct drand48_data drandbuffer;
#else
#ifdef RTP_SUPPORT_RANDR
#elif defined(RTP_SUPPORT_RANDR)
unsigned int state;
#else
static bool init;
#endif // RTP_SUPPORT_RANDR
#endif // RTP_SUPPORT_GNUDRAND
};
#endif // RTPRANDOM_H

View File

@ -380,6 +380,9 @@ void RTPSession::BYEDestroy(const RTPTime &maxwaittime,const void *reason,size_t
byepackets.pop_front();
rtptrans->SendRTCPData(pack->GetCompoundPacketData(),pack->GetCompoundPacketLength());
OnSendRTCPCompoundPacket(pack); // we'll place this after the actual send to avoid tampering
delete pack;
if (!byepackets.empty()) // more bye packets to send, schedule them
rtcpsched.ScheduleBYEPacket((*(byepackets.begin()))->GetCompoundPacketLength());
@ -1178,6 +1181,8 @@ int RTPSession::ProcessPolledData()
delete pack;
return status;
}
OnSendRTCPCompoundPacket(pack); // we'll place this after the actual send to avoid tampering
}
else
{
@ -1190,6 +1195,8 @@ int RTPSession::ProcessPolledData()
delete pack;
return status;
}
OnSendRTCPCompoundPacket(pack); // we'll place this after the actual send to avoid tampering
if (!byepackets.empty()) // more bye packets to send, schedule them
{
@ -1250,9 +1257,14 @@ int RTPSession::CreateCNAME(uint8_t *buffer,size_t *bufferlength,bool resolve)
#ifndef _WIN32_WCE
DWORD len = *bufferlength;
if (!GetUserName((LPTSTR)buffer,&len))
strcpy((char *)buffer,"unknown");
#if (defined(_MSC_VER) && _MSC_VER >= 1400 ) // Check if we can use the secure strncpy_s
strncpy_s((char *)buffer,*bufferlength,"unknown",_TRUNCATE);
#else
strncpy((char *)buffer,"unknown",*bufferlength);
#endif // Less secure version
#else
strcpy((char *)buffer,"unknown");
strncpy((char *)buffer,"unknown",*bufferlength);
#endif // _WIN32_WCE
#endif // WIN32
@ -1276,9 +1288,17 @@ int RTPSession::CreateCNAME(uint8_t *buffer,size_t *bufferlength,bool resolve)
{
char hostname[1024];
strcpy(hostname,"localhost"); // just in case gethostname fails
#if defined(WIN32) && !defined(_WIN32_WCE) && (defined(_MSC_VER) && _MSC_VER >= 1400 ) // Check if we can use the secure strncpy_s
strncpy_s(hostname,1024,"localhost",_TRUNCATE); // just in case gethostname fails
#else
strncpy(hostname,"localhost",1024); // just in case gethostname fails
#endif
gethostname(hostname,1024);
#if defined(WIN32) && !defined(_WIN32_WCE) && (defined(_MSC_VER) && _MSC_VER >= 1400 ) // Check if we can use the secure strncpy_s
strncpy_s((char *)(buffer+offset),buflen2,hostname,_TRUNCATE);
#else
strncpy((char *)(buffer+offset),hostname,buflen2);
#endif
*bufferlength = offset+strlen(hostname);
}
if (*bufferlength > RTCP_SDES_MAXITEMLENGTH)

View File

@ -173,8 +173,7 @@ protected:
virtual void OnInvalidRawPacketType(RTPRawPacket *rawpacket, jrtp_socket_t socket) { }
virtual void OnNoteTimeout(RTPSourceData *srcdat) { }
virtual void OnBYEPacket(RTPSourceData *srcdat) { }
virtual void OnSendRTCPCompoundPacket(RTCPCompoundPacket *pack) { }
#ifdef RTP_SUPPORT_THREAD
virtual void OnPollThreadError(int errcode) { }
virtual void OnPollThreadStep() { }
@ -214,6 +213,7 @@ private:
friend class RTPPollThread;
#endif // RTP_SUPPORT_THREAD
friend class RTPSessionSources;
friend class RTCPSessionPacketBuilder;
};
#endif // RTPSESSION_H

View File

@ -90,7 +90,7 @@ public:
private:
bool acceptown;
bool usepollthread;
int maxpacksize;
size_t maxpacksize;
double owntsunit;
RTPTransmitter::ReceiveMode receivemode;
bool resolvehostname;

View File

@ -51,10 +51,6 @@
#include "rtpdebug.h"
#ifndef RTP_SUPPORT_INLINETEMPLATEPARAM
int RTPSources_GetHashIndex(const uint32_t &ssrc) { return ssrc%RTPSOURCES_HASHSIZE; }
#endif // !RTP_SUPPORT_INLINETEMPLATEPARAM
RTPSources::RTPSources(ProbationType probtype)
{
totalcount = 0;
@ -693,31 +689,31 @@ int RTPSources::ProcessSDESNormalItem(uint32_t ssrc,RTCPSDESPacket::ItemType t,s
RTPInternalSourceData *srcdat;
bool created,cnamecollis;
int status;
uint8_t id;
uint8_t sdesid;
bool prevactive;
switch(t)
{
case RTCPSDESPacket::CNAME:
id = RTCP_SDES_ID_CNAME;
sdesid = RTCP_SDES_ID_CNAME;
break;
case RTCPSDESPacket::NAME:
id = RTCP_SDES_ID_NAME;
sdesid = RTCP_SDES_ID_NAME;
break;
case RTCPSDESPacket::EMAIL:
id = RTCP_SDES_ID_EMAIL;
sdesid = RTCP_SDES_ID_EMAIL;
break;
case RTCPSDESPacket::PHONE:
id = RTCP_SDES_ID_PHONE;
sdesid = RTCP_SDES_ID_PHONE;
break;
case RTCPSDESPacket::LOC:
id = RTCP_SDES_ID_LOCATION;
sdesid = RTCP_SDES_ID_LOCATION;
break;
case RTCPSDESPacket::TOOL:
id = RTCP_SDES_ID_TOOL;
sdesid = RTCP_SDES_ID_TOOL;
break;
case RTCPSDESPacket::NOTE:
id = RTCP_SDES_ID_NOTE;
sdesid = RTCP_SDES_ID_NOTE;
break;
default:
return ERR_RTP_SOURCES_ILLEGALSDESTYPE;
@ -730,7 +726,7 @@ int RTPSources::ProcessSDESNormalItem(uint32_t ssrc,RTCPSDESPacket::ItemType t,s
return 0;
prevactive = srcdat->IsActive();
status = srcdat->ProcessSDESItem(id,(const uint8_t *)itemdata,itemlength,receivetime,&cnamecollis);
status = srcdat->ProcessSDESItem(sdesid,(const uint8_t *)itemdata,itemlength,receivetime,&cnamecollis);
if (!prevactive && srcdat->IsActive())
activecount++;
@ -1233,6 +1229,7 @@ void RTPSources::MultipleTimeouts(const RTPTime &curtime,const RTPTime &senderti
OnBYETimeout(srcdat);
if (normaltimeout)
OnTimeout(srcdat);
OnRemoveSource(srcdat);
delete srcdat;
}
}

View File

@ -41,11 +41,11 @@
#define RTPSOURCES_HASHSIZE 8317
#ifdef RTP_SUPPORT_INLINETEMPLATEPARAM
inline int RTPSources_GetHashIndex(const uint32_t &ssrc) { return ssrc%RTPSOURCES_HASHSIZE; }
#else // can't use inline function as template parameter
int RTPSources_GetHashIndex(const uint32_t &ssrc);
#endif // RTP_SUPPORT_INLINETEMPLATEPARAM
class RTPSources_GetHashIndex
{
public:
static int GetIndex(const uint32_t &ssrc) { return ssrc%RTPSOURCES_HASHSIZE; }
};
class RTPNTPTime;
class RTPTransmitter;

View File

@ -64,7 +64,7 @@ struct RTPHeader
struct RTPExtensionHeader
{
uint16_t id;
uint16_t extid;
uint16_t length;
};
@ -111,7 +111,7 @@ struct RTCPReceiverReport
struct RTCPSDESHeader
{
uint8_t id;
uint8_t sdesid;
uint8_t length;
};

View File

@ -34,6 +34,7 @@
#include "rtprawpacket.h"
#include "rtpipv4address.h"
#include "rtptimeutilities.h"
#include "rtpdefines.h"
#include <stdio.h>
#if (defined(WIN32) || defined(_WIN32_WCE))
#define RTPSOCKERR INVALID_SOCKET
@ -104,11 +105,6 @@
mreq.imr_interface.s_addr = htonl(mcastifaceIP);\
status = setsockopt(socket,IPPROTO_IP,type,(const char *)&mreq,sizeof(struct ip_mreq));\
}
#ifndef RTP_SUPPORT_INLINETEMPLATEPARAM
int RTPUDPv4Trans_GetHashIndex_IPv4Dest(const RTPIPv4Destination &d) { return d.GetIP_HBO()%RTPUDPV4TRANS_HASHSIZE; }
int RTPUDPv4Trans_GetHashIndex_uint32_t(const uint32_t &k) { return k%RTPUDPV4TRANS_HASHSIZE; }
#endif // !RTP_SUPPORT_INLINETEMPLATEPARAM
#ifdef RTP_SUPPORT_THREAD
#define MAINMUTEX_LOCK { if (threadsafe) mainmutex.Lock(); }
#define MAINMUTEX_UNLOCK { if (threadsafe) mainmutex.Unlock(); }
@ -512,11 +508,7 @@ int RTPUDPv4Transmitter::GetLocalHostName(uint8_t *buffer,size_t *bufferlength)
it = localIPs.begin();
ip = (*it);
#if (defined(WIN32) || defined(_WIN32_WCE))
_snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF));
#else
snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF));
#endif // WIN32 || _WIN32_WCE
RTP_SNPRINTF(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF));
len = strlen(str);
localhostnamelength = len;
@ -1360,7 +1352,7 @@ int RTPUDPv4Transmitter::PollSocket(bool rtp)
{
RTPTime curtime = RTPTime::CurrentTime();
fromlen = sizeof(struct sockaddr_in);
recvlen = recvfrom(sock,packetbuffer,(int)len,0,(struct sockaddr *)&srcaddr,&fromlen);
recvlen = recvfrom(sock,packetbuffer,RTPUDPV4TRANS_MAXPACKSIZE,0,(struct sockaddr *)&srcaddr,&fromlen);
if (recvlen > 0)
{
bool acceptdata;
@ -1918,16 +1910,16 @@ void RTPUDPv4Transmitter::Dump()
std::cout << "RTP socket descriptor: " << rtpsock << std::endl;
std::cout << "RTCP socket descriptor: " << rtcpsock << std::endl;
ip = bindIP;
snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF));
RTP_SNPRINTF(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF));
std::cout << "Bind IP address: " << str << std::endl;
ip = mcastifaceIP;
snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF));
RTP_SNPRINTF(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF));
std::cout << "Multicast interface IP address: " << str << std::endl;
std::cout << "Local IP addresses:" << std::endl;
for (it = localIPs.begin() ; it != localIPs.end() ; it++)
{
ip = (*it);
snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF));
RTP_SNPRINTF(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF));
std::cout << " " << str << std::endl;
}
std::cout << "Multicast TTL: " << (int)multicastTTL << std::endl;
@ -1950,7 +1942,7 @@ void RTPUDPv4Transmitter::Dump()
while(acceptignoreinfo.HasCurrentElement())
{
ip = acceptignoreinfo.GetCurrentKey();
snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF));
RTP_SNPRINTF(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF));
PortInfo *pinfo = acceptignoreinfo.GetCurrentElement();
std::cout << " " << str << ": ";
if (pinfo->all)
@ -2004,7 +1996,7 @@ void RTPUDPv4Transmitter::Dump()
do
{
ip = multicastgroups.GetCurrentElement();
snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF));
RTP_SNPRINTF(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF));
std::cout << " " << str << std::endl;
multicastgroups.GotoNextElement();
} while (multicastgroups.HasCurrentElement());

View File

@ -85,13 +85,17 @@ private:
jrtp_socket_t rtpsocket,rtcpsocket;
};
#ifdef RTP_SUPPORT_INLINETEMPLATEPARAM
inline int RTPUDPv4Trans_GetHashIndex_IPv4Dest(const RTPIPv4Destination &d) { return d.GetIP_HBO()%RTPUDPV4TRANS_HASHSIZE; }
inline int RTPUDPv4Trans_GetHashIndex_uint32_t(const uint32_t &k) { return k%RTPUDPV4TRANS_HASHSIZE; }
#else // No support for inline function as template parameter
int RTPUDPv4Trans_GetHashIndex_IPv4Dest(const RTPIPv4Destination &d);
int RTPUDPv4Trans_GetHashIndex_uint32_t(const uint32_t &k);
#endif // RTP_SUPPORT_INLINETEMPLATEPARAM
class RTPUDPv4Trans_GetHashIndex_IPv4Dest
{
public:
static int GetIndex(const RTPIPv4Destination &d) { return d.GetIP_HBO()%RTPUDPV4TRANS_HASHSIZE; }
};
class RTPUDPv4Trans_GetHashIndex_uint32_t
{
public:
static int GetIndex(const uint32_t &k) { return k%RTPUDPV4TRANS_HASHSIZE; }
};
#define RTPUDPV4TRANS_HEADERSIZE (20+8)

View File

@ -37,6 +37,7 @@
#include "rtprawpacket.h"
#include "rtpipv6address.h"
#include "rtptimeutilities.h"
#include "rtpdefines.h"
#include <stdio.h>
#if (defined(WIN32) || defined(_WIN32_WCE))
#define RTPSOCKERR INVALID_SOCKET
@ -103,11 +104,6 @@
mreq.ipv6mr_interface = mcastifidx;\
status = setsockopt(socket,IPPROTO_IPV6,type,(const char *)&mreq,sizeof(struct ipv6_mreq));\
}
#ifndef RTP_SUPPORT_INLINETEMPLATEPARAM
int RTPUDPv6Trans_GetHashIndex_IPv6Dest(const RTPIPv6Destination &d) { in6_addr ip = d.GetIP(); return ((((uint32_t)ip.s6_addr[12])<<24)|(((uint32_t)ip.s6_addr[13])<<16)|(((uint32_t)ip.s6_addr[14])<<8)|((uint32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; }
int RTPUDPv6Trans_GetHashIndex_in6_addr(const in6_addr &ip) { return ((((uint32_t)ip.s6_addr[12])<<24)|(((uint32_t)ip.s6_addr[13])<<16)|(((uint32_t)ip.s6_addr[14])<<8)|((uint32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; }
#endif // !RTP_SUPPORT_INLINETEMPLATEPARAM
#ifdef RTP_SUPPORT_THREAD
#define MAINMUTEX_LOCK { if (threadsafe) mainmutex.Lock(); }
#define MAINMUTEX_UNLOCK { if (threadsafe) mainmutex.Unlock(); }
@ -522,11 +518,7 @@ int RTPUDPv6Transmitter::GetLocalHostName(uint8_t *buffer,size_t *bufferlength)
ip16[j] |= ((uint16_t)ip.s6_addr[i+1]);
}
#if (defined(WIN32) || defined(_WIN32_WCE))
_snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]);
#else
snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]);
#endif // WIN32 || _WIN32_WCE
RTP_SNPRINTF(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]);
len = strlen(str);
localhostnamelength = len;
@ -1373,7 +1365,7 @@ int RTPUDPv6Transmitter::PollSocket(bool rtp)
{
RTPTime curtime = RTPTime::CurrentTime();
fromlen = sizeof(struct sockaddr_in6);
recvlen = recvfrom(sock,packetbuffer,(int)len,0,(struct sockaddr *)&srcaddr,&fromlen);
recvlen = recvfrom(sock,packetbuffer,RTPUDPV6TRANS_MAXPACKSIZE,0,(struct sockaddr *)&srcaddr,&fromlen);
if (recvlen > 0)
{
bool acceptdata;
@ -1874,7 +1866,7 @@ void RTPUDPv6Transmitter::Dump()
std::cout << "RTCP socket descriptor: " << rtcpsock << std::endl;
ip = bindIP;
for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((uint16_t)ip.s6_addr[i])<<8); ip16[j] |= ((uint16_t)ip.s6_addr[i+1]); }
snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]);
RTP_SNPRINTF(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]);
std::cout << "Bind IP address: " << str << std::endl;
std::Cout << "Multicast interface index: " << mcastifidx << std::endl;
std::cout << "Local IP addresses:" << std::endl;
@ -1882,7 +1874,7 @@ void RTPUDPv6Transmitter::Dump()
{
ip = (*it);
for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((uint16_t)ip.s6_addr[i])<<8); ip16[j] |= ((uint16_t)ip.s6_addr[i+1]); }
snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]);
RTP_SNPRINTF(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]);
std::cout << " " << str << std::endl;
}
std::cout << "Multicast TTL: " << (int)multicastTTL << std::endl;
@ -1906,7 +1898,7 @@ void RTPUDPv6Transmitter::Dump()
{
ip = acceptignoreinfo.GetCurrentKey();
for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((uint16_t)ip.s6_addr[i])<<8); ip16[j] |= ((uint16_t)ip.s6_addr[i+1]); }
snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]);
RTP_SNPRINTF(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]);
PortInfo *pinfo = acceptignoreinfo.GetCurrentElement();
std::cout << " " << str << ": ";
if (pinfo->all)
@ -1961,7 +1953,7 @@ void RTPUDPv6Transmitter::Dump()
{
ip = multicastgroups.GetCurrentElement();
for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((uint16_t)ip.s6_addr[i])<<8); ip16[j] |= ((uint16_t)ip.s6_addr[i+1]); }
snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]);
RTP_SNPRINTF(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]);
std::cout << " " << str << std::endl;
multicastgroups.GotoNextElement();
} while (multicastgroups.HasCurrentElement());

View File

@ -93,13 +93,17 @@ private:
jrtp_socket_t rtpsocket,rtcpsocket;
};
#ifdef RTP_SUPPORT_INLINETEMPLATEPARAM
inline int RTPUDPv6Trans_GetHashIndex_IPv6Dest(const RTPIPv6Destination &d) { in6_addr ip = d.GetIP(); return ((((uint32_t)ip.s6_addr[12])<<24)|(((uint32_t)ip.s6_addr[13])<<16)|(((uint32_t)ip.s6_addr[14])<<8)|((uint32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; }
inline int RTPUDPv6Trans_GetHashIndex_in6_addr(const in6_addr &ip) { return ((((uint32_t)ip.s6_addr[12])<<24)|(((uint32_t)ip.s6_addr[13])<<16)|(((uint32_t)ip.s6_addr[14])<<8)|((uint32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; }
#else // No support for inline function as template parameter
int RTPUDPv6Trans_GetHashIndex_IPv6Dest(const RTPIPv6Destination &d);
int RTPUDPv6Trans_GetHashIndex_in6_addr(const in6_addr &ip);
#endif // RTP_SUPPORT_INLINETEMPLATEPARAM
class RTPUDPv6Trans_GetHashIndex_IPv6Dest
{
public:
static int GetIndex(const RTPIPv6Destination &d) { in6_addr ip = d.GetIP(); return ((((uint32_t)ip.s6_addr[12])<<24)|(((uint32_t)ip.s6_addr[13])<<16)|(((uint32_t)ip.s6_addr[14])<<8)|((uint32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; }
};
class RTPUDPv6Trans_GetHashIndex_in6_addr
{
public:
static int GetIndex(const in6_addr &ip) { return ((((uint32_t)ip.s6_addr[12])<<24)|(((uint32_t)ip.s6_addr[13])<<16)|(((uint32_t)ip.s6_addr[14])<<8)|((uint32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; }
};
#define RTPUDPV6TRANS_HEADERSIZE (40+8)

View File

@ -3,7 +3,7 @@
This file is a part of the JThread package, which contains some object-
oriented thread wrappers for different thread implementations.
Copyright (c) 2000-2005 Jori Liesenborgs (jori@lumumba.uhasselt.be)
Copyright (c) 2000-2006 Jori Liesenborgs (jori@lumumba.uhasselt.be)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@ -35,16 +35,24 @@ JMutex::JMutex()
JMutex::~JMutex()
{
if (initialized)
#ifdef JMUTEX_CRITICALSECTION
DeleteCriticalSection(&mutex);
#else
CloseHandle(mutex);
#endif // JMUTEX_CRITICALSECTION
}
int JMutex::Init()
{
if (initialized)
return ERR_JMUTEX_ALREADYINIT;
#ifdef JMUTEX_CRITICALSECTION
InitializeCriticalSection(&mutex);
#else
mutex = CreateMutex(NULL,FALSE,NULL);
if (mutex == NULL)
return ERR_JMUTEX_CANTCREATEMUTEX;
#endif // JMUTEX_CRITICALSECTION
initialized = true;
return 0;
}
@ -53,7 +61,11 @@ int JMutex::Lock()
{
if (!initialized)
return ERR_JMUTEX_NOTINIT;
#ifdef JMUTEX_CRITICALSECTION
EnterCriticalSection(&mutex);
#else
WaitForSingleObject(mutex,INFINITE);
#endif // JMUTEX_CRITICALSECTION
return 0;
}
@ -61,6 +73,11 @@ int JMutex::Unlock()
{
if (!initialized)
return ERR_JMUTEX_NOTINIT;
#ifdef JMUTEX_CRITICALSECTION
LeaveCriticalSection(&mutex);
#else
ReleaseMutex(mutex);
#endif // JMUTEX_CRITICALSECTION
return 0;
}

View File

@ -3,7 +3,7 @@
This file is a part of the JThread package, which contains some object-
oriented thread wrappers for different thread implementations.
Copyright (c) 2000-2005 Jori Liesenborgs (jori@lumumba.uhasselt.be)
Copyright (c) 2000-2006 Jori Liesenborgs (jori@lumumba.uhasselt.be)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@ -90,6 +90,7 @@ int JThread::Start()
while (!running)
{
runningmutex.Unlock();
Sleep(1);
runningmutex.Lock();
}
runningmutex.Unlock();