firefox/pw6.patch

76 lines
3.2 KiB
Diff

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