firefox/pw7.patch

96 lines
3.6 KiB
Diff

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);
}