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
|
diff --git a/browser/actors/WebRTCParent.jsm b/browser/actors/WebRTCParent.jsm
--- a/browser/actors/WebRTCParent.jsm
+++ b/browser/actors/WebRTCParent.jsm
@@ -45,6 +45,9 @@
"nsIOSPermissionRequest"
);
+const PIPEWIRE_PORTAL_NAME = "####_PIPEWIRE_PORTAL_####";
+const PIPEWIRE_ID = 0xaffffff;
+
class WebRTCParent extends JSWindowActorParent {
didDestroy() {
webrtcUI.forgetStreamsFromBrowserContext(this.browsingContext);
@@ -774,6 +777,23 @@
}
} else {
name = device.name;
+ // When we share content by PipeWire add only one item to the device
+ // list. When it's selected PipeWire portal dialog is opened and
+ // user confirms actual window/screen sharing there.
+ // Don't mark it as scary as there's an extra confirmation step by
+ // PipeWire portal dialog.
+ if (name == PIPEWIRE_PORTAL_NAME && device.id == PIPEWIRE_ID) {
+ let sawcStringId = "getUserMedia.sharePipeWirePortal.label";
+ let item = addDeviceToList(
+ menupopup,
+ stringBundle.getString(sawcStringId),
+ i,
+ type
+ );
+ item.deviceId = device.id;
+ item.mediaSource = type;
+ break;
+ }
if (type == "application") {
// The application names returned by the platform are of the form:
// <window count>\x1e<application name>
diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -767,6 +767,7 @@
getUserMedia.selectWindowOrScreen.accesskey=W
getUserMedia.pickWindowOrScreen.label = Select Window or Screen
getUserMedia.shareEntireScreen.label = Entire screen
+getUserMedia.sharePipeWirePortal.label = Use operating system settings
# LOCALIZATION NOTE (getUserMedia.shareMonitor.label):
# %S is screen number (digits 1, 2, etc)
# Example: Screen 1, Screen 2,..
diff --git a/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc b/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
--- a/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
+++ b/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
@@ -898,17 +898,17 @@
callback_->OnCaptureResult(Result::SUCCESS, std::move(result));
}
+#define PIPEWIRE_ID 0xaffffff
+#define PIPEWIRE_NAME "####_PIPEWIRE_PORTAL_####"
+
bool BaseCapturerPipeWire::GetSourceList(SourceList* sources) {
- RTC_DCHECK(sources->size() == 0);
- // List of available screens is already presented by the xdg-desktop-portal.
- // But we have to add an empty source as the code expects it.
- sources->push_back({0});
+ sources->push_back({PIPEWIRE_ID, 0, PIPEWIRE_NAME});
return true;
}
bool BaseCapturerPipeWire::SelectSource(SourceId id) {
// Screen selection is handled by the xdg-desktop-portal.
- return true;
+ return id == PIPEWIRE_ID;
}
// static
|