Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 4cf8e17

Browse files
Guido UrdanetaCommit Bot
authored andcommitted
Revert "Improve screen sharing with PipeWire on Wayland"
This reverts commit 9b87037. Reason for revert: Causing compile failures that prevent rolling into chrome. See https://ci.chromium.org/p/chromium/builders/try/cast_shell_linux/726007 https://chromium-review.googlesource.com/c/chromium/src/+/2461647 Original change's description: > Improve screen sharing with PipeWire on Wayland > > Currently, sharing a screen or a window on Wayland opens unnecessary > preview dialog on Chromium side, which is then followed by a similar > dialog on xdg-desktop-portal side. The Chromium dialog is useless on > Wayland, as it doesn't show anything. This is because Chromium doesn't > have access to screen content as in case of X11 session. To fix this, we > want to avoid showing the preview dialog in case we find that we run on > Wayland and only pick a screen or a window from the dialog that comes > from xdg-desktop-portal. > > This patch splits BaseCapturerPipeWire class, moving portal related code > into XdgPortalBase, which does all the DBus communication and which is > supposed to be reused by BaseCapturerPipeWire when the user confirms > the dialog from xdg-desktop-portal. The XdgPortalBase is extended to > support multiple calls at once, where each call is identified by Id. > > Relevant change on Chromium side will be in a different review. > > Bug: chromium:682122 > Change-Id: If8afd36da66231eb154cdc00114908ac897ee4cf > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160649 > Commit-Queue: Tommi <[email protected]> > Reviewed-by: Tommi <[email protected]> > Reviewed-by: Erik Språng <[email protected]> > Cr-Commit-Position: refs/heads/master@{#32342} [email protected],[email protected],[email protected],[email protected],[email protected],[email protected] # Not skipping CQ checks because original CL landed > 1 day ago. Bug: chromium:682122 Change-Id: I41518f795e34b84374bc8208b711cfeb0a070578 No-Try: True Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/187352 Commit-Queue: Guido Urdaneta <[email protected]> Reviewed-by: Guido Urdaneta <[email protected]> Cr-Commit-Position: refs/heads/master@{#32365}
1 parent 3fb94a4 commit 4cf8e17

16 files changed

+1075
-1818
lines changed

modules/desktop_capture/BUILD.gn

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,6 @@ if (rtc_include_tests) {
7676
"window_finder_unittest.cc",
7777
]
7878
public_configs = [ ":x11_config" ]
79-
if (is_linux) {
80-
public_configs += [ ":pipewire_config" ]
81-
if (rtc_use_pipewire) {
82-
configs += [
83-
":pipewire_config",
84-
":gio",
85-
]
86-
87-
if (rtc_link_pipewire) {
88-
configs += [ ":pipewire" ]
89-
} else {
90-
deps += [ ":pipewire_stubs" ]
91-
}
92-
}
93-
}
9479
if (is_win) {
9580
deps += [ "../../rtc_base:win32" ]
9681
}
@@ -147,21 +132,6 @@ if (rtc_include_tests) {
147132
}
148133
deps += [ ":desktop_capture_mock" ]
149134
public_configs = [ ":x11_config" ]
150-
if (is_linux) {
151-
public_configs += [ ":pipewire_config" ]
152-
if (rtc_use_pipewire) {
153-
configs += [
154-
":pipewire_config",
155-
":gio",
156-
]
157-
158-
if (rtc_link_pipewire) {
159-
configs += [ ":pipewire" ]
160-
} else {
161-
deps += [ ":pipewire_stubs" ]
162-
}
163-
}
164-
}
165135
}
166136
}
167137

