From 2f322f615f0dba88485d417cb7c45870985dd828 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 28 Mar 2006 15:58:06 +0000 Subject: [PATCH] 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 --- libs/jrtplib/ChangeLog | 27 +- libs/jrtplib/README.TXT | 9 +- libs/jrtplib/configure | 59 +- libs/jrtplib/configure.in | 19 +- libs/jrtplib/doc/jrtplib.tex | 399 ++++---- libs/jrtplib/jrtplib.dsp | 4 +- libs/jrtplib/jrtplib_wce.vcproj | 963 +++++++++--------- libs/jrtplib/src/Makefile.am | 4 +- libs/jrtplib/src/Makefile.in | 4 +- libs/jrtplib/src/jmutex.h | 11 +- libs/jrtplib/src/jmutexautolock.h | 43 + libs/jrtplib/src/jthread.h | 2 +- libs/jrtplib/src/pthread/jmutex.cpp | 2 +- libs/jrtplib/src/pthread/jthread.cpp | 11 +- .../jrtplib/src/rtcpcompoundpacketbuilder.cpp | 4 +- libs/jrtplib/src/rtcpscheduler.cpp | 39 +- libs/jrtplib/src/rtcpsdespacket.cpp | 2 +- libs/jrtplib/src/rtcpsdespacket.h | 22 +- libs/jrtplib/src/rtpdefines.h | 11 + libs/jrtplib/src/rtperrors.cpp | 10 +- libs/jrtplib/src/rtphashtable.h | 29 +- libs/jrtplib/src/rtpinternalsourcedata.cpp | 4 +- libs/jrtplib/src/rtpinternalsourcedata.h | 2 +- libs/jrtplib/src/rtpipv4address.cpp | 3 +- libs/jrtplib/src/rtpipv4destination.h | 3 +- libs/jrtplib/src/rtpipv6address.cpp | 3 +- libs/jrtplib/src/rtpipv6destination.h | 3 +- libs/jrtplib/src/rtpkeyhashtable.h | 28 +- libs/jrtplib/src/rtplibraryversion.cpp | 13 +- libs/jrtplib/src/rtplibraryversion.h | 12 - libs/jrtplib/src/rtppacket.cpp | 4 +- libs/jrtplib/src/rtprandom.cpp | 84 +- libs/jrtplib/src/rtprandom.h | 9 +- libs/jrtplib/src/rtpsession.cpp | 26 +- libs/jrtplib/src/rtpsession.h | 4 +- libs/jrtplib/src/rtpsessionparams.h | 2 +- libs/jrtplib/src/rtpsources.cpp | 23 +- libs/jrtplib/src/rtpsources.h | 10 +- libs/jrtplib/src/rtpstructs.h | 4 +- libs/jrtplib/src/rtpudpv4transmitter.cpp | 24 +- libs/jrtplib/src/rtpudpv4transmitter.h | 18 +- libs/jrtplib/src/rtpudpv6transmitter.cpp | 22 +- libs/jrtplib/src/rtpudpv6transmitter.h | 18 +- libs/jrtplib/src/win32/jmutex.cpp | 19 +- libs/jrtplib/src/win32/jthread.cpp | 3 +- 45 files changed, 1076 insertions(+), 939 deletions(-) create mode 100644 libs/jrtplib/src/jmutexautolock.h diff --git a/libs/jrtplib/ChangeLog b/libs/jrtplib/ChangeLog index 239a35ff94..a6e69c7755 100644 --- a/libs/jrtplib/ChangeLog +++ b/libs/jrtplib/ChangeLog @@ -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 diff --git a/libs/jrtplib/README.TXT b/libs/jrtplib/README.TXT index 033da420f2..a564506592 100644 --- a/libs/jrtplib/README.TXT +++ b/libs/jrtplib/README.TXT @@ -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. diff --git a/libs/jrtplib/configure b/libs/jrtplib/configure index 4c4bde9553..a82798bf1d 100755 --- a/libs/jrtplib/configure +++ b/libs/jrtplib/configure @@ -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 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 diff --git a/libs/jrtplib/configure.in b/libs/jrtplib/configure.in index 0f2548bb20..95a58095ab 100644 --- a/libs/jrtplib/configure.in +++ b/libs/jrtplib/configure.in @@ -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 " RTP_SOCKIO="// Don't have " @@ -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 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) diff --git a/libs/jrtplib/doc/jrtplib.tex b/libs/jrtplib/doc/jrtplib.tex index 4031effba4..88585ac735 100644 --- a/libs/jrtplib/doc/jrtplib.tex +++ b/libs/jrtplib/doc/jrtplib.tex @@ -1,6 +1,6 @@ \documentclass[12pt,a4paper]{article} -\newcommand{\jversion}{3.4.0} +\newcommand{\jversion}{3.5.2} \newcommand{\headerfile}[1]{\marginpar{\scriptsize Header:\\{\tt #1}}} \newcommand{\inherits}[1]{\marginpar{\scriptsize Inherits:\\{\tt #1}}} \newcommand{\Paragraph}[1]{\paragraph{#1}\ \\\addcontentsline{toc}{subsection}{\ \hspace{3cm}\ {#1}}} @@ -22,7 +22,7 @@ \begin{document} \title{\ \vspace{3.5cm}\ \\{\bf JRTPLIB \jversion}} \author{Jori Liesenborgs\\{\tt jori@lumumba.uhasselt.be}} - \date{January 19, 2006\\\vspace{0.5cm}\ \\ + \date{March 26, 2006\\\vspace{0.5cm}\ \\ {\small{\em Developed at the The Expertise Centre for \\Digital Media (EDM), a research institute\\of the Hasselt University}\\\ \\ {\tt http://www.edm.uhasselt.be/}\\ @@ -198,7 +198,7 @@ if (status < 0) Suppose that we want to send our data to a process running on the same host at port $9000$, we can do the following: \begin{lstlisting}[frame=tb]{} -u_int8_t localip[]={127,0,0,1}; +uint8_t localip[]={127,0,0,1}; RTPIPv4Address addr(localip,9000); status = session.AddDestination(addr); @@ -233,7 +233,7 @@ session.SetDefaultTimestampIncrement(160); $0.020$ seconds. We'll also store the current time so we'll know when one minute has passed. \begin{lstlisting}[frame=tb]{} -u_int8_t silencebuffer[160]; +uint8_t silencebuffer[160]; for (int i = 0 ; i < 160 ; i++) silencebuffer[i] = 128; @@ -371,12 +371,12 @@ session.BYEDestroy(delay,"Time's up",9); and least significant word (LSW) of an NTP timestamp. The class has the following members: \begin{itemize} - \item {\tt RTPNTPTime(u\_int32\_t m, u\_int32\_t l)}\\ + \item {\tt RTPNTPTime(uint32\_t m, uint32\_t l)}\\ This constructor creates and instance with MSW {\tt m} and LSW {\tt l}. - \item {\tt u\_int32\_t GetMSW() const}\\ + \item {\tt uint32\_t GetMSW() const}\\ Returns the most significant word. - \item {\tt u\_int32\_t GetLSW() const}\\ + \item {\tt uint32\_t GetLSW() const}\\ Returns the least significant word. \end{itemize} @@ -386,7 +386,7 @@ session.BYEDestroy(delay,"Time's up",9); etc. It stores a number of seconds and a number of microseconds and it has the following interface: \begin{itemize} - \item {\tt RTPTime(u\_int32\_t seconds, u\_int32\_t microseconds)}\\ + \item {\tt RTPTime(uint32\_t seconds, uint32\_t microseconds)}\\ Creates an instance corresponding to {\tt seconds} and {\tt microseconds}. \item {\tt RTPTime(double t)}\\ @@ -396,9 +396,9 @@ session.BYEDestroy(delay,"Time's up",9); Creates an instance that corresponds to {\tt ntptime}. If the conversion cannot be made, both the seconds and the microseconds are set to zero. - \item {\tt u\_int32\_t GetSeconds() const}\\ + \item {\tt uint32\_t GetSeconds() const}\\ Returns the number of seconds stored in this instance. - \item {\tt u\_int32\_t GetMicroSeconds() const}\\ + \item {\tt uint32\_t GetMicroSeconds() const}\\ Returns the number of microseconds stored in this instance. \item {\tt double GetDouble() const}\\ Returns the time stored in this instance, expressed in @@ -430,11 +430,11 @@ session.BYEDestroy(delay,"Time's up",9); The {\tt RTPRandom} class can be used to generate random numbers. It has the following member functions: \begin{itemize} - \item {\tt u\_int8\_t GetRandom8()}\\ + \item {\tt uint8\_t GetRandom8()}\\ Returns a random eight bit value. - \item {\tt u\_int16\_t GetRandom16()}\\ + \item {\tt uint16\_t GetRandom16()}\\ Returns a random sixteen bit value. - \item {\tt u\_int32\_t GetRandom32()}\\ + \item {\tt uint32\_t GetRandom32()}\\ Returns a random thirty-two bit value. \item {\tt double GetRandomDouble()}\\ Returns a random number between $0.0$ and $1.0$. @@ -447,58 +447,58 @@ session.BYEDestroy(delay,"Time's up",9); \begin{itemize} \item {\tt void Clear()}\\ Clears all SDES information. - \item {\tt int SetCNAME(const u\_int8\_t *s, size\_t l)}\\ + \item {\tt int SetCNAME(const uint8\_t *s, size\_t l)}\\ Sets the SDES CNAME item to {\tt s} with length {\tt l}. - \item {\tt int SetName(const u\_int8\_t *s, size\_t l)}\\ + \item {\tt int SetName(const uint8\_t *s, size\_t l)}\\ Sets the SDES name item to {\tt s} with length {\tt l}. - \item {\tt int SetEMail(const u\_int8\_t *s, size\_t l)}\\ + \item {\tt int SetEMail(const uint8\_t *s, size\_t l)}\\ Sets the SDES e-mail item to {\tt s} with length {\tt l}. - \item {\tt int SetPhone(const u\_int8\_t *s, size\_t l)}\\ + \item {\tt int SetPhone(const uint8\_t *s, size\_t l)}\\ Sets the SDES phone item to {\tt s} with length {\tt l}. - \item {\tt int SetLocation(const u\_int8\_t *s, size\_t l)}\\ + \item {\tt int SetLocation(const uint8\_t *s, size\_t l)}\\ Sets the SDES location item to {\tt s} with length {\tt l}. - \item {\tt int SetTool(const u\_int8\_t *s, size\_t l)}\\ + \item {\tt int SetTool(const uint8\_t *s, size\_t l)}\\ Sets the SDES tool item to {\tt s} with length {\tt l}. - \item {\tt int SetNote(const u\_int8\_t *s, size\_t l)}\\ + \item {\tt int SetNote(const uint8\_t *s, size\_t l)}\\ Sets the SDES note item to {\tt s} with length {\tt l}. - \item {\tt u\_int8\_t *GetCNAME(size\_t *len) const}\\ + \item {\tt uint8\_t *GetCNAME(size\_t *len) const}\\ Returns the SDES CNAME item and stores its length in {\tt len}. - \item {\tt u\_int8\_t *GetName(size\_t *len) const}\\ + \item {\tt uint8\_t *GetName(size\_t *len) const}\\ Returns the SDES name item and stores its length in {\tt len}. - \item {\tt u\_int8\_t *GetEMail(size\_t *len) const}\\ + \item {\tt uint8\_t *GetEMail(size\_t *len) const}\\ Returns the SDES e-mail item and stores its length in {\tt len}. - \item {\tt u\_int8\_t *GetPhone(size\_t *len) const}\\ + \item {\tt uint8\_t *GetPhone(size\_t *len) const}\\ Returns the SDES phone item and stores its length in {\tt len}. - \item {\tt u\_int8\_t *GetLocation(size\_t *len) const}\\ + \item {\tt uint8\_t *GetLocation(size\_t *len) const}\\ Returns the SDES location item and stores its length in {\tt len}. - \item {\tt u\_int8\_t *GetTool(size\_t *len) const}\\ + \item {\tt uint8\_t *GetTool(size\_t *len) const}\\ Returns the SDES tool item and stores its length in {\tt len}. - \item {\tt u\_int8\_t *GetNote(size\_t *len) const }\\ + \item {\tt uint8\_t *GetNote(size\_t *len) const }\\ Returns the SDES note item and stores its length in {\tt len}. \end{itemize} If SDES private item support was enabled at compile time, the following member functions are also available: \begin{itemize} - \item {\tt int SetPrivateValue(const u\_int8\_t *prefix, size\_t prefixlen, const u\_int8\_t *value, size\_t valuelen)}\\ + \item {\tt int SetPrivateValue(const uint8\_t *prefix, size\_t prefixlen, const uint8\_t *value, size\_t valuelen)}\\ Sets the entry for the prefix string specified by {\tt prefix} with length {\tt prefixlen} to contain the value string specified by {\tt value} with length {\tt valuelen}. If the maximum allowed number of prefixes was reached, the error code {\tt ERR\_\-RTP\_\-SDES\_\-MAX\-PRIV\-ITEMS} is returned. - \item {\tt int DeletePrivatePrefix(const u\_int8\_t *s, size\_t len)}\\ + \item {\tt int DeletePrivatePrefix(const uint8\_t *s, size\_t len)}\\ Deletes the entry for the prefix specified by {\tt s} with length {\tt len}. \item {\tt void GotoFirstPrivateValue()}\\ Starts the iteration over the stored SDES private item prefixes and their associated values. - \item {\tt bool GetNextPrivateValue(u\_int8\_t **prefix, size\_t *prefixlen, u\_int8\_t **value, size\_t *valuelen)}\\ + \item {\tt bool GetNextPrivateValue(uint8\_t **prefix, size\_t *prefixlen, uint8\_t **value, size\_t *valuelen)}\\ If available, returns {\tt true} and stores the next SDES private item prefix in {\tt prefix} and its length in {\tt prefixlen}. The associated value and its length are then stored in {\tt value} and {\tt valuelen}. Otherwise, it returns {\tt false}. - \item {\tt bool GetPrivateValue(const u\_int8\_t *prefix, size\_t prefixlen, u\_int8\_t **value, size\_t *valuelen) const}\\ + \item {\tt bool GetPrivateValue(const uint8\_t *prefix, size\_t prefixlen, uint8\_t **value, size\_t *valuelen) const}\\ Looks for the entry which corresponds to the SDES private item prefix {\tt prefix} with length {\tt prefixlen}. If found, the function returns {\tt true} and stores the associated @@ -568,7 +568,7 @@ session.BYEDestroy(delay,"Time's up",9); an instance of {\tt RTP\-UDPv4\-Trans\-mission\-Info} or {\tt RTP\-UDPv6\-Trans\-mission\-Info} is returned, depending on the type of the transmitter. The user has to delete the returned instance when it is no longer needed. - \item {\tt int GetLocalHostName(u\_int8\_t *buffer, size\_t *bufferlength)}\\ + \item {\tt int GetLocalHostName(uint8\_t *buffer, size\_t *bufferlength)}\\ Looks up the local host name based upon internal information about the local host's addresses. This function might take some time since a DNS query might be done. {\tt bufferlength} should initially @@ -609,9 +609,9 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt void ResetPacketCount()}\\ The transmitter keeps track of the amount of RTP and RTCP packets that were sent. This functions resets those counts. - \item {\tt u\_int32\_t GetNumRTPPacketsSent()}\\ + \item {\tt uint32\_t GetNumRTPPacketsSent()}\\ Returns the number of RTP packets sent. - \item {\tt u\_int32\_t GetNumRTCPPacketsSent()}\\ + \item {\tt uint32\_t GetNumRTCPPacketsSent()}\\ Returns the number of RTCP packets sent. \item {\tt int AddDestination(const RTPAddress \&addr)}\\ Adds the address specified by {\tt addr} to the list of @@ -704,29 +704,29 @@ session.BYEDestroy(delay,"Time's up",9); By default, the multicast TTL is set to $1$ and the portbase is set to $5000$. The interface of this class is the following: \begin{itemize} - \item {\tt void SetBindIP(u\_int32\_t ip)}\\ + \item {\tt void SetBindIP(uint32\_t ip)}\\ Sets the IP address which is used to bind the sockets to {\tt ip}. - \item {\tt void SetPortbase(u\_int16\_t pbase)}\\ + \item {\tt void SetPortbase(uint16\_t pbase)}\\ Sets the RTP portbase to {\tt pbase}. This has to be an even number. - \item {\tt void SetMulticastTTL(u\_int8\_t mcastTTL)}\\ + \item {\tt void SetMulticastTTL(uint8\_t mcastTTL)}\\ Sets the multicast TTL to be used to {\tt mcastTTL}. - \item {\tt void SetLocalIPList(std::list \&iplist)}\\ + \item {\tt void SetLocalIPList(std::list \&iplist)}\\ Passes a list of IP addresses which will be used as the local IP addresses. \item {\tt void ClearLocalIPList()}\\ Clears the list of local IP addresses. An empty list will make the transmission component itself determine the local IP addresses. - \item {\tt u\_int32\_t GetBindIP() const}\\ + \item {\tt uint32\_t GetBindIP() const}\\ Returns the IP address which will be used to bind the sockets. - \item {\tt u\_int16\_t GetPortbase() const}\\ + \item {\tt uint16\_t GetPortbase() const}\\ Returns the RTP portbase which will be used. - \item {\tt u\_int8\_t GetMulticastTTL() const}\\ + \item {\tt uint8\_t GetMulticastTTL() const}\\ Returns the multicast TTL which will be used. - \item {\tt const std::list \&GetLocalIPList() const}\\ + \item {\tt const std::list \&GetLocalIPList() const}\\ Returns the list of local IP addresses. \end{itemize} @@ -741,10 +741,10 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt void SetBindIP(in6\_addr ip)}\\ Sets the IP address which is used to bind the sockets to {\tt ip}. - \item {\tt void SetPortbase(u\_int16\_t pbase)}\\ + \item {\tt void SetPortbase(uint16\_t pbase)}\\ Sets the RTP portbase to {\tt pbase}. This has to be an even number. - \item {\tt void SetMulticastTTL(u\_int8\_t mcastTTL)}\\ + \item {\tt void SetMulticastTTL(uint8\_t mcastTTL)}\\ Sets the multicast TTL to be used to {\tt mcastTTL}. \item {\tt void SetLocalIPList(std::list \&iplist)}\\ Passes a list of IP addresses which will be used as @@ -756,9 +756,9 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt in6\_addr GetBindIP() const}\\ Returns the IP address which will be used to bind the sockets. - \item {\tt u\_int16\_t GetPortbase() const}\\ + \item {\tt uint16\_t GetPortbase() const}\\ Returns the RTP portbase which will be used. - \item {\tt u\_int8\_t GetMulticastTTL() const}\\ + \item {\tt uint8\_t GetMulticastTTL() const}\\ Returns the multicast TTL which will be used. \item {\tt const std::list \&GetLocalIPList() const}\\ Returns the list of local IP addresses. @@ -782,7 +782,7 @@ session.BYEDestroy(delay,"Time's up",9); information about the UDP over IPv4 transmission component. The following member functions are available: \begin{itemize} - \item {\tt std::list GetLocalIPList() const}\\ + \item {\tt std::list GetLocalIPList() const}\\ Returns the list of IPv4 addresses the transmitter considers to be the local IP addresses. \item {\tt int GetRTPSocket() const}\\ @@ -847,24 +847,24 @@ session.BYEDestroy(delay,"Time's up",9); This class is used by the UDP over IPv4 transmission component. The following member functions are defined in this class: \begin{itemize} - \item {\tt RTPIPv4Address(u\_int32\_t ip = 0, u\_int16\_t port = 0)}\\ + \item {\tt RTPIPv4Address(uint32\_t ip = 0, uint16\_t port = 0)}\\ Creates an instance with IP address {\tt ip} and port number {\tt port}. Both are interpreted in host byte order. - \item {\tt RTPIPv4Address(const u\_int8\_t ip[4], u\_int16\_t port = 0)}\\ + \item {\tt RTPIPv4Address(const uint8\_t ip[4], uint16\_t port = 0)}\\ Creates an instance with IP address {\tt ip} and port {\tt port}. The port number is interpreted in host byte order. - \item {\tt void SetIP(u\_int32\_t ip)}\\ + \item {\tt void SetIP(uint32\_t ip)}\\ Sets the IP address for this instance to {\tt ip} which is assumed to be in host byte order. - \item {\tt void SetIP(const u\_int8\_t ip[4])}\\ + \item {\tt void SetIP(const uint8\_t ip[4])}\\ Sets the IP address of this instance to {\tt ip}. - \item {\tt void SetPort(u\_int16\_t port)}\\ + \item {\tt void SetPort(uint16\_t port)}\\ Sets the port number for this instance to {\tt port} which is interpreted in host byte order. - \item {\tt u\_int32\_t GetIP() const}\\ + \item {\tt uint32\_t GetIP() const}\\ Returns the IP address contained in this instance in host byte order. - \item {\tt u\_int16\_t GetPort() const}\\ + \item {\tt uint16\_t GetPort() const}\\ Returns the port number of this instance in host byte order. \end{itemize} @@ -884,26 +884,26 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt RTPIPv6Address()}\\ Creates an instance with IP address and port number set to zero. - \item {\tt RTPIPv6Address(const u\_int8\_t ip[16], u\_int16\_t port = 0)}\\ + \item {\tt RTPIPv6Address(const uint8\_t ip[16], uint16\_t port = 0)}\\ Creates an instance with IP address {\tt ip} and port number {\tt port}. The port number is assumed to be in host byte order. - \item {\tt RTPIPv6Address(in6\_addr ip, u\_int16\_t port = 0)}\\ + \item {\tt RTPIPv6Address(in6\_addr ip, uint16\_t port = 0)}\\ Creates an instance with IP address {\tt ip} and port number {\tt port}. The port number is assumed to be in host byte order. \item {\tt void SetIP(in6\_addr ip)}\\ Sets the IP address for this instance to {\tt ip}. - \item {\tt void SetIP(const u\_int8\_t ip[16])}\\ + \item {\tt void SetIP(const uint8\_t ip[16])}\\ Sets the IP address for this instance to {\tt ip}. - \item {\tt void SetPort(u\_int16\_t port)}\\ + \item {\tt void SetPort(uint16\_t port)}\\ Sets the port number for this instance to {\tt port}, which is interpreted in host byte order. - \item {\tt void GetIP(u\_int8\_t ip[16]) const}\\ + \item {\tt void GetIP(uint8\_t ip[16]) const}\\ Copies the IP address of this instance in {\tt ip}. \item {\tt in6\_addr GetIP() const}\\ Returns the IP address of this instance. - \item {\tt u\_int16\_t GetPort() const}\\ + \item {\tt uint16\_t GetPort() const}\\ Returns the port number contained in this instance in host byte order. \end{itemize} @@ -920,7 +920,7 @@ session.BYEDestroy(delay,"Time's up",9); to store the incoming RTP and RTCP data in. It has the following interface: \begin{itemize} - \item {\tt RTPRawPacket(u\_int8\_t *data, size\_t datalen, RTPAddress *address, RTPTime \&recvtime, bool rtp)}\\ + \item {\tt RTPRawPacket(uint8\_t *data, size\_t datalen, RTPAddress *address, RTPTime \&recvtime, bool rtp)}\\ Creates an instance which stores data from {\tt data} with length {\tt datalen}. Only the pointer to the data is stored, no actual copy is made! The address from which this packet @@ -928,7 +928,7 @@ session.BYEDestroy(delay,"Time's up",9); the packet was received is set to {\tt recvtime}. The flag which indicates whether this data is RTP or RTCP data is set to {\tt rtp}. - \item {\tt u\_int8\_t *GetData()}\\ + \item {\tt uint8\_t *GetData()}\\ Returns the pointer to the data which is contained in this packet. \item {\tt size\_t GetDataLength() const}\\ @@ -960,9 +960,9 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt RTPPacket(RTPRawPacket \&rawpack)}\\ Creates an RTPPacket instance based upon the data in {\tt rawpack}. - \item {\tt RTPPacket(u\_int8\_t payloadtype, const void *payloaddata, size\_t payloadlen, u\_int16\_t seqnr, - u\_int32\_t timestamp, u\_int32\_t ssrc, bool gotmarker, u\_int8\_t numcsrcs, const u\_int32\_t *csrcs, - bool gotextension, u\_int16\_t extensionid, u\_int16\_t extensionlen\_numwords, const void *extensiondata, + \item {\tt RTPPacket(uint8\_t payloadtype, const void *payloaddata, size\_t payloadlen, uint16\_t seqnr, + uint32\_t timestamp, uint32\_t ssrc, bool gotmarker, uint8\_t numcsrcs, const uint32\_t *csrcs, + bool gotextension, uint16\_t extensionid, uint16\_t extensionlen\_numwords, const void *extensiondata, size\_t maxpacksize = 0)}\\ Creates an new buffer for an RTP packet and fills in the fields according to the specified parameters. If {\tt maxpacksize} is @@ -970,9 +970,9 @@ session.BYEDestroy(delay,"Time's up",9); would exceed {\tt maxpacksize}. The arguments of the constructor are self-explanatory. Note that the size of a header extension is specified in a number of $32$-bit words. - \item {\tt RTPPacket(u\_int8\_t payloadtype, const void *payloaddata, size\_t payloadlen, u\_int16\_t seqnr, - u\_int32\_t timestamp, u\_int32\_t ssrc, bool gotmarker, u\_int8\_t numcsrcs, const u\_int32\_t *csrcs, - bool gotextension, u\_int16\_t extensionid, u\_int16\_t extensionlen\_numwords, const void *extensiondata, + \item {\tt RTPPacket(uint8\_t payloadtype, const void *payloaddata, size\_t payloadlen, uint16\_t seqnr, + uint32\_t timestamp, uint32\_t ssrc, bool gotmarker, uint8\_t numcsrcs, const uint32\_t *csrcs, + bool gotextension, uint16\_t extensionid, uint16\_t extensionlen\_numwords, const void *extensiondata, void *buffer, size\_t buffersize)}\\ Pretty much the same function as the previous one, except that data is stored in an external buffer {\tt buffer} with buffer size {\tt buffersize}. @@ -987,35 +987,35 @@ session.BYEDestroy(delay,"Time's up",9); otherwise. \item {\tt int GetCSRCCount() const}\\ Returns the number of CSRCs contained in this packet. - \item {\tt u\_int32\_t GetCSRC(int num) const}\\ + \item {\tt uint32\_t GetCSRC(int num) const}\\ Returns a specific CSRC identifier. The parameter {\tt num} can go from $0$ to {\tt GetCSRCCount()}-$1$. - \item {\tt u\_int8\_t GetPayloadType() const}\\ + \item {\tt uint8\_t GetPayloadType() const}\\ Returns the payload type of the packet. - \item {\tt u\_int32\_t GetExtendedSequenceNumber() const}\\ + \item {\tt uint32\_t GetExtendedSequenceNumber() const}\\ Returns the extended sequence number of the packet. When the packet is just received, only the low $16$ bits will be set. The high $16$ bits can be filled in later. - \item {\tt u\_int16\_t GetSequenceNumber() const}\\ + \item {\tt uint16\_t GetSequenceNumber() const}\\ Returns the sequence number of this packet. - \item {\tt void SetExtendedSequenceNumber(u\_int32\_t seq)}\\ + \item {\tt void SetExtendedSequenceNumber(uint32\_t seq)}\\ Sets the extended sequence number of this packet to {\tt seq}. - \item {\tt u\_int32\_t GetTimestamp() const}\\ + \item {\tt uint32\_t GetTimestamp() const}\\ Returns the timestamp of this packet. - \item {\tt u\_int32\_t GetSSRC() const}\\ + \item {\tt uint32\_t GetSSRC() const}\\ Returns the SSRC identifier stored in this packet. - \item {\tt u\_int8\_t *GetPacketData() const}\\ + \item {\tt uint8\_t *GetPacketData() const}\\ Returns a pointer to the data of the entire packet. - \item {\tt u\_int8\_t *GetPayloadData() const}\\ + \item {\tt uint8\_t *GetPayloadData() const}\\ Returns a pointer to the actual payload data. \item {\tt size\_t GetPacketLength() const}\\ Returns the length of the entire packet. \item {\tt size\_t GetPayloadLength() const}\\ Returns the payload length. - \item {\tt u\_int16\_t GetExtensionID() const}\\ + \item {\tt uint16\_t GetExtensionID() const}\\ If a header extension is present, this function returns the extension identifier. - \item {\tt u\_int8\_t *GetExtensionData() const}\\ + \item {\tt uint8\_t *GetExtensionData() const}\\ Returns a pointer to the header extension data. \item {\tt size\_t GetExtensionLength() const}\\ Returns the length of the header extension data. @@ -1039,7 +1039,7 @@ session.BYEDestroy(delay,"Time's up",9); be parsed, this function returns the error code of what went wrong. If the packet had an invalid format, the return value is {\tt ERR\_\-RTP\_\-RTCPCOMPOUND\_\-INVALID\-PACKET}. - \item {\tt u\_int8\_t *GetCompoundPacketData()}\\ + \item {\tt uint8\_t *GetCompoundPacketData()}\\ Returns a pointer to the data of the entire RTCP compound packet. \item {\tt size\_t GetCompoundPacketLength()}\\ Returns the size of the entire RTCP compound packet @@ -1078,7 +1078,7 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt RTCPPacket::APP}: indicates an {\tt RTCPAPPPacket} instance \item {\tt RTCPPacket::Unknown}: indicates an {\tt RTCPUnknownPacket} instance \end{itemize} - \item {\tt u\_int8\_t *GetPacketData()}\\ + \item {\tt uint8\_t *GetPacketData()}\\ Returns a pointer to the data of this RTCP packet. \item {\tt size\_t GetPacketLength() const}\\ Returns the length of this RTCP packet. @@ -1089,33 +1089,33 @@ session.BYEDestroy(delay,"Time's up",9); This class describes an RTCP sender report packet. The interface is the following: \begin{itemize} - \item {\tt RTCPSRPacket(u\_int8\_t *data, size\_t datalen)}\\ + \item {\tt RTCPSRPacket(uint8\_t *data, size\_t datalen)}\\ Creates an instance based on the data in {\tt data} with length {\tt datalen}. Since the {\tt data} pointer is referenced inside the class (no copy of the data is made) one must make sure that the memory it points to is valid as long as the class instance exists. - \item {\tt u\_int32\_t GetSenderSSRC() const}\\ + \item {\tt uint32\_t GetSenderSSRC() const}\\ Returns the SSRC of the participant who sent this packet. \item {\tt RTPNTPTime GetNTPTimestamp() const}\\ Returns the NTP timestamp contained in the sender report. - \item {\tt u\_int32\_t GetRTPTimestamp() const}\\ + \item {\tt uint32\_t GetRTPTimestamp() const}\\ Returns the RTP timestamp contained in the sender report. - \item {\tt u\_int32\_t GetSenderPacketCount() const}\\ + \item {\tt uint32\_t GetSenderPacketCount() const}\\ Returns the sender's packet count contained in the sender report. - \item {\tt u\_int32\_t GetSenderOctetCount() const}\\ + \item {\tt uint32\_t GetSenderOctetCount() const}\\ Returns the sender's octet count contained in the sender report. \item {\tt int GetReceptionReportCount() const}\\ Returns the number of reception report blocks present in this packet. - \item {\tt u\_int32\_t GetSSRC(int index) const}\\ + \item {\tt uint32\_t GetSSRC(int index) const}\\ Returns the SSRC of the reception report block described by {\tt index} which may have a value from $0$ to {\tt GetReceptionReportCount()}-$1$. Note that no check is performed to see if {\tt index} is valid. - \item {\tt u\_int8\_t GetFractionLost(int index) const}\\ + \item {\tt uint8\_t GetFractionLost(int index) const}\\ Returns the `fraction lost' field of the reception report described by {\tt index} which may have a value from $0$ to {\tt GetReceptionReportCount()}-$1$. Note that @@ -1125,22 +1125,22 @@ session.BYEDestroy(delay,"Time's up",9); report block described by {\tt index} which may have a value from $0$ to {\tt GetReceptionReportCount()}-$1$. Note that no check is performed to see if {\tt index} is valid. - \item {\tt u\_int32\_t GetExtendedHighestSequenceNumber(int index) const}\\ + \item {\tt uint32\_t GetExtendedHighestSequenceNumber(int index) const}\\ Returns the extended highest sequence number of the reception report block described by {\tt index} which may have a value from $0$ to {\tt GetReception\-Report\-Count()}-$1$. Note that no check is performed to see if {\tt index} is valid. - \item {\tt u\_int32\_t GetJitter(int index) const}\\ + \item {\tt uint32\_t GetJitter(int index) const}\\ Returns the jitter field of the reception report block described by {\tt index} which may have a value from $0$ to {\tt GetReceptionReportCount()}-$1$. Note that no check is performed to see if {\tt index} is valid. - \item {\tt u\_int32\_t GetLSR(int index) const}\\ + \item {\tt uint32\_t GetLSR(int index) const}\\ Returns the LSR field of the reception report block described by {\tt index} which may have a value from $0$ to {\tt GetReceptionReportCount()}-$1$. Note that no check is performed to see if {\tt index} is valid. - \item {\tt u\_int32\_t GetDLSR(int index) const}\\ + \item {\tt uint32\_t GetDLSR(int index) const}\\ Returns the DLSR field of the reception report block described by {\tt index} which may have a value from $0$ to {\tt GetReceptionReportCount()}-$1$. Note that @@ -1152,23 +1152,23 @@ session.BYEDestroy(delay,"Time's up",9); This class describes an RTCP receiver report packet. The interface is the following: \begin{itemize} - \item {\tt RTCPRRPacket(u\_int8\_t *data, size\_t datalen)}\\ + \item {\tt RTCPRRPacket(uint8\_t *data, size\_t datalen)}\\ Creates an instance based on the data in {\tt data} with length {\tt datalen}. Since the {\tt data} pointer is referenced inside the class (no copy of the data is made) one must make sure that the memory it points to is valid as long as the class instance exists. - \item {\tt u\_int32\_t GetSenderSSRC() const}\\ + \item {\tt uint32\_t GetSenderSSRC() const}\\ Returns the SSRC of the participant who sent this packet. \item {\tt int GetReceptionReportCount() const}\\ Returns the number of reception report blocks present in this packet. - \item {\tt u\_int32\_t GetSSRC(int index) const}\\ + \item {\tt uint32\_t GetSSRC(int index) const}\\ Returns the SSRC of the reception report block described by {\tt index} which may have a value from $0$ to {\tt GetReceptionReportCount()}-$1$. Note that no check is performed to see if {\tt index} is valid. - \item {\tt u\_int8\_t GetFractionLost(int index) const}\\ + \item {\tt uint8\_t GetFractionLost(int index) const}\\ Returns the `fraction lost' field of the reception report described by {\tt index} which may have a value from $0$ to {\tt GetReceptionReportCount()}-$1$. Note that @@ -1178,22 +1178,22 @@ session.BYEDestroy(delay,"Time's up",9); report block described by {\tt index} which may have a value from $0$ to {\tt GetReceptionReportCount()}-$1$. Note that no check is performed to see if {\tt index} is valid. - \item {\tt u\_int32\_t GetExtendedHighestSequenceNumber(int index) const}\\ + \item {\tt uint32\_t GetExtendedHighestSequenceNumber(int index) const}\\ Returns the extended highest sequence number of the reception report block described by {\tt index} which may have a value from $0$ to {\tt GetReception\-Report\-Count()}-$1$. Note that no check is performed to see if {\tt index} is valid. - \item {\tt u\_int32\_t GetJitter(int index) const}\\ + \item {\tt uint32\_t GetJitter(int index) const}\\ Returns the jitter field of the reception report block described by {\tt index} which may have a value from $0$ to {\tt GetReceptionReportCount()}-$1$. Note that no check is performed to see if {\tt index} is valid. - \item {\tt u\_int32\_t GetLSR(int index) const}\\ + \item {\tt uint32\_t GetLSR(int index) const}\\ Returns the LSR field of the reception report block described by {\tt index} which may have a value from $0$ to {\tt GetReceptionReportCount()}-$1$. Note that no check is performed to see if {\tt index} is valid. - \item {\tt u\_int32\_t GetDLSR(int index) const}\\ + \item {\tt uint32\_t GetDLSR(int index) const}\\ Returns the DLSR field of the reception report block described by {\tt index} which may have a value from $0$ to {\tt GetReceptionReportCount()}-$1$. Note that @@ -1215,7 +1215,7 @@ session.BYEDestroy(delay,"Time's up",9); The class interface is the following: \begin{itemize} - \item {\tt RTCPSDESPacket(u\_int8\_t *data, size\_t datalen)}\\ + \item {\tt RTCPSDESPacket(uint8\_t *data, size\_t datalen)}\\ Creates an instance based on the data in {\tt data} with length {\tt datalen}. Since the {\tt data} pointer is referenced inside the class (no copy of the data is @@ -1233,7 +1233,7 @@ session.BYEDestroy(delay,"Time's up",9); Sets the current chunk to the next available chunk. If no next chunk is present, this function returns {\tt false}, otherwise it returns {\tt true}. - \item {\tt u\_int32\_t GetChunkSSRC() const}\\ + \item {\tt uint32\_t GetChunkSSRC() const}\\ Returns the SSRC identifier of the current chunk. \item {\tt bool GotoFirstItem()}\\ Starts the iteration over the SDES items in the current @@ -1250,7 +1250,7 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt size\_t GetItemLength() const}\\ Returns the item length of the current item in the current chunk. - \item {\tt u\_int8\_t *GetItemData()}\\ + \item {\tt uint8\_t *GetItemData()}\\ Returns the item data of the current item in the current chunk. \end{itemize} @@ -1261,12 +1261,12 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt size\_t GetPRIVPrefixLength()}\\ Returns the length of the prefix string of the private item. - \item {\tt u\_int8\_t *GetPRIVPrefixData()}\\ + \item {\tt uint8\_t *GetPRIVPrefixData()}\\ Returns the actual data of the prefix string. \item {\tt size\_t GetPRIVValueLength()}\\ Returns the length of the value string of the private item. - \item {\tt u\_int8\_t *GetPRIVValueData()}\\ + \item {\tt uint8\_t *GetPRIVValueData()}\\ Returns the actual value data of the private item. \end{itemize} @@ -1275,20 +1275,20 @@ session.BYEDestroy(delay,"Time's up",9); The class {\tt RTCPAPPPacket} describes an RTCP APP packet. The following member functions are available: \begin{itemize} - \item {\tt RTCPAPPPacket(u\_int8\_t *data, size\_t datalen)}\\ + \item {\tt RTCPAPPPacket(uint8\_t *data, size\_t datalen)}\\ Creates an instance based on the data in {\tt data} with length {\tt datalen}. Since the {\tt data} pointer is referenced inside the class (no copy of the data is made) one must make sure that the memory it points to is valid as long as the class instance exists. - \item {\tt u\_int8\_t GetSubType() const}\\ + \item {\tt uint8\_t GetSubType() const}\\ Returns the subtype contained in the APP packet. - \item {\tt u\_int32\_t GetSSRC() const}\\ + \item {\tt uint32\_t GetSSRC() const}\\ Returns the SSRC of the source which sent this packet. - \item {\tt u\_int8\_t *GetName()}\\ + \item {\tt uint8\_t *GetName()}\\ Returns the name contained in the APP packet. This always consists of four bytes and is not NULL-terminated. - \item {\tt u\_int8\_t *GetAPPData()}\\ + \item {\tt uint8\_t *GetAPPData()}\\ Returns a pointer to the actual data. \item {\tt size\_t GetAPPDataLength() const}\\ Returns the length of the actual data. @@ -1299,7 +1299,7 @@ session.BYEDestroy(delay,"Time's up",9); An RTCP BYE packet is represented by the class {\tt RTCPBYEPacket} which has the following member functions: \begin{itemize} - \item {\tt RTCPBYEPacket(u\_int8\_t *data, size\_t datalen)}\\ + \item {\tt RTCPBYEPacket(uint8\_t *data, size\_t datalen)}\\ Creates an instance based on the data in {\tt data} with length {\tt datalen}. Since the {\tt data} pointer is referenced inside the class (no copy of the data is @@ -1308,7 +1308,7 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt int GetSSRCCount() const}\\ Returns the number of SSRC identifiers present in this BYE packet. - \item {\tt u\_int32\_t GetSSRC(int index) const}\\ + \item {\tt uint32\_t GetSSRC(int index) const}\\ Returns the SSRC described by {\tt index} which may have a value from $0$ to {\tt GetSSRCCount()}-$1$. Note that no check is performed to see if {\tt index} is valid. @@ -1318,7 +1318,7 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt size\_t GetReasonLength() const}\\ Returns the length of the string which describes why the source(s) left. - \item {\tt u\_int8\_t *GetReasonData()}\\ + \item {\tt uint8\_t *GetReasonData()}\\ Returns the actual reason data. \end{itemize} @@ -1330,7 +1330,7 @@ session.BYEDestroy(delay,"Time's up",9); function will trivially return {\tt true}. Only the following constructor is available: \begin{itemize} - \item {\tt RTCPUnknownPacket(u\_int8\_t *data, size\_t datalen)}\\ + \item {\tt RTCPUnknownPacket(uint8\_t *data, size\_t datalen)}\\ Creates an instance based on the data in {\tt data} with length {\tt datalen}. Since the {\tt data} pointer is referenced inside the class (no copy of the data is @@ -1355,33 +1355,33 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt int InitBuild(void *externalbuffer, size\_t buffersize)}\\ Starts building a packet. Data will be stored in {\tt externalbuffer} which can contain {\tt buffersize} bytes. - \item {\tt int StartSenderReport(u\_int32\_t senderssrc, const RTPNTPTime \&ntptimestamp, u\_int32\_t rtptimestamp, - u\_int32\_t packetcount, u\_int32\_t octetcount)}\\ + \item {\tt int StartSenderReport(uint32\_t senderssrc, const RTPNTPTime \&ntptimestamp, uint32\_t rtptimestamp, + uint32\_t packetcount, uint32\_t octetcount)}\\ Tells the packet builder that the packet should start with a sender report which will contain the sender information specified by this function's arguments. Once the sender report is started, report blocks can be added using the {\tt AddReportBlock} function. - \item {\tt int StartReceiverReport(u\_int32\_t senderssrc)}\\ + \item {\tt int StartReceiverReport(uint32\_t senderssrc)}\\ Tells the packet builder that the packet should start with a receiver report which will contain the sender SSRC {\tt senderssrc}. Once the sender report is started, report blocks can be added using the {\tt AddReportBlock} function. - \item {\tt int AddReportBlock(u\_int32\_t ssrc, u\_int8\_t fractionlost, int32\_t packetslost, u\_int32\_t exthighestseq, - u\_int32\_t jitter, u\_int32\_t lsr, u\_int32\_t dlsr)}\\ + \item {\tt int AddReportBlock(uint32\_t ssrc, uint8\_t fractionlost, int32\_t packetslost, uint32\_t exthighestseq, + uint32\_t jitter, uint32\_t lsr, uint32\_t dlsr)}\\ Adds the report block information specified by the function's arguments. If more than 31 report blocks are added, the builder will automatically use a new RTCP receiver report packet. - \item {\tt int AddSDESSource(u\_int32\_t ssrc)}\\ + \item {\tt int AddSDESSource(uint32\_t ssrc)}\\ Starts an SDES chunk for participant {\tt ssrc}. - \item {\tt int AddSDESNormalItem(RTCPSDESPacket::ItemType t, const void *itemdata, u\_int8\_t itemlength)}\\ + \item {\tt int AddSDESNormalItem(RTCPSDESPacket::ItemType t, const void *itemdata, uint8\_t itemlength)}\\ Adds a normal (non-private) SDES item of type {\tt t} to the current SDES chunk. The item's value will have length {\tt itemlength} and will contain the data {\tt itemdata}. - \item {\tt int AddBYEPacket(u\_int32\_t *ssrcs, u\_int8\_t numssrcs, const void *reasondata, u\_int8\_t reasonlength)}\\ + \item {\tt int AddBYEPacket(uint32\_t *ssrcs, uint8\_t numssrcs, const void *reasondata, uint8\_t reasonlength)}\\ Adds a BYE packet to the compound packet. It will contain {\tt numssrcs} source identifiers specified in {\tt ssrcs} and will indicate as reason for leaving the string of length {\tt reasonlength} containing data {\tt reasondata}. - \item {\tt int AddAPPPacket(u\_int8\_t subtype, u\_int32\_t ssrc, const u\_int8\_t name[4], const void *appdata, size\_t appdatalen)}\\ + \item {\tt int AddAPPPacket(uint8\_t subtype, uint32\_t ssrc, const uint8\_t name[4], const void *appdata, size\_t appdatalen)}\\ Adds the APP packet specified by the arguments to the compound packet. Note that {\tt appdatalen} has to be a multiple of four. @@ -1394,8 +1394,8 @@ session.BYEDestroy(delay,"Time's up",9); If the library was compiled with SDES private item support, the following member function is also available: \begin{itemize} - \item {\tt int AddSDESPrivateItem(const void *prefixdata, u\_int8\_t prefixlength, const void *valuedata, - u\_int8\_t valuelength)}\\ + \item {\tt int AddSDESPrivateItem(const void *prefixdata, uint8\_t prefixlength, const void *valuedata, + uint8\_t valuelength)}\\ Adds an SDES PRIV item described by the function's arguments to the current SDES chunk. \end{itemize} @@ -1431,7 +1431,7 @@ session.BYEDestroy(delay,"Time's up",9); enabled at compilation time. \item {\tt void Clear()}\\ Clears the source table. - \item {\tt int CreateOwnSSRC(u\_int32\_t ssrc)}\\ + \item {\tt int CreateOwnSSRC(uint32\_t ssrc)}\\ Creates an entry for our own SSRC identifier. \item {\tt int DeleteOwnSSRC()}\\ Deletes the entry for our own SSRC identifier. @@ -1462,38 +1462,38 @@ session.BYEDestroy(delay,"Time's up",9); which was received at time {\tt receivetime} from {\tt senderaddress}. The {\tt senderaddress} parameter must be NULL if the packet was sent by the local participant. - \item {\tt int ProcessRTCPSenderInfo(u\_int32\_t ssrc, const RTPNTPTime \&ntptime, u\_int32\_t rtptime, - u\_int32\_t packetcount, u\_int32\_t octetcount, const RTPTime \&receivetime, + \item {\tt int ProcessRTCPSenderInfo(uint32\_t ssrc, const RTPNTPTime \&ntptime, uint32\_t rtptime, + uint32\_t packetcount, uint32\_t octetcount, const RTPTime \&receivetime, const RTPAddress *senderaddress)}\\ Process the sender information of SSRC {\tt ssrc} into the source table. The information was received at time {\tt receivetime} from address {\tt senderaddress}. The {\tt senderaddress} parameter must be NULL if the packet was sent by the local participant. - \item {\tt int ProcessRTCPReportBlock(u\_int32\_t ssrc, u\_int8\_t fractionlost, int32\_t lostpackets, - u\_int32\_t exthighseqnr, u\_int32\_t jitter, u\_int32\_t lsr, - u\_int32\_t dlsr, const RTPTime \&receivetime, const RTPAddress *senderaddress)}\\ + \item {\tt int ProcessRTCPReportBlock(uint32\_t ssrc, uint8\_t fractionlost, int32\_t lostpackets, + uint32\_t exthighseqnr, uint32\_t jitter, uint32\_t lsr, + uint32\_t dlsr, const RTPTime \&receivetime, const RTPAddress *senderaddress)}\\ Processes the report block information which was sent by participant {\tt ssrc} into the source table. The information was received at time {\tt receivetime} from address {\tt senderaddress}. The {\tt senderaddress} parameter must be NULL if the packet was sent by the local participant. - \item {\tt int ProcessSDESNormalItem(u\_int32\_t ssrc, RTCPSDESPacket::ItemType t, size\_t itemlength, + \item {\tt int ProcessSDESNormalItem(uint32\_t ssrc, RTCPSDESPacket::ItemType t, size\_t itemlength, const void *itemdata, const RTPTime \&receivetime, const RTPAddress *senderaddress)}\\ Processes the non-private SDES item from source {\tt ssrc} into the source table. The information was received at time {\tt receivetime} from address {\tt senderaddress}. The {\tt senderaddress} parameter must be NULL if the packet was sent by the local participant. - \item {\tt int ProcessBYE(u\_int32\_t ssrc, size\_t reasonlength, const void *reasondata, const RTPTime \&receivetime, + \item {\tt int ProcessBYE(uint32\_t ssrc, size\_t reasonlength, const void *reasondata, const RTPTime \&receivetime, const RTPAddress *senderaddress)}\\ Processes the BYE message for SSRC {\tt ssrc}. The information was received at time {\tt receivetime} from address {\tt senderaddress}. The {\tt senderaddress} parameter must be NULL if the packet was sent by the local participant. - \item {\tt int UpdateReceiveTime(u\_int32\_t ssrc, const RTPTime \&receivetime, const RTPAddress *senderaddress)}\\ + \item {\tt int UpdateReceiveTime(uint32\_t ssrc, const RTPTime \&receivetime, const RTPAddress *senderaddress)}\\ If we heard from source {\tt ssrc}, but no actual data was added to the source table (for example, if no report block was meant for us), this function can @@ -1533,13 +1533,13 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt RTPSourceData *GetCurrentSourceInfo()}\\ Returns the {\tt RTPSourceData} instance for the currently selected participant. - \item {\tt RTPSourceData *GetSourceInfo(u\_int32\_t ssrc)}\\ + \item {\tt RTPSourceData *GetSourceInfo(uint32\_t ssrc)}\\ Returns the {\tt RTPSourceData} instance for the participant identified by {\tt ssrc}, or NULL if no such entry exists. \item {\tt RTPPacket *GetNextPacket()}\\ Extracts the next packet from the received packets queue of the current participant. - \item {\tt bool GotEntry(u\_int32\_t ssrc)}\\ + \item {\tt bool GotEntry(uint32\_t ssrc)}\\ Returns {\tt true} if an entry for participant {\tt ssrc} exists and {\tt false} otherwise. \item {\tt RTPSourceData *GetOwnSourceInfo()}\\ @@ -1580,7 +1580,7 @@ session.BYEDestroy(delay,"Time's up",9); If SDES private item support was enabled at compile-time, the following member function is also available: \begin{itemize} - \item {\tt int ProcessSDESPrivateItem(u\_int32\_t ssrc, size\_t prefixlen, const void *prefixdata, + \item {\tt int ProcessSDESPrivateItem(uint32\_t ssrc, size\_t prefixlen, const void *prefixdata, size\_t valuelen, const void *valuedata, const RTPTime \&receivetime, const RTPAddress *senderaddress)}\\ Processes the SDES private item from source {\tt ssrc} @@ -1607,7 +1607,7 @@ session.BYEDestroy(delay,"Time's up",9); addresses and {\tt isrtp} indicates against which address of {\tt srcdat} the check failed. \item {\tt void OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, - const u\_int8\_t *cname, size\_t cnamelength)}\\ + const uint8\_t *cname, size\_t cnamelength)}\\ Is called when another CNAME was received than the one already present for source {\tt srcdat}. \item {\tt void OnNewSource(RTPSourceData *srcdat)}\\ @@ -1646,7 +1646,7 @@ session.BYEDestroy(delay,"Time's up",9); The {\tt RTPSourceData} class contains all information about a member of the session. The interface is the following: \begin{itemize} - \item {\tt u\_int32\_t GetSSRC() const}\\ + \item {\tt uint32\_t GetSSRC() const}\\ Returns the SSRC identifier for this member. \item {\tt bool HasData() const}\\ Returns {\tt true} if there are RTP packets which can be extracted. @@ -1696,7 +1696,7 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt bool ReceivedBYE() const}\\ Returns {\tt true} if we received a BYE message for this participant and {\tt false} otherwise. - \item {\tt u\_int8\_t *GetBYEReason(size\_t *len) const}\\ + \item {\tt uint8\_t *GetBYEReason(size\_t *len) const}\\ Returns the reason for leaving contained in the BYE packet of this participant. The length of the reason is stored in {\tt len}. \item {\tt RTPTime GetBYETime() const}\\ @@ -1714,11 +1714,11 @@ session.BYEDestroy(delay,"Time's up",9); Returns {\tt true} if an RTCP sender report has been received from this participant. \item {\tt RTPNTPTime SR\_GetNTPTimestamp() const}\\ Returns the NTP timestamp contained in the last sender report. - \item {\tt u\_int32\_t SR\_GetRTPTimestamp() const}\\ + \item {\tt uint32\_t SR\_GetRTPTimestamp() const}\\ Returns the RTP timestamp contained in the last sender report. - \item {\tt u\_int32\_t SR\_GetPacketCount() const}\\ + \item {\tt uint32\_t SR\_GetPacketCount() const}\\ Returns the packet count contained in the last sender report. - \item {\tt u\_int32\_t SR\_GetByteCount() const}\\ + \item {\tt uint32\_t SR\_GetByteCount() const}\\ Returns the octet count contained in the last sender report. \item {\tt RTPTime SR\_GetReceiveTime() const}\\ Returns the time at which the last sender report was received. @@ -1726,11 +1726,11 @@ session.BYEDestroy(delay,"Time's up",9); Returns {\tt true} if more than one RTCP sender report has been received. \item {\tt RTPNTPTime SR\_Prev\_GetNTPTimestamp() const}\\ Returns the NTP timestamp contained in the second to last sender report. - \item {\tt u\_int32\_t SR\_Prev\_GetRTPTimestamp() const}\\ + \item {\tt uint32\_t SR\_Prev\_GetRTPTimestamp() const}\\ Returns the RTP timestamp contained in the second to last sender report. - \item {\tt u\_int32\_t SR\_Prev\_GetPacketCount() const}\\ + \item {\tt uint32\_t SR\_Prev\_GetPacketCount() const}\\ Returns the packet count contained in the second to last sender report. - \item {\tt u\_int32\_t SR\_Prev\_GetByteCount() const}\\ + \item {\tt uint32\_t SR\_Prev\_GetByteCount() const}\\ Returns the octet count contained in the second to last sender report. \item {\tt RTPTime SR\_Prev\_GetReceiveTime() const}\\ Returns the time at which the second to last sender report was received. @@ -1741,13 +1741,13 @@ session.BYEDestroy(delay,"Time's up",9); Returns the fraction lost value from the last report. \item {\tt int32\_t RR\_GetPacketsLost() const}\\ Returns the number of lost packets contained in the last report. - \item {\tt u\_int32\_t RR\_GetExtendedHighestSequenceNumber() const}\\ + \item {\tt uint32\_t RR\_GetExtendedHighestSequenceNumber() const}\\ Returns the extended highest sequence number contained in the last report. - \item {\tt u\_int32\_t RR\_GetJitter() const}\\ + \item {\tt uint32\_t RR\_GetJitter() const}\\ Returns the jitter value from the last report. - \item {\tt u\_int32\_t RR\_GetLastSRTimestamp() const}\\ + \item {\tt uint32\_t RR\_GetLastSRTimestamp() const}\\ Returns the LSR value from the last report. - \item {\tt u\_int32\_t RR\_GetDelaySinceLastSR() const}\\ + \item {\tt uint32\_t RR\_GetDelaySinceLastSR() const}\\ Returns the DLSR value from the last report. \item {\tt RTPTime RR\_GetReceiveTime() const}\\ Returns the time at which the last report was received. @@ -1758,13 +1758,13 @@ session.BYEDestroy(delay,"Time's up",9); Returns the fraction lost value from the second to last report. \item {\tt int32\_t RR\_Prev\_GetPacketsLost() const}\\ Returns the number of lost packets contained in the second to last report. - \item {\tt u\_int32\_t RR\_Prev\_GetExtendedHighestSequenceNumber() const}\\ + \item {\tt uint32\_t RR\_Prev\_GetExtendedHighestSequenceNumber() const}\\ Returns the extended highest sequence number contained in the second to last report. - \item {\tt u\_int32\_t RR\_Prev\_GetJitter() const}\\ + \item {\tt uint32\_t RR\_Prev\_GetJitter() const}\\ Returns the jitter value from the second to last report. - \item {\tt u\_int32\_t RR\_Prev\_GetLastSRTimestamp() const}\\ + \item {\tt uint32\_t RR\_Prev\_GetLastSRTimestamp() const}\\ Returns the LSR value from the second to last report. - \item {\tt u\_int32\_t RR\_Prev\_GetDelaySinceLastSR() const}\\ + \item {\tt uint32\_t RR\_Prev\_GetDelaySinceLastSR() const}\\ Returns the DLSR value from the second to last report. \item {\tt RTPTime RR\_Prev\_GetReceiveTime() const}\\ Returns the time at which the second to last report was received. @@ -1773,12 +1773,12 @@ session.BYEDestroy(delay,"Time's up",9); participant. \item {\tt int32\_t INF\_GetNumPacketsReceived() const}\\ Returns the total number of received packets from this participant. - \item {\tt u\_int32\_t INF\_GetBaseSequenceNumber() const}\\ + \item {\tt uint32\_t INF\_GetBaseSequenceNumber() const}\\ Returns the base sequence number of this participant. - \item {\tt u\_int32\_t INF\_GetExtendedHighestSequenceNumber() const}\\ + \item {\tt uint32\_t INF\_GetExtendedHighestSequenceNumber() const}\\ Returns the extended highest sequence number received from this participant. - \item {\tt u\_int32\_t INF\_GetJitter() const}\\ + \item {\tt uint32\_t INF\_GetJitter() const}\\ Returns the current jitter value for this participant. \item {\tt RTPTime INF\_GetLastMessageTime() const}\\ Returns the time at which something was last heard from this member. @@ -1787,10 +1787,10 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt double INF\_GetEstimatedTimestampUnit() const}\\ Returns the estimated timestamp unit. The estimate is made from two consecutive sender reports. - \item {\tt u\_int32\_t INF\_GetNumPacketsReceivedInInterval() const}\\ + \item {\tt uint32\_t INF\_GetNumPacketsReceivedInInterval() const}\\ Returns the number of packets received since a new interval was started with {\tt INF\_StartNewInterval}. - \item {\tt u\_int32\_t INF\_GetSavedExtendedSequenceNumber() const}\\ + \item {\tt uint32\_t INF\_GetSavedExtendedSequenceNumber() const}\\ Returns the extended sequence number which was stored by the {\tt INF\_StartNewInterval} call. \item {\tt void INF\_StartNewInterval()}\\ @@ -1802,25 +1802,25 @@ session.BYEDestroy(delay,"Time's up",9); last receiver report. \item {\tt RTPTime INF\_GetLastSDESNoteTime() const}\\ Returns the time at which the last SDES NOTE item was received. - \item {\tt u\_int8\_t *SDES\_GetCNAME(size\_t *len) const}\\ + \item {\tt uint8\_t *SDES\_GetCNAME(size\_t *len) const}\\ Returns a pointer to the SDES CNAME item of this participant and stores its length in {\tt len}. - \item {\tt u\_int8\_t *SDES\_GetName(size\_t *len) const}\\ + \item {\tt uint8\_t *SDES\_GetName(size\_t *len) const}\\ Returns a pointer to the SDES name item of this participant and stores its length in {\tt len}. - \item {\tt u\_int8\_t *SDES\_GetEMail(size\_t *len) const}\\ + \item {\tt uint8\_t *SDES\_GetEMail(size\_t *len) const}\\ Returns a pointer to the SDES e-mail item of this participant and stores its length in {\tt len}. - \item {\tt u\_int8\_t *SDES\_GetPhone(size\_t *len) const}\\ + \item {\tt uint8\_t *SDES\_GetPhone(size\_t *len) const}\\ Returns a pointer to the SDES phone item of this participant and stores its length in {\tt len}. - \item {\tt u\_int8\_t *SDES\_GetLocation(size\_t *len) const}\\ + \item {\tt uint8\_t *SDES\_GetLocation(size\_t *len) const}\\ Returns a pointer to the SDES location item of this participant and stores its length in {\tt len}. - \item {\tt u\_int8\_t *SDES\_GetTool(size\_t *len) const}\\ + \item {\tt uint8\_t *SDES\_GetTool(size\_t *len) const}\\ Returns a pointer to the SDES tool item of this participant and stores its length in {\tt len}. - \item {\tt u\_int8\_t *SDES\_GetNote(size\_t *len) const}\\ + \item {\tt uint8\_t *SDES\_GetNote(size\_t *len) const}\\ Returns a pointer to the SDES note item of this participant and stores its length in {\tt len}. \end{itemize} @@ -1831,13 +1831,13 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt void SDES\_GotoFirstPrivateValue()}\\ Starts the iteration over the stored SDES private item prefixes and their associated values. - \item {\tt bool SDES\_GetNextPrivateValue(u\_int8\_t **prefix, size\_t *prefixlen, u\_int8\_t **value, size\_t *valuelen) }\\ + \item {\tt bool SDES\_GetNextPrivateValue(uint8\_t **prefix, size\_t *prefixlen, uint8\_t **value, size\_t *valuelen) }\\ If available, returns {\tt true} and stores the next SDES private item prefix in {\tt prefix} and its length in {\tt prefixlen}. The associated value and its length are then stored in {\tt value} and {\tt valuelen}. Otherwise, it returns {\tt false}. - \item {\tt bool SDES\_GetPrivateValue(u\_int8\_t *prefix, size\_t prefixlen, u\_int8\_t **value, size\_t *valuelen) const}\\ + \item {\tt bool SDES\_GetPrivateValue(uint8\_t *prefix, size\_t prefixlen, uint8\_t **value, size\_t *valuelen) const}\\ Looks for the entry which corresponds to the SDES private item prefix {\tt prefix} with length {\tt prefixlen}. If found, the function returns {\tt true} and stores the associated @@ -1858,18 +1858,18 @@ session.BYEDestroy(delay,"Time's up",9); below {\tt maxpacksize} \item {\tt void Destroy()}\\ Cleans up the builder. - \item {\tt u\_int32\_t GetPacketCount()}\\ + \item {\tt uint32\_t GetPacketCount()}\\ Returns the number of packets which have been created with the current SSRC identifier. - \item {\tt u\_int32\_t GetPayloadOctetCount()}\\ + \item {\tt uint32\_t GetPayloadOctetCount()}\\ Returns the number of payload octets which have been generated with this SSRC identifier. \item {\tt int SetMaximumPacketSize(size\_t maxpacksize)}\\ Sets the maximum allowed packet size to {\tt maxpacksize}. - \item {\tt int AddCSRC(u\_int32\_t csrc)}\\ + \item {\tt int AddCSRC(uint32\_t csrc)}\\ Adds a CSRC to the CSRC list which will be stored in the RTP packets. - \item {\tt int DeleteCSRC(u\_int32\_t csrc)}\\ + \item {\tt int DeleteCSRC(uint32\_t csrc)}\\ Deletes a CSRC from the list which will be stored in the RTP packets. \item {\tt void ClearCSRCList()}\\ @@ -1880,13 +1880,13 @@ session.BYEDestroy(delay,"Time's up",9); used will be those that have been set using the {\tt SetDefault} functions below. \item {\tt int BuildPacket(const void *data, size\_t len, - u\_int8\_t pt, bool mark, u\_int32\_t timestampinc)}\\ + uint8\_t pt, bool mark, uint32\_t timestampinc)}\\ Builds a packet with payload {\tt data} and payload length {\tt len}. The payload type will be set to {\tt pt}, the marker bit to {\tt mark} and after building this packet, the timestamp will be incremented with {\tt timestamp}. \item {\tt int BuildPacketEx(const void *data, size\_t len, - u\_int16\_t hdrextID, const void *hdrextdata, size\_t numhdrextwords)}\\ + uint16\_t hdrextID, const void *hdrextdata, size\_t numhdrextwords)}\\ Builds a packet with payload {\tt data} and payload length {\tt len}. The payload type, marker and timestamp increment used will be those that have been set using the @@ -1896,8 +1896,8 @@ session.BYEDestroy(delay,"Time's up",9); is given by {\tt numhdrextwords} which expresses the length in a number of $32$-bit words. \item {\tt int BuildPacketEx(const void *data, size\_t len, - u\_int8\_t pt, bool mark, u\_int32\_t timestampinc, - u\_int16\_t hdrextID, const void *hdrextdata, size\_t numhdrextwords)}\\ + uint8\_t pt, bool mark, uint32\_t timestampinc, + uint16\_t hdrextID, const void *hdrextdata, size\_t numhdrextwords)}\\ Builds a packet with payload {\tt data} and payload length {\tt len}. The payload type will be set to {\tt pt}, the marker bit to {\tt mark} and after building @@ -1907,17 +1907,17 @@ session.BYEDestroy(delay,"Time's up",9); hdrextdata}. The length of the header extension data is given by {\tt numhdrextwords} which expresses the length in a number of $32$-bit words. - \item {\tt u\_int8\_t *GetPacket()}\\ + \item {\tt uint8\_t *GetPacket()}\\ Returns a pointer to the last built RTP packet data. \item {\tt size\_t GetPacketLength()}\\ Returns the size of the last built RTP packet. - \item {\tt int SetDefaultPayloadType(u\_int8\_t pt)}\\ + \item {\tt int SetDefaultPayloadType(uint8\_t pt)}\\ Sets the default payload type to {\tt pt}. \item {\tt int SetDefaultMark(bool m)}\\ Sets the default marker bit to {\tt m}. - \item {\tt int SetDefaultTimestampIncrement(u\_int32\_t timestampinc)}\\ + \item {\tt int SetDefaultTimestampIncrement(uint32\_t timestampinc)}\\ Sets the default timestamp increment to {\tt timestampinc}. - \item {\tt int IncrementTimestamp(u\_int32\_t inc)}\\ + \item {\tt int IncrementTimestamp(uint32\_t inc)}\\ This function increments the timestamp with the amount given by {\tt inc}. This can be useful if, for example, a packet was not sent because it contained only silence. @@ -1934,28 +1934,28 @@ session.BYEDestroy(delay,"Time's up",9); timestamp with the appropriate amount so that the next packets will still be played at the correct time at other hosts. - \item {\tt u\_int32\_t CreateNewSSRC()}\\ + \item {\tt uint32\_t CreateNewSSRC()}\\ Creates a new SSRC to be used in generated packets. This will also generate new timestamp and sequence number offsets. - \item {\tt u\_int32\_t CreateNewSSRC(RTPSources \&sources)}\\ + \item {\tt uint32\_t CreateNewSSRC(RTPSources \&sources)}\\ Creates a new SSRC to be used in generated packets. This will also generate new timestamp and sequence number offsets. The source table {\tt sources} is used to make sure that the chosen SSRC isn't used by another participant yet. - \item {\tt u\_int32\_t GetSSRC()}\\ + \item {\tt uint32\_t GetSSRC()}\\ Returns the current SSRC identifier. - \item {\tt u\_int32\_t GetTimestamp()}\\ + \item {\tt uint32\_t GetTimestamp()}\\ Returns the current RTP timestamp. - \item {\tt u\_int16\_t GetSequenceNumber()}\\ + \item {\tt uint16\_t GetSequenceNumber()}\\ Returns the current sequence number. \item {\tt RTPTime GetPacketTime()}\\ Returns the time at which a packet was generated. This is not necessarily the time at which the last RTP packet was generated: if the timestamp increment was zero, the time is not updated. - \item {\tt u\_int32\_t GetPacketTimestamp()}\\ + \item {\tt uint32\_t GetPacketTimestamp()}\\ Returns the RTP timestamp which corresponds to the time returned by the previous function. \end{itemize} @@ -2360,7 +2360,7 @@ session.BYEDestroy(delay,"Time's up",9); leaving {\tt reason} with length {\tt reasonlength}. \item {\tt bool IsActive()}\\ Returns whether the session has been created or not. - \item {\tt u\_int32\_t GetLocalSSRC()}\\ + \item {\tt uint32\_t GetLocalSSRC()}\\ Returns our own SSRC. \item {\tt int AddDestination(const RTPAddress \&addr)}\\ Adds {\tt addr} to the list of destinations. @@ -2381,12 +2381,12 @@ session.BYEDestroy(delay,"Time's up",9); The used payload type, marker and timestamp increment will be those that have been set using the {\tt SetDefault} member functions. \item {\tt int SendPacket(const void *data, size\_t len, - u\_int8\_t pt, bool mark, u\_int32\_t timestampinc)}\\ + uint8\_t pt, bool mark, uint32\_t timestampinc)}\\ Sends the RTP packet with payload {\tt data} which has length {\tt len}. It will use payload type {\tt pt}, marker {\tt mark} and after the packet has been built, the timestamp will be incremented by {\tt timestampinc}. \item {\tt int SendPacketEx(const void *data, size\_t len, - u\_int16\_t hdrextID, const void *hdrextdata, size\_t numhdrextwords)}\\ + uint16\_t hdrextID, const void *hdrextdata, size\_t numhdrextwords)}\\ Sends the RTP packet with payload {\tt data} which has length {\tt len}. The packet will contain a header extension with identifier {\tt hdrextID} and containing data {\tt hdrextdata}. The length of this data is given by @@ -2394,22 +2394,22 @@ session.BYEDestroy(delay,"Time's up",9); The used payload type, marker and timestamp increment will be those that have been set using the {\tt SetDefault} member functions. \item {\tt int SendPacketEx(const void *data, size\_t len, - u\_int8\_t pt, bool mark, u\_int32\_t timestampinc, - u\_int16\_t hdrextID, const void *hdrextdata, size\_t numhdrextwords)}\\ + uint8\_t pt, bool mark, uint32\_t timestampinc, + uint16\_t hdrextID, const void *hdrextdata, size\_t numhdrextwords)}\\ Sends the RTP packet with payload {\tt data} which has length {\tt len}. It will use payload type {\tt pt}, marker {\tt mark} and after the packet has been built, the timestamp will be incremented by {\tt timestampinc}. The packet will contain a header extension with identifier {\tt hdrextID} and containing data {\tt hdrextdata}. The length of this data is given by {\tt numhdrextwords} and is specified in a number of 32-bit words. - \item {\tt int SetDefaultPayloadType(u\_int8\_t pt)}\\ + \item {\tt int SetDefaultPayloadType(uint8\_t pt)}\\ Sets the default payload type for RTP packets to {\tt pt}. \item {\tt int SetDefaultMark(bool m)}\\ Sets the default marker for RTP packets to {\tt m}. - \item {\tt int SetDefaultTimestampIncrement(u\_int32\_t timestampinc)}\\ + \item {\tt int SetDefaultTimestampIncrement(uint32\_t timestampinc)}\\ Sets the default value to increment the timestamp with to {\tt timestampinc}. - \item {\tt int IncrementTimestamp(u\_int32\_t inc)}\\ + \item {\tt int IncrementTimestamp(uint32\_t inc)}\\ This function increments the timestamp with the amount given by {\tt inc}. This can be useful if, for example, a packet was not sent because it contained only silence. @@ -2492,7 +2492,7 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt RTPSourceData *GetCurrentSourceInfo()}\\ Returns the {\tt RTPSourceData} instance for the currently selected participant. - \item {\tt RTPSourceData *GetSourceInfo(u\_int32\_t ssrc)}\\ + \item {\tt RTPSourceData *GetSourceInfo(uint32\_t ssrc)}\\ Returns the {\tt RTPSourceData} instance for the participant identified by {\tt ssrc}, or NULL if no such entry exists. \item {\tt RTPPacket *GetNextPacket()}\\ @@ -2614,10 +2614,10 @@ session.BYEDestroy(delay,"Time's up",9); \begin{itemize} \item {\tt void OnRTPPacket(RTPPacket *pack, const RTPTime \&receivetime, const RTPAddress *senderaddress)}\\ - Is called when an RTP packet is about to be processed. + Is called when an incoming RTP packet is about to be processed. \item {\tt void OnRTCPCompoundPacket(RTCPCompoundPacket *pack, const RTPTime \&receivetime, const RTPAddress *senderaddress)}\\ - Is called when an RTCP packet is about to be processed. + Is called when an incoming RTCP packet is about to be processed. \item {\tt void OnSSRCCollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, bool isrtp)}\\ Is called when an SSRC collision was detected. The instance {\tt srcdat} is the one present in the table, the address @@ -2625,7 +2625,7 @@ session.BYEDestroy(delay,"Time's up",9); addresses and {\tt isrtp} indicates against which address of {\tt srcdat} the check failed. \item {\tt void OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, - const u\_int8\_t *cname, size\_t cnamelength)}\\ + const uint8\_t *cname, size\_t cnamelength)}\\ Is called when another CNAME was received than the one already present for source {\tt srcdat}. \item {\tt void OnNewSource(RTPSourceData *srcdat)}\\ @@ -2656,6 +2656,9 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt void OnNoteTimeout(RTPSourceData *srcdat)}\\ Is called when the SDES NOTE item for source {\tt srcdat} has been timed out. + \item {\tt void OnSendRTCPCompoundPacket(RTCPCompoundPacket *pack)}\\ + Is called when an RTCP compound packet has just been sent. Useful + to inspect outgoing RTCP data. \item {\tt void OnPollThreadError(int errcode)}\\ Is called when error {\tt errcode} was detected in the poll thread. diff --git a/libs/jrtplib/jrtplib.dsp b/libs/jrtplib/jrtplib.dsp index 97e2ece85f..d7d423a3d4 100644 --- a/libs/jrtplib/jrtplib.dsp +++ b/libs/jrtplib/jrtplib.dsp @@ -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 diff --git a/libs/jrtplib/jrtplib_wce.vcproj b/libs/jrtplib/jrtplib_wce.vcproj index a85e357975..c32f971136 100644 --- a/libs/jrtplib/jrtplib_wce.vcproj +++ b/libs/jrtplib/jrtplib_wce.vcproj @@ -1,482 +1,481 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/jrtplib/src/Makefile.am b/libs/jrtplib/src/Makefile.am index a88dcb2d0f..67c6478ef3 100644 --- a/libs/jrtplib/src/Makefile.am +++ b/libs/jrtplib/src/Makefile.am @@ -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 diff --git a/libs/jrtplib/src/Makefile.in b/libs/jrtplib/src/Makefile.in index 9d4f0b4633..693aad5ee2 100644 --- a/libs/jrtplib/src/Makefile.in +++ b/libs/jrtplib/src/Makefile.in @@ -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 diff --git a/libs/jrtplib/src/jmutex.h b/libs/jrtplib/src/jmutex.h index 754e6e13c7..1c5873cab2 100644 --- a/libs/jrtplib/src/jmutex.h +++ b/libs/jrtplib/src/jmutex.h @@ -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 #endif // _WIN32_WCE #include #include + + //#define JMUTEX_CRITICALSECTION #else // using pthread #include #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 diff --git a/libs/jrtplib/src/jmutexautolock.h b/libs/jrtplib/src/jmutexautolock.h new file mode 100644 index 0000000000..60463c4b6b --- /dev/null +++ b/libs/jrtplib/src/jmutexautolock.h @@ -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 diff --git a/libs/jrtplib/src/jthread.h b/libs/jrtplib/src/jthread.h index af72104e06..469eacbcc1 100644 --- a/libs/jrtplib/src/jthread.h +++ b/libs/jrtplib/src/jthread.h @@ -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"), diff --git a/libs/jrtplib/src/pthread/jmutex.cpp b/libs/jrtplib/src/pthread/jmutex.cpp index 7ea659bd30..c1cec81eb1 100644 --- a/libs/jrtplib/src/pthread/jmutex.cpp +++ b/libs/jrtplib/src/pthread/jmutex.cpp @@ -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"), diff --git a/libs/jrtplib/src/pthread/jthread.cpp b/libs/jrtplib/src/pthread/jthread.cpp index d658723e9d..1f6a24158b 100644 --- a/libs/jrtplib/src/pthread/jthread.cpp +++ b/libs/jrtplib/src/pthread/jthread.cpp @@ -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 +#include #include 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(); diff --git a/libs/jrtplib/src/rtcpcompoundpacketbuilder.cpp b/libs/jrtplib/src/rtcpcompoundpacketbuilder.cpp index af20da522d..7679fc432f 100644 --- a/libs/jrtplib/src/rtcpcompoundpacketbuilder.cpp +++ b/libs/jrtplib/src/rtcpcompoundpacketbuilder.cpp @@ -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; diff --git a/libs/jrtplib/src/rtcpscheduler.cpp b/libs/jrtplib/src/rtcpscheduler.cpp index 9d71708ae7..b91752ebfe 100644 --- a/libs/jrtplib/src/rtcpscheduler.cpp +++ b/libs/jrtplib/src/rtcpscheduler.cpp @@ -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++; diff --git a/libs/jrtplib/src/rtcpsdespacket.cpp b/libs/jrtplib/src/rtcpsdespacket.cpp index 58a8187c0e..9e7f459c6f 100644 --- a/libs/jrtplib/src/rtcpsdespacket.cpp +++ b/libs/jrtplib/src/rtcpsdespacket.cpp @@ -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++; diff --git a/libs/jrtplib/src/rtcpsdespacket.h b/libs/jrtplib/src/rtcpsdespacket.h index bcc01da2a6..c6bb165e40 100644 --- a/libs/jrtplib/src/rtcpsdespacket.h +++ b/libs/jrtplib/src/rtcpsdespacket.h @@ -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; diff --git a/libs/jrtplib/src/rtpdefines.h b/libs/jrtplib/src/rtpdefines.h index e5fac7efc0..62965ed845 100644 --- a/libs/jrtplib/src/rtpdefines.h +++ b/libs/jrtplib/src/rtpdefines.h @@ -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 + diff --git a/libs/jrtplib/src/rtperrors.cpp b/libs/jrtplib/src/rtperrors.cpp index 60a387d897..adbda6e49c 100644 --- a/libs/jrtplib/src/rtperrors.cpp +++ b/libs/jrtplib/src/rtperrors.cpp @@ -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); } diff --git a/libs/jrtplib/src/rtphashtable.h b/libs/jrtplib/src/rtphashtable.h index 3ce898be30..2ed7b5084f 100644 --- a/libs/jrtplib/src/rtphashtable.h +++ b/libs/jrtplib/src/rtphashtable.h @@ -40,7 +40,8 @@ #include #endif // RTPDEBUG -template +//template +template class RTPHashTable { public: @@ -87,7 +88,7 @@ private: HashElement *curhashelem; }; -template +template inline RTPHashTable::RTPHashTable() { for (int i = 0 ; i < hashsize ; i++) @@ -96,7 +97,7 @@ inline RTPHashTable::RTPHashTable() lasthashelem = 0; } -template +template inline int RTPHashTable::DeleteCurrentElement() { if (curhashelem) @@ -152,13 +153,13 @@ inline int RTPHashTable::DeleteCurrentElement() return 0; } -template +template inline int RTPHashTable::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::GotoElement(const Element &e return 0; } -template +template inline bool RTPHashTable::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::HasElement(const Element &e return found; } -template +template inline void RTPHashTable::GotoNextElement() { if (curhashelem) curhashelem = curhashelem->listnext; } -template +template inline void RTPHashTable::GotoPreviousElement() { if (curhashelem) curhashelem = curhashelem->listprev; } -template +template inline void RTPHashTable::Clear() { HashElement *tmp1,*tmp2; @@ -232,14 +233,14 @@ inline void RTPHashTable::Clear() lasthashelem = 0; } -template +template inline int RTPHashTable::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::AddElement(const Element &el return 0; } -template +template inline int RTPHashTable::DeleteElement(const Element &elem) { int status; @@ -295,7 +296,7 @@ inline int RTPHashTable::DeleteElement(const Element } #ifdef RTPDEBUG -template +template inline void RTPHashTable::Dump() { HashElement *e; diff --git a/libs/jrtplib/src/rtpinternalsourcedata.cpp b/libs/jrtplib/src/rtpinternalsourcedata.cpp index b8c2ace03b..fdc8c77b5a 100644 --- a/libs/jrtplib/src/rtpinternalsourcedata.cpp +++ b/libs/jrtplib/src/rtpinternalsourcedata.cpp @@ -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: { diff --git a/libs/jrtplib/src/rtpinternalsourcedata.h b/libs/jrtplib/src/rtpinternalsourcedata.h index 26d53cd8c9..729ec86d91 100644 --- a/libs/jrtplib/src/rtpinternalsourcedata.h +++ b/libs/jrtplib/src/rtpinternalsourcedata.h @@ -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 diff --git a/libs/jrtplib/src/rtpipv4address.cpp b/libs/jrtplib/src/rtpipv4address.cpp index 6e0e2ba81d..338a905874 100644 --- a/libs/jrtplib/src/rtpipv4address.cpp +++ b/libs/jrtplib/src/rtpipv4address.cpp @@ -32,6 +32,7 @@ #include "rtpipv4address.h" #ifdef RTPDEBUG + #include "rtpdefines.h" #include #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); } diff --git a/libs/jrtplib/src/rtpipv4destination.h b/libs/jrtplib/src/rtpipv4destination.h index 33ffb42d4d..0166791cc2 100644 --- a/libs/jrtplib/src/rtpipv4destination.h +++ b/libs/jrtplib/src/rtpipv4destination.h @@ -39,6 +39,7 @@ #include #endif // WIN32 #ifdef RTPDEBUG + #include "rtpdefines.h" #include #include #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 diff --git a/libs/jrtplib/src/rtpipv6address.cpp b/libs/jrtplib/src/rtpipv6address.cpp index 62e160dcfc..1acbdc7012 100644 --- a/libs/jrtplib/src/rtpipv6address.cpp +++ b/libs/jrtplib/src/rtpipv6address.cpp @@ -35,6 +35,7 @@ #ifdef RTP_SUPPORT_IPV6 #ifdef RTPDEBUG + #include "rtpdefines.h" #include #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 diff --git a/libs/jrtplib/src/rtpipv6destination.h b/libs/jrtplib/src/rtpipv6destination.h index 42b0c5e8ea..6a9a46ac15 100644 --- a/libs/jrtplib/src/rtpipv6destination.h +++ b/libs/jrtplib/src/rtpipv6destination.h @@ -44,6 +44,7 @@ #include #endif // WIN32 #ifdef RTPDEBUG + #include "rtpdefines.h" #include #include #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 diff --git a/libs/jrtplib/src/rtpkeyhashtable.h b/libs/jrtplib/src/rtpkeyhashtable.h index 142f5bea9f..14353dc98a 100644 --- a/libs/jrtplib/src/rtpkeyhashtable.h +++ b/libs/jrtplib/src/rtpkeyhashtable.h @@ -41,7 +41,7 @@ #include #endif // RTPDEBUG -template +template class RTPKeyHashTable { public: @@ -91,7 +91,7 @@ private: HashElement *curhashelem; }; -template +template inline RTPKeyHashTable::RTPKeyHashTable() { for (int i = 0 ; i < hashsize ; i++) @@ -100,7 +100,7 @@ inline RTPKeyHashTable::RTPKeyHashTable() lasthashelem = 0; } -template +template inline int RTPKeyHashTable::DeleteCurrentElement() { if (curhashelem) @@ -156,13 +156,13 @@ inline int RTPKeyHashTable::DeleteCurrentElement( return 0; } -template +template inline int RTPKeyHashTable::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::GotoElement(const Key return 0; } -template +template inline bool RTPKeyHashTable::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::HasElement(const Key return found; } -template +template inline void RTPKeyHashTable::GotoNextElement() { if (curhashelem) curhashelem = curhashelem->listnext; } -template +template inline void RTPKeyHashTable::GotoPreviousElement() { if (curhashelem) curhashelem = curhashelem->listprev; } -template +template inline void RTPKeyHashTable::Clear() { HashElement *tmp1,*tmp2; @@ -236,14 +236,14 @@ inline void RTPKeyHashTable::Clear() lasthashelem = 0; } -template +template inline int RTPKeyHashTable::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::AddElement(const Key return 0; } -template +template inline int RTPKeyHashTable::DeleteElement(const Key &k) { int status; @@ -299,7 +299,7 @@ inline int RTPKeyHashTable::DeleteElement(const K } #ifdef RTPDEBUG -template +template inline void RTPKeyHashTable::Dump() { HashElement *e; diff --git a/libs/jrtplib/src/rtplibraryversion.cpp b/libs/jrtplib/src/rtplibraryversion.cpp index 1ab1eab7d1..7a708cf795 100644 --- a/libs/jrtplib/src/rtplibraryversion.cpp +++ b/libs/jrtplib/src/rtplibraryversion.cpp @@ -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); +} + + diff --git a/libs/jrtplib/src/rtplibraryversion.h b/libs/jrtplib/src/rtplibraryversion.h index da73e66f19..84d9e80630 100644 --- a/libs/jrtplib/src/rtplibraryversion.h +++ b/libs/jrtplib/src/rtplibraryversion.h @@ -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 diff --git a/libs/jrtplib/src/rtppacket.cpp b/libs/jrtplib/src/rtppacket.cpp index 587b3efa2c..5efe744b27 100644 --- a/libs/jrtplib/src/rtppacket.cpp +++ b/libs/jrtplib/src/rtppacket.cpp @@ -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); diff --git a/libs/jrtplib/src/rtprandom.cpp b/libs/jrtplib/src/rtprandom.cpp index b4d9399e90..df1e7ec22c 100644 --- a/libs/jrtplib/src/rtprandom.cpp +++ b/libs/jrtplib/src/rtprandom.cpp @@ -30,6 +30,10 @@ */ +#if defined(WIN32) && !defined(_WIN32_WCE) + #define _CRT_RAND_S +#endif // WIN32 || _WIN32_WCE + #include "rtprandom.h" #include #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 diff --git a/libs/jrtplib/src/rtprandom.h b/libs/jrtplib/src/rtprandom.h index df7273f9de..8582c26856 100644 --- a/libs/jrtplib/src/rtprandom.h +++ b/libs/jrtplib/src/rtprandom.h @@ -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 + diff --git a/libs/jrtplib/src/rtpsession.cpp b/libs/jrtplib/src/rtpsession.cpp index e77e314057..a05ea7e7f7 100644 --- a/libs/jrtplib/src/rtpsession.cpp +++ b/libs/jrtplib/src/rtpsession.cpp @@ -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) diff --git a/libs/jrtplib/src/rtpsession.h b/libs/jrtplib/src/rtpsession.h index 6397b6c4d4..fe69c12bd8 100644 --- a/libs/jrtplib/src/rtpsession.h +++ b/libs/jrtplib/src/rtpsession.h @@ -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 diff --git a/libs/jrtplib/src/rtpsessionparams.h b/libs/jrtplib/src/rtpsessionparams.h index f057b680b0..b8ece42781 100644 --- a/libs/jrtplib/src/rtpsessionparams.h +++ b/libs/jrtplib/src/rtpsessionparams.h @@ -90,7 +90,7 @@ public: private: bool acceptown; bool usepollthread; - int maxpacksize; + size_t maxpacksize; double owntsunit; RTPTransmitter::ReceiveMode receivemode; bool resolvehostname; diff --git a/libs/jrtplib/src/rtpsources.cpp b/libs/jrtplib/src/rtpsources.cpp index 90df7c0921..0e8c892641 100644 --- a/libs/jrtplib/src/rtpsources.cpp +++ b/libs/jrtplib/src/rtpsources.cpp @@ -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; } } diff --git a/libs/jrtplib/src/rtpsources.h b/libs/jrtplib/src/rtpsources.h index fe50dcf994..82f90ddb53 100644 --- a/libs/jrtplib/src/rtpsources.h +++ b/libs/jrtplib/src/rtpsources.h @@ -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; diff --git a/libs/jrtplib/src/rtpstructs.h b/libs/jrtplib/src/rtpstructs.h index 991c571d33..9447a4dd31 100644 --- a/libs/jrtplib/src/rtpstructs.h +++ b/libs/jrtplib/src/rtpstructs.h @@ -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; }; diff --git a/libs/jrtplib/src/rtpudpv4transmitter.cpp b/libs/jrtplib/src/rtpudpv4transmitter.cpp index cd1b3f5902..d7967b3eb2 100644 --- a/libs/jrtplib/src/rtpudpv4transmitter.cpp +++ b/libs/jrtplib/src/rtpudpv4transmitter.cpp @@ -34,6 +34,7 @@ #include "rtprawpacket.h" #include "rtpipv4address.h" #include "rtptimeutilities.h" +#include "rtpdefines.h" #include #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()); diff --git a/libs/jrtplib/src/rtpudpv4transmitter.h b/libs/jrtplib/src/rtpudpv4transmitter.h index 685a33da77..015cdb7122 100644 --- a/libs/jrtplib/src/rtpudpv4transmitter.h +++ b/libs/jrtplib/src/rtpudpv4transmitter.h @@ -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) diff --git a/libs/jrtplib/src/rtpudpv6transmitter.cpp b/libs/jrtplib/src/rtpudpv6transmitter.cpp index f0650dc1f9..f6ba867342 100644 --- a/libs/jrtplib/src/rtpudpv6transmitter.cpp +++ b/libs/jrtplib/src/rtpudpv6transmitter.cpp @@ -37,6 +37,7 @@ #include "rtprawpacket.h" #include "rtpipv6address.h" #include "rtptimeutilities.h" +#include "rtpdefines.h" #include #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()); diff --git a/libs/jrtplib/src/rtpudpv6transmitter.h b/libs/jrtplib/src/rtpudpv6transmitter.h index e7dfa527a4..bdc4109aa1 100644 --- a/libs/jrtplib/src/rtpudpv6transmitter.h +++ b/libs/jrtplib/src/rtpudpv6transmitter.h @@ -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) diff --git a/libs/jrtplib/src/win32/jmutex.cpp b/libs/jrtplib/src/win32/jmutex.cpp index 94504e9923..280c725b26 100644 --- a/libs/jrtplib/src/win32/jmutex.cpp +++ b/libs/jrtplib/src/win32/jmutex.cpp @@ -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; } + diff --git a/libs/jrtplib/src/win32/jthread.cpp b/libs/jrtplib/src/win32/jthread.cpp index 8ad1aa34b2..c6cda2d120 100644 --- a/libs/jrtplib/src/win32/jthread.cpp +++ b/libs/jrtplib/src/win32/jthread.cpp @@ -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();