1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
From: Jan Beich <jbeich@FreeBSD.org>
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_v4l2.cc | 8 +++++++-
rtc_base/byte_order.h | 2 ++
rtc_base/cpu_info.cc | 2 +-
rtc_base/physical_socket_server.cc | 7 +++++--
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index 6452a3c235..9f7f3ea508 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -11,7 +11,13 @@
#include "modules/video_capture/linux/device_info_v4l2.h"
#include <fcntl.h>
+#if defined(__NetBSD__) || defined(__OpenBSD__) // WEBRTC_BSD
+#include <sys/videoio.h>
+#elif defined(__sun)
+#include <sys/videodev2.h>
+#else
#include <linux/videodev2.h>
+#endif
#include <sys/ioctl.h>
#include <unistd.h>
@@ -209,8 +215,8 @@ DeviceInfoV4l2::DeviceInfoV4l2() : DeviceInfoImpl()
{
_inotifyEventThread->Start();
}
-}
#endif
+}
int32_t DeviceInfoV4l2::Init() {
return 0;
diff --git a/rtc_base/byte_order.h b/rtc_base/byte_order.h
index 3a9bfe46e0..2b13e69251 100644
--- a/rtc_base/byte_order.h
+++ b/rtc_base/byte_order.h
@@ -82,6 +82,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 <sys/endian.h>
#elif defined(WEBRTC_POSIX)
#include <endian.h>
#else
diff --git a/rtc_base/cpu_info.cc b/rtc_base/cpu_info.cc
index 32e2eb35b2..0ce48a02f1 100644
--- a/rtc_base/cpu_info.cc
+++ b/rtc_base/cpu_info.cc
@@ -52,7 +52,7 @@ uint32_t DetectNumberOfCores() {
SYSTEM_INFO si;
GetNativeSystemInfo(&si);
number_of_cores = static_cast<int>(si.dwNumberOfProcessors);
-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID) || defined(WEBRTC_BSD)
number_of_cores = static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN));
if (number_of_cores <= 0) {
RTC_LOG(LS_ERROR) << "Failed to get number of cores";
diff --git a/rtc_base/physical_socket_server.cc b/rtc_base/physical_socket_server.cc
index 10adcfe48c..7102e96137 100644
--- a/rtc_base/physical_socket_server.cc
+++ b/rtc_base/physical_socket_server.cc
@@ -78,7 +78,10 @@
typedef void* SockOptArg;
#endif // WEBRTC_POSIX
-#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC)
+#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(WEBRTC_BSD)
+#if defined(WEBRTC_LINUX)
+#include <linux/sockios.h>
+#endif
int64_t GetSocketRecvTimestamp(int socket) {
struct timeval tv_ioctl;
int ret = ioctl(socket, SIOCGSTAMP, &tv_ioctl);
@@ -698,7 +701,7 @@ int PhysicalSocket::TranslateOption(Option opt, int* slevel, int* sopt) {
*slevel = IPPROTO_IP;
*sopt = IP_DONTFRAGMENT;
break;
-#elif defined(WEBRTC_MAC) || defined(BSD)
+#elif defined(WEBRTC_MAC) || defined(WEBRTC_BSD)
RTC_LOG(LS_WARNING) << "Socket::OPT_DONTFRAGMENT not supported.";
return -1;
#elif defined(WEBRTC_POSIX)
|