Bug 1304558 - Unbreak BSD build after bug 1297337. r?jesup draft
authorJan Beich <jbeich@FreeBSD.org>
Thu, 22 Sep 2016 00:04:44 +0000
changeset 416388 eb58dd2279baf1f87568148157e9a42eef2abe95
parent 416020 560b2c805bf7bebeb3ceebc495a81b2aa4c0c755
child 531839 9c5f543c446b064cbf6e27708dfa5d1b5a349c0f
push id30126
push userbmo:jbeich@FreeBSD.org
push dateThu, 22 Sep 2016 00:08:59 +0000
reviewersjesup
bugs1304558, 1297337
milestone52.0a1
Bug 1304558 - Unbreak BSD build after bug 1297337. r?jesup MozReview-Commit-ID: 3r2cjZlODDo
media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc
media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.h
--- a/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc
@@ -24,18 +24,20 @@
 #include <sys/videodev2.h>
 #else
 #include <linux/videodev2.h>
 #endif
 
 #include "webrtc/system_wrappers/interface/ref_count.h"
 #include "webrtc/system_wrappers/interface/trace.h"
 
+#ifdef WEBRTC_LINUX
 #define EVENT_SIZE  ( sizeof (struct inotify_event) )
 #define BUF_LEN     ( 1024 * ( EVENT_SIZE + 16 ) )
+#endif
 
 namespace webrtc
 {
 namespace videocapturemodule
 {
 VideoCaptureModule::DeviceInfo*
 VideoCaptureImpl::CreateDeviceInfo(const int32_t id)
 {
@@ -44,16 +46,17 @@ VideoCaptureImpl::CreateDeviceInfo(const
     if (!deviceInfo)
     {
         deviceInfo = NULL;
     }
 
     return deviceInfo;
 }
 
+#ifdef WEBRTC_LINUX
 void DeviceInfoLinux::HandleEvent(inotify_event* event)
 {
     switch (event->mask) {
         case IN_CREATE:
             DeviceChange();
             break;
         case IN_DELETE:
             DeviceChange();
@@ -153,44 +156,51 @@ bool DeviceInfoLinux::InotifyProcess()
         }
 
         close(_fd);
         return true;
     } else {
         return false;
     }
 }
+#endif
 
 DeviceInfoLinux::DeviceInfoLinux(const int32_t id)
     : DeviceInfoImpl(id)
+#ifdef WEBRTC_LINUX
     , _isShutdown(0)
+#endif
 {
+#ifdef WEBRTC_LINUX
     _inotifyEventThread = ThreadWrapper::CreateThread(
         InotifyEventThread, this, "InotifyEventThread");
 
     if (_inotifyEventThread)
     {
         _inotifyEventThread->Start();
         _inotifyEventThread->SetPriority(kHighPriority);
     }
+#endif
 }
 
 int32_t DeviceInfoLinux::Init()
 {
     return 0;
 }
 
 DeviceInfoLinux::~DeviceInfoLinux()
 {
+#ifdef WEBRTC_LINUX
     ++_isShutdown;
 
     if (_inotifyEventThread) {
         _inotifyEventThread->Stop();
         _inotifyEventThread.reset();
     }
+#endif
 }
 
 uint32_t DeviceInfoLinux::NumberOfDevices()
 {
     WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideoCapture, _id, "%s", __FUNCTION__);
 
     uint32_t count = 0;
     char device[20];
--- a/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.h
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.h
@@ -8,19 +8,21 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
 #ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_LINUX_DEVICE_INFO_LINUX_H_
 #define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_LINUX_DEVICE_INFO_LINUX_H_
 
 #include "webrtc/modules/video_capture/device_info_impl.h"
 #include "webrtc/modules/video_capture/video_capture_impl.h"
+#ifdef WEBRTC_LINUX
 #include "webrtc/system_wrappers/interface/thread_wrapper.h"
 #include "webrtc/system_wrappers/interface/atomic32.h"
 #include <sys/inotify.h>
+#endif
 
 namespace webrtc
 {
 namespace videocapturemodule
 {
 class DeviceInfoLinux: public DeviceInfoImpl
 {
 public:
@@ -46,21 +48,23 @@ public:
         uint32_t /*positionX*/,
         uint32_t /*positionY*/) { return -1;}
     int32_t FillCapabilities(int fd);
     int32_t Init();
 private:
 
     bool IsDeviceNameMatches(const char* name, const char* deviceUniqueIdUTF8);
 
+#ifdef WEBRTC_LINUX
     void HandleEvent(inotify_event* event);
     int EventCheck();
     int HandleEvents();
     int ProcessInotifyEvents();
     rtc::scoped_ptr<ThreadWrapper> _inotifyEventThread;
     static bool InotifyEventThread(void*);
     bool InotifyProcess();
     int _fd, _wd_v4l, _wd_snd; /* accessed on InotifyEventThread thread */
     Atomic32 _isShutdown;
+#endif
 };
 }  // namespace videocapturemodule
 }  // namespace webrtc
 #endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_LINUX_DEVICE_INFO_LINUX_H_