@@ -526,7 +496,6 @@ rtc_library("desktop_capture_generic") {
526496
absl_deps = [
527497
"//third_party/abseil-cpp/absl/memory",
528498
"//third_party/abseil-cpp/absl/strings",
529-
"//third_party/abseil-cpp/absl/types:optional",
530499
]
531500

532501
if (rtc_use_x11_extensions) {
@@ -547,10 +516,10 @@ rtc_library("desktop_capture_generic") {
547516
sources += [
548517
"linux/base_capturer_pipewire.cc",
549518
"linux/base_capturer_pipewire.h",
550-
"linux/pipewire_base.cc",
551-
"linux/pipewire_base.h",
552-
"linux/xdg_desktop_portal_base.cc",
553-
"linux/xdg_desktop_portal_base.h",
519+
"linux/screen_capturer_pipewire.cc",
520+
"linux/screen_capturer_pipewire.h",
521+
"linux/window_capturer_pipewire.cc",
522+
"linux/window_capturer_pipewire.h",
554523
]
555524

556525
configs += [

modules/desktop_capture/desktop_capture_options.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ DesktopCaptureOptions DesktopCaptureOptions::CreateDefault() {
3535
#if defined(WEBRTC_USE_X11)
3636
result.set_x_display(SharedXDisplay::CreateDefault());
3737
#endif
38-
#if defined(WEBRTC_USE_PIPEWIRE)
39-
result.set_xdp_base(XdgDesktopPortalBase::CreateDefault());
40-
#endif
4138
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
4239
result.set_configuration_monitor(new DesktopConfigurationMonitor());
4340
result.set_full_screen_window_detector(

modules/desktop_capture/desktop_capture_options.h

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#ifndef MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_OPTIONS_H_
1111
#define MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_OPTIONS_H_
1212

13-
#include "absl/types/optional.h"
1413
#include "api/scoped_refptr.h"
1514
#include "rtc_base/system/rtc_export.h"
1615

@@ -24,10 +23,6 @@
2423

2524
#include "modules/desktop_capture/full_screen_window_detector.h"
2625

27-
#if defined(WEBRTC_USE_PIPEWIRE)
28-
#include "modules/desktop_capture/linux/xdg_desktop_portal_base.h"
29-
#endif
30-
3126
namespace webrtc {
3227

3328
// An object that stores initialization parameters for screen and window
@@ -136,68 +131,13 @@ class RTC_EXPORT DesktopCaptureOptions {
136131
#if defined(WEBRTC_USE_PIPEWIRE)
137132
bool allow_pipewire() const { return allow_pipewire_; }
138133
void set_allow_pipewire(bool allow) { allow_pipewire_ = allow; }
139-
140-
// Provides a way how to identify portal call for a sharing request
141-
// made by the client. This allows to go through the preview dialog
142-
// and to the web page itself with just one xdg-desktop-portal call.
143-
// Client is supposed to:
144-
// 1) Call start_request(id) to tell us an identificator for the current
145-
// request
146-
// 2) Call close_request(id) in case the preview dialog was cancelled
147-
// or user picked a web page to be shared
148-
// Note: In case the current request is not finalized, we will close it for
149-
// safety reasons and client will need to ask the portal again
150-
// This was done primarily for chromium support as there was no way how to
151-
// identify a portal call made for the preview and later on continue with the
152-
// same content on the web page itself.
153-
154-
void start_request(int32_t request_id) {
155-
// In case we get a duplicit start_request call, which might happen when a
156-
// browser requests both screen and window sharing, we don't want to do
157-
// anything.
158-
if (request_id == xdp_base_->CurrentConnectionId()) {
159-
return;
160-
}
161-
162-
// In case we are about to start a new request and the previous one is not
163-
// finalized and not stream to the web page itself we will just close it.
164-
if (!xdp_base_->IsConnectionStreamingOnWeb(absl::nullopt) &&
165-
xdp_base_->IsConnectionInitialized(absl::nullopt)) {
166-
xdp_base_->CloseConnection(absl::nullopt);
167-
}
168-
169-
xdp_base_->SetCurrentConnectionId(request_id);
170-
}
171-
172-
void close_request(int32_t request_id) {
173-
xdp_base_->CloseConnection(request_id);
174-
xdp_base_->SetCurrentConnectionId(absl::nullopt);
175-
}
176-
177-
absl::optional<int32_t> request_id() {
178-
// Reset request_id in case the connection is in final state, which means it
179-
// is streaming content to the web page itself and nobody should be asking
180-
// again for this ID.
181-
if (xdp_base_->IsConnectionStreamingOnWeb(absl::nullopt)) {
182-
xdp_base_->SetCurrentConnectionId(absl::nullopt);
183-
}
184-
185-
return xdp_base_->CurrentConnectionId();
186-
}
187-
188-
XdgDesktopPortalBase* xdp_base() const { return xdp_base_; }
189-
void set_xdp_base(rtc::scoped_refptr<XdgDesktopPortalBase> xdp_base) {
190-
xdp_base_ = std::move(xdp_base);
191-
}
192134
#endif
193135

194136
private:
195137
#if defined(WEBRTC_USE_X11)
196138
rtc::scoped_refptr<SharedXDisplay> x_display_;
197139
#endif
198-
#if defined(WEBRTC_USE_PIPEWIRE)
199-
rtc::scoped_refptr<XdgDesktopPortalBase> xdp_base_;
200-
#endif
140+
201141
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
202142
rtc::scoped_refptr<DesktopConfigurationMonitor> configuration_monitor_;
203143
bool allow_iosurface_ = false;

0 commit comments

Comments
 (0)