This CL removes the split of "desktop_capture" in 2 build targets
(one for C++ and one for Obj-C++) by moving the C++ part to
"desktop_capture" itself and keeping the Obj-C++ variant but allowing
it to include .h files that are also part of "desktop_capture".
This removes the build cycle between the two targets (which conceptually
are the same target).
Clients should never depend on "desktop_capture_objc", which will
be linked by "desktop_capture" when needed.
Bug: b/36882554
Change-Id: Id219a15e549275870c54375c07f00cfe704ab7cb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266743
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Oleh Prypin <oprypin@google.com>
Cr-Commit-Position: refs/heads/main@{#37337}
When a display uses a scale factor (different than 1.0) the previous
cursor position is not properly cleared during a CRD connection on
ChromeOS (see b/235191365).
The issue was that the fix for crbug.com/1323241 does not take device
scaling into account, so that fix would incorrectly not mark the
previous location of the mouse cursor as modified.
Adding proper boundary checks is hard and risky though, as the way the
position of the mouse cursor is reported seems to be platform dependent
(ChromeOS vs Linux vs ...).
So because crbug.com/1323241 only solves a theoretical crash that is rarely if
ever hit in the field, I decided to for now undo the fix for crbug.com/1323241.
A proper boundary check can then later be introduced without any pressure from
a looming release
Bug: chromium:1323241
Bug: b/235191365
Fixed: b/235191365
Test: Manually deployed
Change-Id: Ib09b6cc5e396bd52538332edfc4395ed80c6786e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265391
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Joe Downing <joedow@google.com>
Commit-Queue: Jeroen Dhollander <jeroendh@google.com>
Cr-Commit-Position: refs/heads/main@{#37274}
Make use of "persist_mode" option in ScreenCast portal to restore
previously selected screen/window and avoid picking it again in yet
another xdg-desktop-portal dialog.
Bug: webrtc:13429
Change-Id: I3a0068091c2dd38003a7dff3f82b9cdb2ccd0f42
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/263901
Commit-Queue: Jan Grulich <grulja@gmail.com>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#37257}
When DMA-BUFs are used, sometimes stride we get from PipeWire might
contain additional padding, but after we import the buffer, the stride
we used is no longer relevant and we should just calculate it based on
width.
Bug: chromium:1333304
Change-Id: Id4300550f0b3c539ddd749e9285f525d4f816b80
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265384
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Jan Grulich <grulja@gmail.com>
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#37195}
This reverts commit 0ba10283fb3cbdf1cedea79d84e4bc3b720da6a1.
Reason for revert: This workaround is no longer needed, as the libyuv team has already fixed the underlying issue (in b/234824290)
Original change's description:
> Fix memory corruption in BasicDesktopFrame::CopyTo
>
> This memory corruption happens inside libyuv::CopyPlane()
> on platforms that support AVX. I opened b/234824290 so the libyuv team
> can investigate and fix this, but in the mean time we need to get this
> fixed asap as this is causing crashes on both M102 (which is released to
> stable) and M103 (which has this issue marked as beta blocking).
>
> Fixed: b/234824290
> Fixed: chromium:1330019
> Test: Manually reproduced on zork board
> Change-Id: I6bfd1e089020dfb23d974d3912d45c01a4e5ce26
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265041
> Auto-Submit: Jeroen Dhollander <jeroendh@google.com>
> Commit-Queue: Alexander Cooper <alcooper@chromium.org>
> Reviewed-by: Alexander Cooper <alcooper@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#37121}
Fixed: b/234824290
Fixed: chromium:1330019
Change-Id: Iafc0eac651fbc7a7fce5092306b12c4377248839
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265165
Auto-Submit: Jeroen Dhollander <jeroendh@google.com>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Frank Barchard <fbarchard@google.com>
Cr-Commit-Position: refs/heads/main@{#37142}
This memory corruption happens inside libyuv::CopyPlane()
on platforms that support AVX. I opened b/234824290 so the libyuv team
can investigate and fix this, but in the mean time we need to get this
fixed asap as this is causing crashes on both M102 (which is released to
stable) and M103 (which has this issue marked as beta blocking).
Fixed: b/234824290
Fixed: chromium:1330019
Test: Manually reproduced on zork board
Change-Id: I6bfd1e089020dfb23d974d3912d45c01a4e5ce26
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265041
Auto-Submit: Jeroen Dhollander <jeroendh@google.com>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#37121}
This CL allows the users to propose custom resolution to server
for the captured pipewire streams.
Bug: chromium:1291247
Change-Id: Iaae2c73df1a5f5ebac651ce7d087af4c273113c4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/263360
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Salman Malik <salmanmalik@google.com>
Cr-Commit-Position: refs/heads/main@{#36979}
HandleXEvent() returns true to indicate the event is consumed and
should not be passed to other registered handlers of the same
event-type.
In ScreenCapturerX11, this makes sense for XDamage events because they
are scoped to the object's |damage_handle_|. But RRScreenChangeNotify
and ConfigureNotify events are scoped to the root window, so this CL
changes the return value to false for these events. This allows other
handlers (including other screen-capturer instances) to see these
events.
Bug: webrtc:14060
Change-Id: Id18917b0b62d125da08578e08df9648062500cad
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262142
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Auto-Submit: Lambros Lambrou <lambroslambrou@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#36858}
Apple renamed CGColorSpaceCopyICCProfile to CGColorSpaceCopyICCData in
10.13. If you compile code with a minimum OS required of 10.13 or
newer, [-Werror,-Wdeprecated-declarations] will cause an error to
occur on use of the function with the old name.
Add a compile switch so that no error is emitted regardless of the
deployment configuration.
Bug: chromium:1322548
Change-Id: Ie969aa9e5c4fc9bee2ec88b126d4c07701c3e9e6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261953
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#36855}
This crash happened when:
* The cursor was located in the corner
* The screen was resized so that the cursor position is outside of the frame.
This caused us to add out-of-bound coordinates to the frame's updated_region, which caused crashes further down the pipeline.
Bug: chromium:1323241
Test: new unittest
Test: manually reproduced crash
Change-Id: Ie71db58c8a347f00af8a3803fcd55cdcad6eafac
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261263
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Jeroen Dhollander <jeroendh@google.com>
Cr-Commit-Position: refs/heads/main@{#36809}
Several tests starting failing when run on trybots on Win10. This CL
fixes several issues that were uncovered.
Issue 1:
Capture failed to start because `get_Size` returned {0, 0}. This is a
known issue in the WGC API that occurs when there are multiple user
sessions on the same machine.
Solution:
Add a `GetSize` method to the `WgcCaptureSource` interface so we can
fallback to other methods if `get_Size` fails.
Issue 2:
The screen capture tests assume there will be displays attached and
fail if there aren't.
Solution:
Always run `IsWgcSupported` for the appropriate capture type.
Issue 3:
ASAN container-overflow in `GetTestWindowIdFromSourceList`
Solution:
Check the validity of the iterator before dereferencing.
Issue 4:
Occasionally, the call to `GetMessage` in the `CloseWindowMidCapture`
test would hang because there were no messages in the queue.
Solution:
Use `PeekMessage` instead which will return if there are no messages.
Bug: webrtc:14002
Change-Id: I69b2f765db87d34a41d6a1796cd5a81f4029be33
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260202
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Austin Orion <auorion@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#36802}
We already use RTC_NO_SANITIZE("cfi-icall") for most of the code and
it looks this one can be triggered recently with pw_loop_signal_event()
call.
Bug: webrtc:13659
Change-Id: I4dbb88f32de861e05be18254640db90b0f58c5e5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261300
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Mark Foltz <mfoltz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#36787}
ChromeOS will use DPI (see crrev.com/c/3322917), but the
DesktopAndCursorComposer assumed pixels were used.
Test: Manually ensured it works
Bug: b/208370410
Change-Id: I5fee50d408fd204273946009e6653d4e60d1e458
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259502
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Jeroen Dhollander <jeroendh@google.com>
Cr-Commit-Position: refs/heads/main@{#36597}
While the target has a restricted visibility, since it was in rtc_base_approved
public deps, a lot of targets were able to bypass the visibility check.
So we remove the visibility restrictions and use the dependency explicitely
everywhere instead.
Bug: webrtc:8603
Change-Id: I94a03fdf7f94c54ab72081a58dd648e2cca73d17
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258944
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36566}
There is a crash report from the Windows OS API
where it repro only win10, not a Win11.
Unfortunately, Microsoft can't access the dump file or
hasn't repro internally so we decided to disable the WGC
fallback use in the OS other than Win11 now.
Once the change (support WGC fallback) reaches to Microsoft Edge
and it produce crash report, Edge team will take the
dump file to the Windows OS API owner for Win10 level fix (or
bring the Win11 fix to Win10).
Bug: chromium:1312937
Change-Id: I5335e2c57076d4fab08e9c74ade599259cff10d7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258821
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#36558}
XDG desktop portal utils implicitly rely on few portal interfaces.
This change makes those interfaces explicit.
Bug: chromium:1291247
Change-Id: I3c300f33d04bfa8857ac9f1f9d634dbfc077e591
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258720
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Salman Malik <salmanmalik@google.com>
Cr-Commit-Position: refs/heads/main@{#36557}
Versions of Windows before Win11 will crash when `CreateForMonitor` is
called, but the system has no attached displays. This can be avoided by
adding a check to ensure at least one display is found before we return
true in `IsMonitorValid`. Previously we would early return `true` if the
"monitor" we were checking was the `kFullDesktopScreenId`.
Bug: chromium:1316478
Change-Id: I2562fe3834db574cf3706ee1d604472ac03f9ff3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258920
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Austin Orion <auorion@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#36555}
Remote desktop wrapper needs to create a barrier on when the screencast
portal is done (either succeeded or failed). This change adds an initial
enum to differentiate it from other values. CL also generalizes the
helper `PortalFailed` to `OnPortalDone` so as to account for both
failure/success scenarios.
Bug: chromium:1291247
Change-Id: I188f72533e75a88c9b30ce2bb093dae548cef7b1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258540
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Salman Malik <salmanmalik@google.com>
Cr-Commit-Position: refs/heads/main@{#36526}
The Windows 2019 Enterprise SKU is based on RS5 but is missing support
for WGC. This changes adds a function IsWgcSupported which will check
that the API is actually present, which should be more robust than just
performing a version check.
Bug: webrtc:13932
Change-Id: Ib6a2278f316b9b86671df77fd37468c79564d655
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258163
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Austin Orion <auorion@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#36506}