From: Jan Beich Date: Fri, 12 Oct 2018 12:56:00 -0400 Subject: Bug 1376873 - Unbreak WebRTC 64 build on BSDs. r=dminor f=gaston Also includes: Bug 1554949 - Fix WebRTC build failure with newer linux kernel. r=dminor Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a636ecdcb91afb1c5d436bbcbd87da4f10f7df78 --- modules/video_capture/linux/device_info_linux.cc | 6 ++++++ modules/video_capture/linux/device_info_v4l2.cc | 8 +++++++- modules/video_capture/linux/video_capture_linux.cc | 9 ++++++++- rtc_base/byte_order.h | 2 ++ rtc_base/physical_socket_server.cc | 7 +++++-- system_wrappers/source/cpu_info.cc | 4 ++-- 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/modules/video_capture/linux/device_info_linux.cc b/modules/video_capture/linux/device_info_linux.cc index 4f8b7c059b..56da475bf3 100644 --- a/modules/video_capture/linux/device_info_linux.cc +++ b/modules/video_capture/linux/device_info_linux.cc @@ -16,7 +16,13 @@ #include #include // v4l includes +#if defined(__NetBSD__) || defined(__OpenBSD__) // WEBRTC_BSD +#include +#elif defined(__sun) +#include +#else #include +#endif #include diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc index 7397a10625..19b32f16b9 100644 --- a/modules/video_capture/linux/device_info_v4l2.cc +++ b/modules/video_capture/linux/device_info_v4l2.cc @@ -18,7 +18,13 @@ #include #include // v4l includes +#if defined(__NetBSD__) || defined(__OpenBSD__) // WEBRTC_BSD +#include +#elif defined(__sun) +#include +#else #include +#endif #include @@ -209,8 +215,8 @@ DeviceInfoV4l2::DeviceInfoV4l2() : DeviceInfoImpl() { _inotifyEventThread->Start(); } -} #endif +} int32_t DeviceInfoV4l2::Init() { return 0; diff --git a/modules/video_capture/linux/video_capture_linux.cc b/modules/video_capture/linux/video_capture_linux.cc index a2ea218a8b..23a8f4f3f3 100644 --- a/modules/video_capture/linux/video_capture_linux.cc +++ b/modules/video_capture/linux/video_capture_linux.cc @@ -10,7 +10,6 @@ #include #include -#include #include #include #include @@ -18,6 +17,14 @@ #include #include #include +// v4l includes +#if defined(__NetBSD__) || defined(__OpenBSD__) // WEBRTC_BSD +#include +#elif defined(__sun) +#include +#else +#include +#endif #include #include diff --git a/rtc_base/byte_order.h b/rtc_base/byte_order.h index b8f8ae9f7a..382511daeb 100644 --- a/rtc_base/byte_order.h +++ b/rtc_base/byte_order.h @@ -90,6 +90,8 @@ #error WEBRTC_ARCH_BIG_ENDIAN or WEBRTC_ARCH_LITTLE_ENDIAN must be defined. #endif // defined(WEBRTC_ARCH_LITTLE_ENDIAN) +#elif defined(WEBRTC_BSD) && !defined(__OpenBSD__) +#include #elif defined(WEBRTC_POSIX) #include #else diff --git a/rtc_base/physical_socket_server.cc b/rtc_base/physical_socket_server.cc index b0af1c20ce..b13d1aa21b 100644 --- a/rtc_base/physical_socket_server.cc +++ b/rtc_base/physical_socket_server.cc @@ -73,7 +73,10 @@ typedef void* SockOptArg; #endif // WEBRTC_POSIX -#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(__native_client__) +#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(WEBRTC_BSD) && !defined(__native_client__) +#if defined(WEBRTC_LINUX) +#include +#endif int64_t GetSocketRecvTimestamp(int socket) { struct timeval tv_ioctl; @@ -641,7 +644,7 @@ int PhysicalSocket::TranslateOption(Option opt, int* slevel, int* sopt) { *slevel = IPPROTO_IP; *sopt = IP_DONTFRAGMENT; break; -#elif defined(WEBRTC_MAC) || defined(BSD) || defined(__native_client__) +#elif defined(WEBRTC_MAC) || defined(WEBRTC_BSD) || defined(__native_client__) RTC_LOG(LS_WARNING) << "Socket::OPT_DONTFRAGMENT not supported."; return -1; #elif defined(WEBRTC_POSIX) diff --git a/system_wrappers/source/cpu_info.cc b/system_wrappers/source/cpu_info.cc index eff720371a..94aed09c48 100644 --- a/system_wrappers/source/cpu_info.cc +++ b/system_wrappers/source/cpu_info.cc @@ -12,7 +12,7 @@ #if defined(WEBRTC_WIN) #include -#elif defined(WEBRTC_LINUX) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) #include #elif defined(WEBRTC_MAC) #include @@ -30,7 +30,7 @@ static int DetectNumberOfCores() { SYSTEM_INFO si; GetNativeSystemInfo(&si); number_of_cores = static_cast(si.dwNumberOfProcessors); -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID) || defined(WEBRTC_BSD) number_of_cores = static_cast(sysconf(_SC_NPROCESSORS_ONLN)); if (number_of_cores <= 0) { RTC_LOG(LS_ERROR) << "Failed to get number of cores";