From ea3378d097450a93b4f3166536ebfae702aeecc9 Mon Sep 17 00:00:00 2001 From: Landry Breuil Date: Thu, 13 Jun 2013 08:54:56 +0200 Subject: [PATCH] Bug 807492 Part 11 - Support WebRTC on BSD in network modules rtp/udp r=jesup --- .../source/forward_error_correction.cc | 1 + .../modules/rtp_rtcp/source/rtp_utility.cc | 10 +++++----- .../source/udp_transport_impl.cc | 20 ++++++++++--------- .../modules/utility/source/rtp_dump_impl.cc | 4 ++-- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc index bdad224ee5f6..39e113281c97 100644 --- a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc +++ b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc @@ -12,6 +12,7 @@ #include #include +#include // for abs() #include #include diff --git a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc index efc985cd1601..d1d81a76ec4e 100644 --- a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc +++ b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc @@ -18,7 +18,7 @@ #include // FILETIME #include // timeval #include // timeGetTime -#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC)) +#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_BSD) || (defined WEBRTC_MAC)) #include // gettimeofday #include #endif @@ -156,7 +156,7 @@ void get_time(WindowsHelpTimer* help_timer, FILETIME& current_time) { WindowsHelpTimer* _helpTimer; }; -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) // A clock reading times from the POSIX API. class UnixSystemClock : public RtpRtcpClock { @@ -214,7 +214,7 @@ void WindowsSystemClock::CurrentNTP(WebRtc_UWord32& secs, frac = (WebRtc_UWord32)dtemp; } -#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC)) +#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_BSD) || (defined WEBRTC_MAC)) WebRtc_Word64 UnixSystemClock::GetTimeInMS() { return TickTime::MillisecondTimestamp(); @@ -253,7 +253,7 @@ static WindowsHelpTimer global_help_timer = {0, 0, {{ 0, 0}, 0}, 0}; RtpRtcpClock* GetSystemClock() { #if defined(_WIN32) return new WindowsSystemClock(&global_help_timer); -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) return new UnixSystemClock(); #else return NULL; @@ -330,7 +330,7 @@ bool StringCompare(const char* str1, const char* str2, const WebRtc_UWord32 length) { return (_strnicmp(str1, str2, length) == 0) ? true : false; } -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) bool StringCompare(const char* str1, const char* str2, const WebRtc_UWord32 length) { return (strncasecmp(str1, str2, length) == 0) ? true : false; diff --git a/media/webrtc/trunk/webrtc/modules/udp_transport/source/udp_transport_impl.cc b/media/webrtc/trunk/webrtc/modules/udp_transport/source/udp_transport_impl.cc index b4c927947f97..183e9646b9fa 100644 --- a/media/webrtc/trunk/webrtc/modules/udp_transport/source/udp_transport_impl.cc +++ b/media/webrtc/trunk/webrtc/modules/udp_transport/source/udp_transport_impl.cc @@ -18,16 +18,16 @@ #if defined(_WIN32) #include #include -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) #include #include #include #include +#include #include #include #include #include -#include #include #include #ifndef WEBRTC_IOS @@ -36,9 +36,11 @@ #endif // defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) #if defined(WEBRTC_MAC) -#include #include #endif +#if defined(WEBRTC_BSD) || defined(WEBRTC_MAC) +#include +#endif #if defined(WEBRTC_LINUX) #include #include @@ -51,7 +53,7 @@ #include "typedefs.h" #include "udp_socket_manager_wrapper.h" -#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) #define GetLastError() errno #define IFRSIZE ((int)(size * sizeof (struct ifreq))) @@ -61,7 +63,7 @@ (int)(nlh)->nlmsg_len >= (int)sizeof(struct nlmsghdr) && \ (int)(nlh)->nlmsg_len <= (len)) -#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) namespace webrtc { @@ -2371,7 +2373,7 @@ WebRtc_Word32 UdpTransport::InetPresentationToNumeric(WebRtc_Word32 af, const char* src, void* dst) { -#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) const WebRtc_Word32 result = inet_pton(af, src, dst); return result > 0 ? 0 : -1; @@ -2493,7 +2495,7 @@ WebRtc_Word32 UdpTransport::LocalHostAddressIPV6(char n_localIP[16]) "getaddrinfo failed to find address"); return -1; -#elif defined(WEBRTC_MAC) +#elif defined(WEBRTC_BSD) || defined(WEBRTC_MAC) struct ifaddrs* ptrIfAddrs = NULL; struct ifaddrs* ptrIfAddrsStart = NULL; @@ -2685,7 +2687,7 @@ WebRtc_Word32 UdpTransport::LocalHostAddress(WebRtc_UWord32& localIP) "gethostbyname failed, error:%d", error); return -1; } -#elif (defined(WEBRTC_MAC)) +#elif (defined(WEBRTC_BSD) || defined(WEBRTC_MAC)) char localname[255]; if (gethostname(localname, 255) != -1) { @@ -2824,7 +2826,7 @@ WebRtc_Word32 UdpTransport::IPAddress(const SocketAddress& address, sourcePort = htons(source_port); return 0; - #elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) + #elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) WebRtc_Word32 ipFamily = address._sockaddr_storage.sin_family; const void* ptrNumericIP = NULL; diff --git a/media/webrtc/trunk/webrtc/modules/utility/source/rtp_dump_impl.cc b/media/webrtc/trunk/webrtc/modules/utility/source/rtp_dump_impl.cc index 69a52ecc5789..7ac226c7035e 100644 --- a/media/webrtc/trunk/webrtc/modules/utility/source/rtp_dump_impl.cc +++ b/media/webrtc/trunk/webrtc/modules/utility/source/rtp_dump_impl.cc @@ -19,7 +19,7 @@ #if defined(_WIN32) #include #include -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) #include #include #include @@ -238,7 +238,7 @@ inline WebRtc_UWord32 RtpDumpImpl::GetTimeInMS() const { #if defined(_WIN32) return timeGetTime(); -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) struct timeval tv; struct timezone tz; unsigned long val;