forked from mirrors/gecko-dev
Bug 1675764 [Wayland] Use explicit PipeWire entry at screen sharing dialog when PipeWire is used, r=dminor,jib,johannh
When we share content by PipeWire, a system portal is used to select which content is shared. In that case put only PipeWire portal name placeholder to device list. Differential Revision: https://phabricator.services.mozilla.com/D96694
This commit is contained in:
parent
90e37220e0
commit
f11f528e9f
3 changed files with 37 additions and 5 deletions
|
|
@ -45,6 +45,14 @@ XPCOMUtils.defineLazyServiceGetter(
|
||||||
"nsIOSPermissionRequest"
|
"nsIOSPermissionRequest"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Keep in sync with defines at base_capturer_pipewire.cc
|
||||||
|
// With PipeWire we can't select which system resource is shared so
|
||||||
|
// we don't create a window/screen list. Instead we place these constants
|
||||||
|
// as window name/id so frontend code can identify PipeWire backend
|
||||||
|
// and does not try to create screen/window preview.
|
||||||
|
const PIPEWIRE_PORTAL_NAME = "####_PIPEWIRE_PORTAL_####";
|
||||||
|
const PIPEWIRE_ID = 0xaffffff;
|
||||||
|
|
||||||
class WebRTCParent extends JSWindowActorParent {
|
class WebRTCParent extends JSWindowActorParent {
|
||||||
didDestroy() {
|
didDestroy() {
|
||||||
webrtcUI.forgetStreamsFromBrowserContext(this.browsingContext);
|
webrtcUI.forgetStreamsFromBrowserContext(this.browsingContext);
|
||||||
|
|
@ -774,6 +782,23 @@ function prompt(aActor, aBrowser, aRequest) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
name = device.name;
|
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") {
|
if (type == "application") {
|
||||||
// The application names returned by the platform are of the form:
|
// The application names returned by the platform are of the form:
|
||||||
// <window count>\x1e<application name>
|
// <window count>\x1e<application name>
|
||||||
|
|
|
||||||
|
|
@ -767,6 +767,7 @@ getUserMedia.selectWindowOrScreen.label=Window or Screen to share:
|
||||||
getUserMedia.selectWindowOrScreen.accesskey=W
|
getUserMedia.selectWindowOrScreen.accesskey=W
|
||||||
getUserMedia.pickWindowOrScreen.label = Select Window or Screen
|
getUserMedia.pickWindowOrScreen.label = Select Window or Screen
|
||||||
getUserMedia.shareEntireScreen.label = Entire screen
|
getUserMedia.shareEntireScreen.label = Entire screen
|
||||||
|
getUserMedia.sharePipeWirePortal.label = Use operating system settings
|
||||||
# LOCALIZATION NOTE (getUserMedia.shareMonitor.label):
|
# LOCALIZATION NOTE (getUserMedia.shareMonitor.label):
|
||||||
# %S is screen number (digits 1, 2, etc)
|
# %S is screen number (digits 1, 2, etc)
|
||||||
# Example: Screen 1, Screen 2,..
|
# Example: Screen 1, Screen 2,..
|
||||||
|
|
|
||||||
|
|
@ -898,17 +898,23 @@ void BaseCapturerPipeWire::CaptureFrame() {
|
||||||
callback_->OnCaptureResult(Result::SUCCESS, std::move(result));
|
callback_->OnCaptureResult(Result::SUCCESS, std::move(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keep in sync with defines at browser/actors/WebRTCParent.jsm
|
||||||
|
// With PipeWire we can't select which system resource is shared so
|
||||||
|
// we don't create a window/screen list. Instead we place these constants
|
||||||
|
// as window name/id so frontend code can identify PipeWire backend
|
||||||
|
// and does not try to create screen/window preview.
|
||||||
|
|
||||||
|
#define PIPEWIRE_ID 0xaffffff
|
||||||
|
#define PIPEWIRE_NAME "####_PIPEWIRE_PORTAL_####"
|
||||||
|
|
||||||
bool BaseCapturerPipeWire::GetSourceList(SourceList* sources) {
|
bool BaseCapturerPipeWire::GetSourceList(SourceList* sources) {
|
||||||
RTC_DCHECK(sources->size() == 0);
|
sources->push_back({PIPEWIRE_ID, 0, PIPEWIRE_NAME});
|
||||||
// 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});
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseCapturerPipeWire::SelectSource(SourceId id) {
|
bool BaseCapturerPipeWire::SelectSource(SourceId id) {
|
||||||
// Screen selection is handled by the xdg-desktop-portal.
|
// Screen selection is handled by the xdg-desktop-portal.
|
||||||
return true;
|
return id == PIPEWIRE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue