Commit Graph

19 Commits

Author SHA1 Message Date
45a22ffbb7 wayland: Support dynamic resolution changes of pw stream
This change adds support for dynamic resolution adjustment
of pipewire stream.

Bug: chromium:1291247
Change-Id: I87e02484920f795a053a814eb872834ab22c1bd3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/263680
Commit-Queue: Salman Malik <salmanmalik@google.com>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#37010}
2022-05-26 19:15:54 +00:00
f71315c480 Wayland: Allow setting custom resolution
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}
2022-05-23 21:51:16 +00:00
43feb9e5a2 Check PipeWire server version when dropping single modifier
PipeWire server in older versions would mark the negotiation as
finished and start creating buffers.

Upstream bug: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1732

Bug: webrtc:13429
Change-Id: I7194e6672716d7fef1c2aadc40d3acf55cb282a2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262621
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#36901}
2022-05-16 18:30:34 +00:00
6d0d844d1f Add CFI-ICALL to avoid crash in PipeWire functions
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}
2022-05-05 18:15:08 +00:00
96544b72eb PipeWire capturer: split some PipeWire code that can be reused
This is code that will be used to write tests and that makes sense to be
moved out and used somewhere else.

Bug: webrtc:13429
Change-Id: I2dd8f3111fdc9e6fa121c1e18644cbcf340b584e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256009
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#36307}
2022-03-23 16:48:02 +00:00
0627cb3920 shared_screencast_stream: Set rectangle on the frame
The diff capturer wrapper doesn't work if the frame doesn't have any
rectangle and a static image is observed while chromoting. This change
adds a rectangle to the frame object, as done by other capturers, and
this in turn ensures that the wrapper that calulcates diffs from one
frame to the next can do its job.

Bug: chromium:1291247
Change-Id: I5bf1981f34b3a88ad4d82a081fed1ce210f71ed0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251205
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Salman Malik <salmanmalik@google.com>
Cr-Commit-Position: refs/heads/main@{#36263}
2022-03-18 22:08:46 +00:00
c2cd814cdd PipeWire capturer: check existence of cursor metadata
Check whether there are any cursor metadata before we try to validate
and use them, otherwise we might crash on this.

Bug: webrtc:13429
Change-Id: I365da59a189b6b974cebafc94fec49d5b942efae
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/255601
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#36240}
2022-03-17 18:14:26 +00:00
5ae9b260ff Implement MouseCursorMonitorPipeWire to track cursor changes separately
Current implementation has mouse cursor as part of the screen itself
which means that everytime a cursor changes location, we have to update
whole screen content, which brings unnecessary load overhead. Using our
own mouse cursor monitor implementation allows us to track only mouse
cursor changes and update them separately for much better performance.

Bug: webrtc:13429
Change-Id: I224e9145f0bc7e45eafe4490de160f2ad4c8b545
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/244507
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Mark Foltz <mfoltz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#36011}
2022-02-15 23:03:41 +00:00
2f194e0325 PipeWire capturer: Import DMA-BUFs with correct render node
With more GPUs it might happen that server used different render
node from the one we pick from the list. This would cause DMA-BUF to
fail to import so we use Wayland client library to obtain wl_display in
order to initialize EGLDisplay using same render node and have previous
approach as a fallback. Also everyone else uses EGL_LINUX_DMA_BUF_EXT
target for importing EGLImages from DMA-BUF file descriptors so use it
as well to be sure we import buffers same way as they are produced.

Bug: chromium:1290566
Bug: webrtc:13429
Change-Id: I32bbb0bdb28c08b6e7fcb3f94009f82a2041b6ee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250661
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Jan Grulich <grulja@gmail.com>
Commit-Queue: Mark Foltz <mfoltz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#35997}
2022-02-14 20:08:50 +00:00
b02220d1a0 Reland "Mark all bool conversion operators as explicit"
This is a reland of 325789c4576b60147ee1ef225d438cbb740f65ff

Original change's description:
> Mark all bool conversion operators as explicit
>
> An explicit bool conversion operator will still be used implicitly
> when an expression appears in "bool context", e.g., as the condition
> in an if statement, or as argument to logical operators. The
> `explicit` annotation prevents conversion in other contexts, e.g.,
> converting both a and b to bool in an expression like `a == b`.
>
> Bug: None
> Change-Id: I79ef35b1ea831e6011ae472900375ae8a3e617ab
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250664
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35927}

Bug: None
Change-Id: Ie057dfc8c0b5c498e2c8daff7620172c89f0e011
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251380
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35962}
2022-02-09 09:40:05 +00:00
f4cad8ac51 PipeWire capturer: drop DMA-BUF modifier and renegotiate parameters on failure
In case we fail to import a DMA-BUF with given modifier, we can try to
drop the modifier we failed to use and renegotiate stream parameters
in order to use a different modifier or fallback to shared memory buffers.

