summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/moz-patch-stack/0063.patch
blob: 37a746e145ee15bf8a46bda2833239312533d9b2 (plain)
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
From: Michael Froman <mjfroman@mac.com>
Date: Thu, 19 May 2022 15:32:32 -0500
Subject: Bug 1772380 - Build 1766646 - (fix-c89fdd716c) fixes for the
 refactored PlatformThread API;r?mjf

---
 .../video_capture/linux/device_info_v4l2.cc   | 20 ++++++-------------
 .../video_capture/linux/device_info_v4l2.h    |  3 +--
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index e8abcdda78..7651dd6651 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -133,11 +133,6 @@ int DeviceInfoV4l2::ProcessInotifyEvents()
     return 0;
 }
 
-void DeviceInfoV4l2::InotifyEventThread(void* obj)
-{
-    static_cast<DeviceInfoLinux*> (obj)->InotifyProcess();
-}
-
 void DeviceInfoV4l2::InotifyProcess()
 {
     _fd_v4l = inotify_init();
@@ -163,16 +158,14 @@ void DeviceInfoV4l2::InotifyProcess()
 
 DeviceInfoV4l2::DeviceInfoV4l2() : DeviceInfoImpl()
 #ifdef WEBRTC_LINUX
-    , _inotifyEventThread(new rtc::PlatformThread(
-                            InotifyEventThread, this, "InotifyEventThread"))
     , _isShutdown(false)
 #endif
 {
 #ifdef WEBRTC_LINUX
-    if (_inotifyEventThread)
-    {
-        _inotifyEventThread->Start();
-    }
+  _inotifyEventThread = rtc::PlatformThread::SpawnJoinable(
+      [this] {
+        InotifyProcess();
+      }, "InotifyEventThread");
 #endif
 }
 
@@ -184,9 +177,8 @@ DeviceInfoV4l2::~DeviceInfoV4l2() {
 #ifdef WEBRTC_LINUX
     _isShutdown = true;
 
-    if (_inotifyEventThread) {
-        _inotifyEventThread->Stop();
-        _inotifyEventThread = nullptr;
+    if (!_inotifyEventThread.empty()) {
+      _inotifyEventThread.Finalize();
     }
 #endif
 }
diff --git a/modules/video_capture/linux/device_info_v4l2.h b/modules/video_capture/linux/device_info_v4l2.h
index 119cb07ab8..0bec3eb765 100644
--- a/modules/video_capture/linux/device_info_v4l2.h
+++ b/modules/video_capture/linux/device_info_v4l2.h
@@ -60,8 +60,7 @@ class DeviceInfoV4l2 : public DeviceInfoImpl {
   int EventCheck(int fd);
   int HandleEvents(int fd);
   int ProcessInotifyEvents();
-  std::unique_ptr<rtc::PlatformThread> _inotifyEventThread;
-  static void InotifyEventThread(void*);
+  rtc::PlatformThread _inotifyEventThread;
   void InotifyProcess();
   int _fd_v4l, _fd_dev, _wd_v4l, _wd_dev; /* accessed on InotifyEventThread thread */
   std::atomic<bool> _isShutdown;
-- 
2.34.1