It doesn't really make sense to try to create the X11 capturer if we are
running under Wayland; nor does it make sense to create the PipeWire
capturer if we are going to fail to actually start a stream with it.
This change addresses both of these issues by exposing an IsSupported
method on BaseCapturerPipeWire and checking that we are not running
under Wayland before creating the X11 capturer.
Bug: chromium:1374436
Change-Id: Ieb291307376010e084824124ea8fde065545337c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279163
Auto-Submit: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#38474}
Now that we've added the ability to open and close the PipeWire picker
to the DesktopCapture interface, we can split the picker back into a
Window and a Screen picker rather than just having the one combined
picker. This will allow for a better user experience, as we can create
a picker targeted to what the users actually want to share.
Bug: chromium:1351570
Change-Id: I5bec22912ae01c1b0b0709a4979b4698226a2a66
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/273541
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#38000}
Make PipeWire stream shared through DesktopCaptureOptions (similar to
X11 implementation sharing XDisplay) so we can implement better cursor
support with our own MouseCursorMonitor implementation.
Bug: webrtc:13429
Change-Id: I781482aa29cee0c105c42e5109f28e95dde9881b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/238174
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Mark Foltz <mfoltz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#35765}
This reverts commit 3a285224b6.
Reason for revert: Still breaking downstream projects due to not using forward headers. I will talk to Mark separately about the usage.
Original change's description:
> Reland "Linux capturers: organize X11 and Wayland implementations into separate folders"
>
> Bug: webrtc:13429
> Change-Id: I6e88de4f7ebcb64076312d83ac2c79db24f85ad8
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/239841
> Commit-Queue: Mark Foltz <mfoltz@chromium.org>
> Reviewed-by: Mark Foltz <mfoltz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#35481}
TBR=grulja@gmail.com,mfoltz@chromium.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com
Change-Id: I1f75e3d89495f2a9a31d0f4406a3efdf0d95f74a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:13429
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/240064
Owners-Override: Christoffer Jansson <jansson@google.com>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Christoffer Jansson <jansson@google.com>
Cr-Commit-Position: refs/heads/main@{#35484}
This reverts commit 998e9bd5c5.
Reason for revert: Breaks downstream projects because some headers
have been renamed without providing a forward header for backwards
compatibility.
Original change's description:
> Linux capturers: organize X11 and Wayland implementations into separate folders
>
> Bug: webrtc:13429
> Change-Id: I2db727797c2ca2bd85937ff732ce3f68bb45469a
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/238173
> Reviewed-by: Mark Foltz <mfoltz@chromium.org>
> Commit-Queue: Mark Foltz <mfoltz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#35471}
TBR=tommi@webrtc.org,sprang@chromium.org,mfoltz@chromium.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com,grulja@gmail.com
Change-Id: I2aadfeb30151fcbe1a8c05e856be989d60bb10a3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:13429
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/239821
Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#35472}
Changes:
1) Scoped class
This is a special class for GLib based objects which we need to manually
delete with different functions. Wrapping these objects into Scoped class
will destroy them automatically when they go out of scope.
2) Window sharing support
Unlike screen sharing, with window sharing we are required to obtain more
information from the PipeWire stream, like video crop metadata, which we
use to properly set size of our buffer.
3) Support for DmaBuf and MemFd buffer types
As of now, we expected the PipeWire stream will provide only plain data
which we just need to copy to our buffer. We now add support for new
buffer types, which are often preferred for better effeciency.
4) Minor bugfixes:
a) Additionally accept PipeWire streams using alpha channels (BGRA, RGBA)
b) Add lock over PipeWire loop to prevent potential issues until we fully
intialize everything we need
c) When obtaining buffers, make sure we work with the latest one
Bug: chromium:682122
Change-Id: I64638d5dcbe18e7280550dca0b01b17c511ac98a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/194100
Commit-Queue: Jamie Walch <jamiewalch@chromium.org>
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#32763}
This reverts commit 84524e6b19.
Reason for revert: https://webrtc-review.googlesource.com/c/src/+/160649/33#message-a83e8959e03a274642ca2ce1abb9ea0099f08097 + suspected in breaking WebRTC to Chromium rolls https://chromium-review.googlesource.com/c/chromium/src/+/2468139
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: I2bcd07d16a5eb3b902db63ea9a164c5bd39c23a0
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/187492
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Tommi <tommi@webrtc.org>
> Commit-Queue: Tommi <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32388}
TBR=mbonadei@webrtc.org,tommi@webrtc.org,sprang@webrtc.org,guidou@webrtc.org,mfoltz@chromium.org,grulja@gmail.com
Change-Id: I1a9748ced5626903b12214d677c7b8919c2ac385
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:682122
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/188380
Reviewed-by: Olga Sharonova <olka@webrtc.org>
Commit-Queue: Olga Sharonova <olka@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32398}
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: I2bcd07d16a5eb3b902db63ea9a164c5bd39c23a0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/187492
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32388}
This reverts commit 9b87037073.
Reason for revert: Causing compile failures that prevent rolling into chrome.
See https://ci.chromium.org/p/chromium/builders/try/cast_shell_linux/726007https://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 <tommi@webrtc.org>
> Reviewed-by: Tommi <tommi@webrtc.org>
> Reviewed-by: Erik Språng <sprang@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32342}
TBR=mbonadei@webrtc.org,jamiewalch@chromium.org,tommi@webrtc.org,sprang@webrtc.org,tomas.popela@gmail.com,grulja@gmail.com
# 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 <guidou@webrtc.org>
Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32365}
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 <tommi@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32342}
USE_X11 is magically set by the toolchain. Let's tie this to
whether X11 extensions is on or not. WEBRTC_USE_X11 is used
in the audio device module so let's be consistent with that.
Bug: b/143587130
Change-Id: I15b1744c9acb534dbdf2119deb2dc5d17aa04184
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161901
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30080}
This is a follow-up to
https://webrtc-review.googlesource.com/c/src/+/106280.
This time the whole code base is covered.
Some files may have not been fixed though, whenever the IWYU tool
was breaking the build.
Bug: webrtc:8311
Change-Id: I2c31f552a87e887d33931d46e87b6208b1e483ef
Reviewed-on: https://webrtc-review.googlesource.com/c/111965
Commit-Queue: Yves Gerey <yvesg@google.com>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25830}
The content_unittests failure was caused by wrong path in the cfi
blacklist (when the files from x11 folder were moved to the linux
folder by this change).
Bug: chromium:682122
Change-Id: I4f7f6c5a73a981feeac18494749f85935e812981
Reviewed-on: https://webrtc-review.googlesource.com/c/110461
Commit-Queue: Tomáš Popela <tomas.popela@gmail.com>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Brave Yao <braveyao@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25621}
This reverts commit dd20c9c1e3.
Reason for revert: Speculative revert; looks like it causes crashes on official builders. See crbug.com/901319.
Original change's description:
> Add support for screen sharing with PipeWire on Wayland
>
> Currently, when users want to use the screen sharing and are using the
> Wayland display server (the default on Fedora distribution), then it
> doesn't work, because the WebRTC only includes the X11 implementation.
> This change adds the support by using the PipeWire multimedia server.
>
> The PipeWire implementation in WebRTC stays in
> screen-capturer-pipewire.c and is guarded by the rtc_use_pipewire build
> flag that is automatically enabled on Linux.
>
> More information are included in the relevant commit messages.
>
> Tested on the current Chromium master and Firefox.
>
> The sysroot changes are requested in:
> https://chromium-review.googlesource.com/c/chromium/src/+/1258174
>
> Co-authored-by: Jan Grulich <grulja@gmail.com>
> Co-authored-by: Eike Rathke <erathke@redhat.com>
> Change-Id: I212074a4bc437b99a77bf383266026c5bfae7c4a
>
> BUG=chromium:682122
>
> Change-Id: I212074a4bc437b99a77bf383266026c5bfae7c4a
> Reviewed-on: https://webrtc-review.googlesource.com/c/103504
> Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
> Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
> Reviewed-by: Brave Yao <braveyao@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25461}
TBR=phoglund@webrtc.org,jamiewalch@chromium.org,niklas.enbom@webrtc.org,braveyao@webrtc.org,tomas.popela@gmail.com
# Not skipping CQ checks because original CL landed > 1 day ago.
NOPRESUBMIT=true
Bug: chromium:682122, chromium:901319
Change-Id: I4ca5da77daea73cae1232953a0d633900a85a93d
Reviewed-on: https://webrtc-review.googlesource.com/c/109584
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25522}
Currently, when users want to use the screen sharing and are using the
Wayland display server (the default on Fedora distribution), then it
doesn't work, because the WebRTC only includes the X11 implementation.
This change adds the support by using the PipeWire multimedia server.
The PipeWire implementation in WebRTC stays in
screen-capturer-pipewire.c and is guarded by the rtc_use_pipewire build
flag that is automatically enabled on Linux.
More information are included in the relevant commit messages.
Tested on the current Chromium master and Firefox.
The sysroot changes are requested in:
https://chromium-review.googlesource.com/c/chromium/src/+/1258174
Co-authored-by: Jan Grulich <grulja@gmail.com>
Co-authored-by: Eike Rathke <erathke@redhat.com>
Change-Id: I212074a4bc437b99a77bf383266026c5bfae7c4a
BUG=chromium:682122
Change-Id: I212074a4bc437b99a77bf383266026c5bfae7c4a
Reviewed-on: https://webrtc-review.googlesource.com/c/103504
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Brave Yao <braveyao@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25461}