Bug: chromium:1290566
Change-Id: I617513bdd67a43f62b647a172e0c166af138b3f9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249798
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Mark Foltz <mfoltz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#35957}
2022-02-08 20:38:54 +00:00
49e0e77e40 PipeWire capturer: make use of ScreenCaptureFrameQueue
This allows us to keep always some frame around so we can return it
everytime consumer asks us to capture a frame as before we either
returned current frame or nothing as there was no new frame available.
This will be needed in order to support mouse cursor separately as
DesktopAndCursorComposer requires frame everytime, even if it's the
same one as before so we can combine it with the mouse cursor.

Bug: webrtc:13429
Change-Id: Ice87968846870c0a880ab469d9e052b4978e658c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/239362
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Mark Foltz <mfoltz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#35956}
2022-02-08 18:02:25 +00:00
1a58a3fe3f Reland "Delete implicit conversion from raw pointer to scoped_ref_ptr"
This is a reland of 7b370b935ec0dac991da08f9da227df9ce245fd5

Original change's description:
> Delete implicit conversion from raw pointer to scoped_ref_ptr
>
> Followup to https://webrtc-review.googlesource.com/c/src/+/242363
>
> Bug: webrtc:13464
> Change-Id: I44358e8cfedeea92aac4ef47c540aff9a4865cdc
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/247362
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35897}

Bug: webrtc:13464
Change-Id: Ia0da558adb65852a900030ca7c2f2310a275188e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251140
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35943}
2022-02-08 08:40:44 +00:00
c1fd46f879 Revert "Mark all bool conversion operators as explicit"
This reverts commit 325789c4576b60147ee1ef225d438cbb740f65ff.

Reason for revert: Breaks downstream clients.

Original change's description:
> Mark all bool conversion operators as explicit
>
> An explicit bool conversion operator will still be used implicitly
> when an expression appears in "bool context", e.g., as the condition
> in an if statement, or as argument to logical operators. The
> `explicit` annotation prevents conversion in other contexts, e.g.,
> converting both a and b to bool in an expression like `a == b`.
>
> Bug: None
> Change-Id: I79ef35b1ea831e6011ae472900375ae8a3e617ab
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250664
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35927}

TBR=mbonadei@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I392cd0c7bd96c90e0db20831864418adb7d58bc3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: None
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251080
Auto-Submit: Mirko Bonadei <mbonadei@webrtc.org>
Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35929}
2022-02-07 10:24:45 +00:00
325789c457 Mark all bool conversion operators as explicit
An explicit bool conversion operator will still be used implicitly
when an expression appears in "bool context", e.g., as the condition
in an if statement, or as argument to logical operators. The
`explicit` annotation prevents conversion in other contexts, e.g.,
converting both a and b to bool in an expression like `a == b`.

Bug: None
Change-Id: I79ef35b1ea831e6011ae472900375ae8a3e617ab
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250664
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35927}
2022-02-07 09:14:05 +00:00
e4d34b1e3b Add CFI-ICALL to needed PipeWire methods
Adds missing RTC_NO_SANITIZE("cfi-icall") attributes to a few needed
functions for PipeWire initialization. These are methods that call (or
call methods that end up inlined and call) function pointers as a result
of dlopen'ing a lib. For ShareScreencastStream, the generated
InitializeStubs method appears to trigger this; while the egl_dmabuf
destructor appears to need this due to the EglDestroyContext and
EglTerminate calls that it makes.

Bug: webrtc:13659
Change-Id: Idb4af985293224957a50d17d9042524af2b66138
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250702
Auto-Submit: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Mark Foltz <mfoltz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#35918}
2022-02-04 22:32:51 +00:00
f2126a5184 Revert "Delete implicit conversion from raw pointer to scoped_ref_ptr"
This reverts commit 7b370b935ec0dac991da08f9da227df9ce245fd5.

Reason for revert: Breaking WebRTC in Chrome rolls. Roll can be found here https://chromium-review.googlesource.com/c/chromium/src/+/3436384/. Example failed build https://ci.chromium.org/ui/p/chromium/builders/try/chromeos-amd64-generic-rel-compilator/65973/overview. Failures seem to be in ChromeOS with the nearby library: 
 error: no viable conversion from 'rtc::RefCountedObject<CreateSessionDescriptionObserverImpl> *' to 'rtc::scoped_refptr<CreateSessionDescriptionObserverImpl>'

Original change's description:
> Delete implicit conversion from raw pointer to scoped_ref_ptr
>
> Followup to https://webrtc-review.googlesource.com/c/src/+/242363
>
> Bug: webrtc:13464
> Change-Id: I44358e8cfedeea92aac4ef47c540aff9a4865cdc
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/247362
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35897}

TBR=mbonadei@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Ib0beb44421519c8393131c55564c62c9b4d91504
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:13464
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250621
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35905}
2022-02-04 08:21:01 +00:00
7b370b935e Delete implicit conversion from raw pointer to scoped_ref_ptr
Followup to https://webrtc-review.googlesource.com/c/src/+/242363

Bug: webrtc:13464
Change-Id: I44358e8cfedeea92aac4ef47c540aff9a4865cdc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/247362
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35897}
2022-02-03 10:20:23 +00:00
c0a4316825 PipeWire capturer: split xdg-desktop-portal and PipeWire implementations
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}
2022-01-21 19:14:37 +00:00