summaryrefslogtreecommitdiff
path: root/pw7.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pw7.patch')
-rw-r--r--pw7.patch95
1 files changed, 95 insertions, 0 deletions
diff --git a/pw7.patch b/pw7.patch
new file mode 100644
index 0000000..db75dea
--- /dev/null
+++ b/pw7.patch
@@ -0,0 +1,95 @@
+diff --git a/browser/actors/WebRTCParent.jsm b/browser/actors/WebRTCParent.jsm
+--- a/browser/actors/WebRTCParent.jsm
++++ b/browser/actors/WebRTCParent.jsm
+@@ -756,6 +756,8 @@
+ );
+ menupopup.appendChild(doc.createXULElement("menuseparator"));
+
++ let isPipeWire = false;
++
+ // Build the list of 'devices'.
+ let monitorIndex = 1;
+ for (let i = 0; i < devices.length; ++i) {
+@@ -783,6 +785,7 @@
+ // 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) {
++ isPipeWire = true;
+ let sawcStringId = "getUserMedia.sharePipeWirePortal.label";
+ let item = addDeviceToList(
+ menupopup,
+@@ -908,39 +911,41 @@
+ perms.EXPIRE_SESSION
+ );
+
+- video.deviceId = deviceId;
+- let constraints = {
+- video: { mediaSource: type, deviceId: { exact: deviceId } },
+- };
+- chromeWin.navigator.mediaDevices.getUserMedia(constraints).then(
+- stream => {
+- if (video.deviceId != deviceId) {
+- // The user has selected a different device or closed the panel
+- // before getUserMedia finished.
+- stream.getTracks().forEach(t => t.stop());
+- return;
++ if (!isPipeWire) {
++ video.deviceId = deviceId;
++ let constraints = {
++ video: { mediaSource: type, deviceId: { exact: deviceId } },
++ };
++ chromeWin.navigator.mediaDevices.getUserMedia(constraints).then(
++ stream => {
++ if (video.deviceId != deviceId) {
++ // The user has selected a different device or closed the panel
++ // before getUserMedia finished.
++ stream.getTracks().forEach(t => t.stop());
++ return;
++ }
++ video.srcObject = stream;
++ video.stream = stream;
++ doc.getElementById("webRTC-preview").hidden = false;
++ video.onloadedmetadata = function(e) {
++ video.play();
++ };
++ },
++ err => {
++ if (
++ err.name == "OverconstrainedError" &&
++ err.constraint == "deviceId"
++ ) {
++ // Window has disappeared since enumeration, which can happen.
++ // No preview for you.
++ return;
++ }
++ Cu.reportError(
++ `error in preview: ${err.message} ${err.constraint}`
++ );
+ }
+- video.srcObject = stream;
+- video.stream = stream;
+- doc.getElementById("webRTC-preview").hidden = false;
+- video.onloadedmetadata = function(e) {
+- video.play();
+- };
+- },
+- err => {
+- if (
+- err.name == "OverconstrainedError" &&
+- err.constraint == "deviceId"
+- ) {
+- // Window has disappeared since enumeration, which can happen.
+- // No preview for you.
+- return;
+- }
+- Cu.reportError(
+- `error in preview: ${err.message} ${err.constraint}`
+- );
+- }
+- );
++ );
++ }
+ };
+ menupopup.addEventListener("command", menupopup._commandEventListener);
+ }
+
bgstack15