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
95
96
97
98
|
From: Alex Chronopoulos <achronop@gmail.com>
Date: Wed, 18 Sep 2019 13:16:00 +0000
Subject: Bug 1572281 - Remove audio device change notifications from video
capture in Linux. r=dminor
Video capture used to provide device change notifications for audio and video devices. From now on, CubebDeviceEnumerator will provide audio device change notifications thus video capture is updated to notify only changes of the video device. This is the Linux part.
Differential Revision: https://phabricator.services.mozilla.com/D46272
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/7bf7263db30b794139332691f4fbc98b4bfcfdd7
---
.../video_capture/linux/device_info_v4l2.cc | 28 ++-----------------
1 file changed, 3 insertions(+), 25 deletions(-)
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index d836747b4a..77968b7eaf 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -44,7 +44,7 @@ namespace videocapturemodule {
void DeviceInfoV4l2::HandleEvent(inotify_event* event, int fd)
{
if (event->mask & IN_CREATE) {
- if (fd == _fd_v4l || fd == _fd_snd) {
+ if (fd == _fd_v4l) {
DeviceChange();
} else if ((event->mask & IN_ISDIR) && (fd == _fd_dev)) {
if (_wd_v4l < 0) {
@@ -56,25 +56,15 @@ void DeviceInfoV4l2::HandleEvent(inotify_event* event, int fd)
DeviceChange();
}
}
- if (_wd_snd < 0) {
- usleep(5*1000);
- _wd_snd = inotify_add_watch(_fd_snd, "/dev/snd/by-path/", IN_CREATE | IN_DELETE | IN_DELETE_SELF);
- if (_wd_snd >= 0) {
- DeviceChange();
- }
- }
}
} else if (event->mask & IN_DELETE) {
- if (fd == _fd_v4l || fd == _fd_snd) {
+ if (fd == _fd_v4l) {
DeviceChange();
}
} else if (event->mask & IN_DELETE_SELF) {
if (fd == _fd_v4l) {
inotify_rm_watch(_fd_v4l, _wd_v4l);
_wd_v4l = -1;
- } else if (fd == _fd_snd) {
- inotify_rm_watch(_fd_snd, _wd_snd);
- _wd_snd = -1;
} else {
assert(false);
}
@@ -141,11 +131,6 @@ int DeviceInfoV4l2::ProcessInotifyEvents()
break;
}
}
- if (EventCheck(_fd_snd) > 0) {
- if (HandleEvents(_fd_snd) < 0) {
- break;
- }
- }
}
return 0;
}
@@ -158,11 +143,9 @@ void DeviceInfoV4l2::InotifyEventThread(void* obj)
void DeviceInfoV4l2::InotifyProcess()
{
_fd_v4l = inotify_init();
- _fd_snd = inotify_init();
_fd_dev = inotify_init();
- if (_fd_v4l >= 0 && _fd_snd >= 0 && _fd_dev >= 0) {
+ if (_fd_v4l >= 0 && _fd_dev >= 0) {
_wd_v4l = inotify_add_watch(_fd_v4l, "/dev/v4l/by-path/", IN_CREATE | IN_DELETE | IN_DELETE_SELF);
- _wd_snd = inotify_add_watch(_fd_snd, "/dev/snd/by-path/", IN_CREATE | IN_DELETE | IN_DELETE_SELF);
_wd_dev = inotify_add_watch(_fd_dev, "/dev/", IN_CREATE);
ProcessInotifyEvents();
@@ -170,16 +153,11 @@ void DeviceInfoV4l2::InotifyProcess()
inotify_rm_watch(_fd_v4l, _wd_v4l);
}
- if (_wd_snd >= 0) {
- inotify_rm_watch(_fd_snd, _wd_snd);
- }
-
if (_wd_dev >= 0) {
inotify_rm_watch(_fd_dev, _wd_dev);
}
close(_fd_v4l);
- close(_fd_snd);
close(_fd_dev);
}
}
--
2.34.1
|