Use SPA_CHUNK_FLAG_CORRUPTED and SPA_META_HEADER_FLAG_CORRUPTED flags to
determine corrupted buffers or corrupted buffer data. We used to only
rely on compositors setting chunk->size, but this doesn't make sense for
dmabufs where they have to make up arbitrary values. It also looks this
is not reliable and can cause glitches as we end up processing corrupted buffers.
(cherry picked from commit cfbd6b0884)
Bug: chromium:341928670
Change-Id: Ida0c6a5e7a37e19598c6d5884726200f81b94962
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/349881
Commit-Queue: Mark Foltz <mfoltz@chromium.org>
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#42292}
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/351563
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/6478@{#1}
Cr-Branched-From: 16fb7903e546051483720548168cd40cded7a040-refs/heads/main@{#42290}
These are required by the Perfetto API and the missing argument prevents
the use of Perfetto.
Bug: webrtc:15917
Change-Id: Ie40c0344dc9d8cd40f7c751b133d150b975a33c7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347702
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@google.com>
Cr-Commit-Position: refs/heads/main@{#42147}
fuchsia.ui.display.singleton
We previously used fuchsia.ui.scenic.Scenic/GetDisplayInfo to get
fuchsia.ui.gfx.DisplayInfo. This has been migrated to
fuchsia.ui.display.singleton.Info/GetMetrics and
fuchsia.ui.display.singleton.Metrics.
Bug: fuchsia:64206
Test: applied changes manually to local chromium repo's third_party/webrtc directory and compiled
Change-Id: If3c7fbd641ebd3b3333e7e5f1126f8f3ae3b97e7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/322780
Commit-Queue: Caroline Liu <carolineliu@google.com>
Reviewed-by: Emircan Uysaler <emircan@google.com>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#42104}
When refactoring the WGC capture path, the check of a closed source
had been placed at a level where the notification of a closed source
was left without being detected since the error message was never
provided to the main WgcCapturerWin::CaptureFrame() which sends the
error message up to the client.
This trivial change ensures that WgcCapturerWin::CaptureFrame() returns
with DesktopCapturer::Result::ERROR_PERMANENT as soon as
WgcCaptureSession::OnItemClosed() has been triggered and it will
ensure that the WGC capture session stops and that any attached
MediaStreamTrack will signal its onended event as expected.
Bug: chromium:330863510
Change-Id: I57e44df417c33efa0595fc277cac5429cf539b26
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/344420
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41963}
Announce that we support SPA_DATA_DmaBuf and tell PipeWire not to map
memory for us so we can handle it ourself, similar like we do in case of
screen sharing. This fixes an issue when a camera is already in use by
gstreamer (pipewiresrc), where DMABufs are used, and we try to share
same camera and get no content, as PipeWire doesn't want to mmap DMABuf
memory for us and we get NULL data pointers.
Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1876895
Bug: webrtc:15654
Change-Id: I788d8d12b2fcd5588329d7265e45b479f74bb628
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/338921
Commit-Queue: Jan Grulich <grulja@gmail.com>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#41826}
Marking capturer as failed will indicate consumers will not be getting
any new frames by sending back ERROR_PERMANENT and let them know that
screencast can be stopped from their side. This will make screencast to
stop when a window we share is closed or when screencast is closed from
system tray.
Bug: chromium:40276865
Change-Id: Ia2c13461bd3126cab9c4838b8aa6840578562e9e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339560
Commit-Queue: Jan Grulich <grulja@gmail.com>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#41817}
The code uses IDXGIOutput1::DuplicateOutput for screen capture and
it allows only DXGI_FORMAT_B8G8R8A8_UNORM texture format, which
works on most monitor cases except HDR monitor.
HDR mointor returns type of DXGI_FORMAT_R16G16B16A16_FLOAT.
These two types of DXGI_FORMAT_B8G8R8A8_UNORM and
DXGI_FORMAT_R16G16B16A16_FLOAT are all formats that DuplicateOutput
returns based on Windows OS team.
The fix is to add allowed format of DXGI_FORMAT_R16G16B16A16_FLOAT.
Manually repro the issue and validated the fix.
Bug: chromium:40787684
Change-Id: I0a7be38b14a06261d631d2db172f12725edbbf1f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339621
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@{#41749}
CGDisplayStreamCreate is an deprecated API. It was believed that the use
of it was disabled on Sonoma through the setting allow_iosurface = false
[1], which causes the thumbnails to be created by the API CGDisplayCreateImage.
This API is not marked as deprecated at the moment.
However, although the thumbnails are created through CGDisplayCreateImage,
CGDisplayStreamCreate() is still called and runs in the background.
This makes the capture chip appear.
No capture chip appears if this CL is landed and the ScreenCaptureKit
thumbnail capturer is enabled,
--enable-features="ScreenCaptureKitMac,ScreenCaptureKitStreamPickerSonoma,ThumbnailCapturerMac:capture_mode/sc_screenshot_manager"
[1] https://chromium-review.googlesource.com/c/chromium/src/+/4892397
Bug: chromium:1486851
Change-Id: I3422efffc57dcb3e8965f19a5eca7f2a95d62da1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334721
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41563}
Bug: webrtc:15719
Change-Id: I7daf8ee5b90fbe9f1246f1d99211ffa0d8a19f73
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/330780
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#41503}
This CL is a follow-up of work done in
https://webrtc-review.googlesource.com/c/src/+/323882 where the goal
was to reduce the amount of FrameDropped error logs in
WebRTC.DesktopCapture.Win.WgcCaptureSessionGetFrameResult.
The previous work avoids FrameDropped logs for a minimized window
being captured with WGC but we still se a large amount of these error
(or rather warning) logs. See [1] which comes from Canary.
This CL does two different things to improve the situation:
1) It adds kFramePoolEmpty to the existing
GetFrameResult::kFrameDropped enum to point out that the warning
comes from the frame pool not being able to return a valid new frame.
It also makes it more clear that it does not cause an outer/final
error as WgcCapturerResult::kFrameDropped. We still keep the inner
GetFrameResult::kFrameDropped but it is only produced when the frame
pool returns NULL and our external queue is empty. Hence, a real
frame-drop error. Note that, it is still easy to provoke
kFramePoolEmpty simply by asking for a high resolution at a high rate.
The example in [2] comes from a 4K screen @30fps. Hence, we have not
fixed anything yet.
2) It also increases the size of the internal frame pool from 1 to 2.
This does lead to an almost zero rate of kFramePoolEmpt
warnings at the expense of a slightly reduced max capture rate. BUT,
with 1 as size, we can "see" a higher max capture rate but it is not
a true rate since it comes with a high rate of kFramePoolEmpty
errors. Hence, we "emulate" a high capture rate by simply feeding
copies of the last frame that we had stored in the external queue.
Using 2 leads to a more "true" rate of what we actually can capture
in terms of *new* frames and also a substantially lower rate of
kFramePoolEmpty.
In addition, with 1 as size, if we ask at a too high rate and provide
a copy of the last frame, our CPU adaptation will not reduce its rate
since we think that things are OK when it is actually not.
Also, the samples in [3] and [4] both use 2 as numberOfBuffers
as well.
Let me also mention that with this small change, I a have not been
able to provoke any kFramePoolEmpty error messages.
Finally, geDisplayMedia can be called called with constraints where
min and max framerate is defined. The mechanism which maintains the
min rate is implemented via the RequestRefreshFrame API and it can
be sent to the source (DesktopCaptureDevice) back to back with a
previous timer interrupt for a capture request. Without this change,
these RRFs were also a source of a large amount of
kFramePoolEmpty error logs. With 2 buffers instead; this is no
longer the case.
[1] https://screenshot.googleplex.com/7sfv6HdGXLwyxdj
[2] https://paste.googleplex.com/4795680001359872
[3] https://github.com/robmikh/Win32CaptureSample/blob/master/Win32CaptureSample/SimpleCapture.cpp
[4] https://learn.microsoft.com/en-us/windows/uwp/audio-video-camera/screen-capture#add-the-screen-capture-capability
Bug: chromium:1314868
Change-Id: I73b823b31a993fd2cd6e007b212826dfe1a80012
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/325521
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#41079}
Bug: webrtc:1314868
Change-Id: Ia743d17d61d7d8ffc44030b5691efef1c7ed7991
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/324305
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#40994}
Without this change a FrameDropped sample will be added to
WebRTC.DesktopCapture.Win.WgcCaptureSessionGetFrameResult at the
current capture rate as long as a captured window is minimized.
Bug: webrtc:1314868
Change-Id: I9b68675486642e7ca25674df689c207ac94a206e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/323882
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#40969}
Makes it more clear that a certain API is only supported in Windows 11.
Bug: webrtc:15451
Change-Id: Ic3abfb2cbf0e30f9cb722ac843876f41279bf200
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/323161
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40931}
Do not automatically remove all tokens once we attempt to use them. This
mitigates an issue with Google Meet where an additional instance of a
DesktopCapturer is created and destroyed right away, taking away the
token we would use otherwise. Also save the token under same SourceId
once we get a new (but could be same) token from the restored session.
Bug: webrtc:15544
Change-Id: I565b22f5bf6a4d8a3b7d6d757f9c1046c7a0557d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/322621
Commit-Queue: Jan Grulich <grulja@gmail.com>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#40892}
NSApplicationActivateIgnoringOtherApps is about to be deprecated.
The default behavior is good enough.
Tested on Chrome using https://wicg.github.io/conditional-focus/demo/
Bug: webrtc:15511
Change-Id: I1f59aea3d4e7c4942d17ee5c4f1b6c2d398016ee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/321080
Commit-Queue: Johannes Kron <kron@webrtc.org>
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Auto-Submit: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40795}
This reverts commit 0f87b38535.
This is not needed with the macOS 14 SDK, which has the fix, and which
was landed in https://crrev.com/c/4875713.
Bug: chromium:1484363, chromium:1431897
Change-Id: I1e019ce71b90333d5d1333a3cf8bb510a3dbd212
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/320820
Reviewed-by: Tomas Gunnarsson <tommi@google.com>
Auto-Submit: Avi Drissman <avi@chromium.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40777}
Only has an effect on Windows versions higher than 2104 (10.0.20348.0).
Bug: webrtc:15451
Change-Id: I3ca48c88a6c2b9b87d43805fcb2ade444cd90480
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/318060
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40721}
These two functions contain complicated logic that will be used as
a fallback in Chromium if the new macOS picker code does not work
as intended.
Bug: chromium:1478172
Change-Id: I5f2878c5a8da38d59aa42ec1358398e3c921b65c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/319260
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40711}
The build target that CreateFromCGImage() belongs to, desktop_capture_obj
is not visible externally. A utility header is created to make it accessible.
Bug: chromium:1471931
Change-Id: Ie40f39114d277dc4b62fe2ce95a6b0c7b61a3943
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/318123
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Auto-Submit: Johannes Kron <kron@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40659}
CreateFromCGImage() is needed to be called directly when we move away
from using the deprecated API that is used in CreateForWindow().
Bug: chromium:1471931
Change-Id: I28a2972a2a995103829fd9aff4bc1137a8b424b0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/315324
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Mark Foltz <mfoltz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#40563}
This reverts commit 726992d7a4.
Reason for revert: Relanding with original errors fixed (tested by building the patch locally against Chromium)
This change no longer attempts to migrate the display size protocol from fuchsia.ui.scenic.Scenic/GetDisplayInfo to fuchsia.ui.display.singleton.Info/GetMetrics because the latter API was introduced in Fuchsia API 12, which is not yet supported in Chrome (hence some of the build errors causing the revert).
Original change's description:
> Revert "[fuchsia] remove Scenic and GFX dependencies in DesktopCapturer"
>
> This reverts commit fe5be2eb4f.
>
> Reason for revert: This breaks the WebRTC roll into Chromium:
>
> - https://chromium-review.googlesource.com/c/chromium/src/+/4688561
> - https://ci.chromium.org/ui/p/chromium/builders/try/fuchsia-binary-size/399140/overview
>
> Error:
>
> [4273/4389] CXX obj/third_party/webrtc/modules/desktop_capture/desktop_capture/screen_capturer_fuchsia.o
> FAILED: obj/third_party/webrtc/modules/desktop_capture/desktop_capture/screen_capturer_fuchsia.o
> ../../buildtools/reclient/rewrapper -cfg=../../buildtools/reclient_cfgs/chromium-browser-clang/rewra...(too long)
> ../../third_party/webrtc/modules/desktop_capture/screen_capturer_fuchsia.cc:59:10: error: use of undeclared identifier 'capturer'
> 59 | return capturer(new ScreenCapturerFuchsia());
> | ^
> ../../third_party/webrtc/modules/desktop_capture/screen_capturer_fuchsia.cc:199:36: error: no type named 'InfoSyncPtr' in namespace 'fuchsia::ui::display::singleton'
>
> Original change's description:
> > [fuchsia] remove Scenic and GFX dependencies in DesktopCapturer
> >
> > We previously used:
> > - fuchsia.ui.scenic.Scenic/UsesFlatland to determine whether to use
> > Flatland; from now on it should always be the case, so this check is
> > no longer necessary.
> > - fuchsia.ui.scenic.Scenic/GetDisplayInfo to get
> > fuchsia.ui.gfx.DisplayInfo. This has been migrated to
> > fuchsia.ui.display.singleton.Info/GetMetrics and
> > fuchsia.ui.display.singleton.Metrics.
> >
> > Bug: fuchsia:100303
> > Change-Id: I147da9ffdf0ca49e1c5bde5d188e434fc660becc
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/311860
> > Reviewed-by: Emircan Uysaler <emircan@google.com>
> > Reviewed-by: Alexander Cooper <alcooper@chromium.org>
> > Commit-Queue: Caroline Liu <carolineliu@google.com>
> > Cr-Commit-Position: refs/heads/main@{#40432}
>
> Bug: fuchsia:100303, b/291393959
> Change-Id: Iae70e568a8c9819e40e48069af8cea0d4ef2b6c5
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/311801
> 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@{#40436}
Bug: fuchsia:100303, b/291393959
Change-Id: Icb7074ac86c1804ab2bdf809ea1496539ee2bf80
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/312000
Commit-Queue: Caroline Liu <carolineliu@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#40452}
This reverts commit fe5be2eb4f.
Reason for revert: This breaks the WebRTC roll into Chromium:
- https://chromium-review.googlesource.com/c/chromium/src/+/4688561
- https://ci.chromium.org/ui/p/chromium/builders/try/fuchsia-binary-size/399140/overview
Error:
[4273/4389] CXX obj/third_party/webrtc/modules/desktop_capture/desktop_capture/screen_capturer_fuchsia.o
FAILED: obj/third_party/webrtc/modules/desktop_capture/desktop_capture/screen_capturer_fuchsia.o
../../buildtools/reclient/rewrapper -cfg=../../buildtools/reclient_cfgs/chromium-browser-clang/rewra...(too long)
../../third_party/webrtc/modules/desktop_capture/screen_capturer_fuchsia.cc:59:10: error: use of undeclared identifier 'capturer'
59 | return capturer(new ScreenCapturerFuchsia());
| ^
../../third_party/webrtc/modules/desktop_capture/screen_capturer_fuchsia.cc:199:36: error: no type named 'InfoSyncPtr' in namespace 'fuchsia::ui::display::singleton'
Original change's description:
> [fuchsia] remove Scenic and GFX dependencies in DesktopCapturer
>
> We previously used:
> - fuchsia.ui.scenic.Scenic/UsesFlatland to determine whether to use
> Flatland; from now on it should always be the case, so this check is
> no longer necessary.
> - fuchsia.ui.scenic.Scenic/GetDisplayInfo to get
> fuchsia.ui.gfx.DisplayInfo. This has been migrated to
> fuchsia.ui.display.singleton.Info/GetMetrics and
> fuchsia.ui.display.singleton.Metrics.
>
> Bug: fuchsia:100303
> Change-Id: I147da9ffdf0ca49e1c5bde5d188e434fc660becc
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/311860
> Reviewed-by: Emircan Uysaler <emircan@google.com>
> Reviewed-by: Alexander Cooper <alcooper@chromium.org>
> Commit-Queue: Caroline Liu <carolineliu@google.com>
> Cr-Commit-Position: refs/heads/main@{#40432}
Bug: fuchsia:100303, b/291393959
Change-Id: Iae70e568a8c9819e40e48069af8cea0d4ef2b6c5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/311801
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@{#40436}
We previously used:
- fuchsia.ui.scenic.Scenic/UsesFlatland to determine whether to use
Flatland; from now on it should always be the case, so this check is
no longer necessary.
- fuchsia.ui.scenic.Scenic/GetDisplayInfo to get
fuchsia.ui.gfx.DisplayInfo. This has been migrated to
fuchsia.ui.display.singleton.Info/GetMetrics and
fuchsia.ui.display.singleton.Metrics.
Bug: fuchsia:100303
Change-Id: I147da9ffdf0ca49e1c5bde5d188e434fc660becc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/311860
Reviewed-by: Emircan Uysaler <emircan@google.com>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Caroline Liu <carolineliu@google.com>
Cr-Commit-Position: refs/heads/main@{#40432}
When PipeWire and xdg-desktop-portals are used, we can actually combine
both source types into one request. Make this part of the API for those
who want to use it this way, e.g. Firefox or Electron, otherwise they
will end up making two simultaneous requests, resulting into two dialogs
at the same time asking, while they can be combined into just one.
Bug: webrtc:15363
Change-Id: Ib6e1e47f66cb01d5c65096aec378b44c3af5f387
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/311549
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Jan Grulich <grulja@gmail.com>
Cr-Commit-Position: refs/heads/main@{#40425}
Recently added framerate option can cause a buffer overflow and make
PipeWire to fail on negotiation, which effectively makes screen sharing
not to work.
Bug: webrtc:15346
Change-Id: I4a68e26c8f85ca287b06a25da500b6a7009e075f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/311541
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Jan Grulich <grulja@gmail.com>
Cr-Commit-Position: refs/heads/main@{#40413}
This flag is no longer used in Chrome and can now be removed.
Bug: chromium:1314868
Change-Id: Id91b3352dc7ec0543d54894cc206a6e0c7667e9e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/309960
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#40337}
This CL allows the users to now enable/disable WGC capturing support
for Window and Screen sharing independently.
Bug: chromium:1314868
Change-Id: Ieeb15539434dac2caf29c515aa7c5dbb7abcc5df
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/309560
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40330}
This change fixes a minor issue where we previosuly assumed that the
following was true:
RTC_DCHECK_EQ(map_info.RowPitch, current_frame->stride())
It turns out that this is not always the case when sharing a window
where the stride can sometimes be a few bytes smaller than the
rowpitch.
The code is behind a command-line flag and no tests are affected.
Given limited review resources I therefore plan to bypass the CQ.
I know that it is not recommended but the change has been tested
locally on two different Windows platforms and it does avoid an
existing crash.
Code-Review: alcooper@chromium.org
No-Try: true
Bug: chromium:1421242
Change-Id: I01e7105a6f9fca7ce1349a57635dd373c28d160b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/309342
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40308}
This CL adds a light-weight detection of "frame content has changed
since last frame" to an existing pass where bytes are copied from a
texture to a DesktopFrame. The resulting boolean can then later be
used to bypass a full detection of if the content is static or not.
As a result, we only check for static content for a small fraction of
all captured WGC frames and this reduces the total load when 0Hz
is enabled for WGC.
Both WGC and 0Hz support for WGC is still behind a flag.
Bug: chromium:1421242
Change-Id: If9e3721c60a244a3919758fe861d56d4b54cb039
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/308821
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40299}
We use value -1 on over all the places through our code so it might be
better to define a constant and use it instead to make the code more
understandable on first look.
Bug: webrtc:15203
Change-Id: I4fc3e561bc7a7778c43ec6cfde7acebef2af79e8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/306620
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Jan Grulich <grulja@gmail.com>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40156}
This is a partial revert of the previously landed CL in
https://webrtc-review.googlesource.com/c/src/+/301200.
I noticed when I used `getDisplayMedia` on my private Windows laptop
in combination with WGC that the captured screen was distorted and
did only contain tilted (~35 degrees) lines in all sorts of colors.
The issue only happened for one particular screen resolution
3000 x 2000 and 200% scale. Changing to 100% scale instead resolved
the issue.
I tried many other resolutions but could only trigger for the one
above with 200% scaling.
Next, I bisected and found [1] which led to [2] which contains my own
change in https://webrtc-review.googlesource.com/c/src/+/301200.
The only part that could affect the video frame was the part which
did `CopyPixelsFrom` so I reverted that part and it solved the issue
on my private Windows laptop.
I did not dig deeper into why this particular resolution triggered
the distortion but deiced to revert to avoid more reports.
[1] b4c2a7fcf5..ff848b7a43
[2] a9a2957dbc
Bug: chromium:1428592
Change-Id: I328e77840cd3ca6871254cdf06500bdc616b0c36
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/306600
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#40147}
This reverts commit 8856410b6d.
Reason for revert: chromium:1447540
Original change's description:
> pipewire capturer: Reduce the amount of copying
>
> Improves the capture latency by reducing the amount of
> copying needed from the frame. We keep track of the
> damaged region of previous frame and union it with
> the damaged region of this frame and only copy this
> union of the frame over. X11 capturer already has
> such synchronization in place.
>
> The change is beneficial especially when there are
> small changes on the screen (e.g. clock ticking).
> For a 4k screen with 128 cores, I observed the
> capture latencies drop from 5 - 8 ms to 0 ms when the
> system is left idle. This is in line with the X11
> capturer.
>
> Bug: chromium:1291247
> Change-Id: Iffb441f9e1902d2658031f5f35b5372ee8e94073
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/299720
> Reviewed-by: Alexander Cooper <alcooper@chromium.org>
> Commit-Queue: Salman Malik <salmanmalik@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#39968}
Bug: chromium:1291247
Change-Id: Id1bfd3fc39fea2bb1f232cad5218f90e144920e7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/306263
Commit-Queue: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Auto-Submit: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#40123}
The fcntl() call has variable arguments, therefore we need to pass 0 to
specify there are no other arguments for this call, otherwise we might
end up with an argument that is random garbage.
Bug: webrtc:15174
Change-Id: I34f16a942d80913b667d8ade7eed557b0233be01
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/305120
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Jan Grulich <grulja@gmail.com>
Cr-Commit-Position: refs/heads/main@{#40060}
Improves the capture latency by reducing the amount of
copying needed from the frame. We keep track of the
damaged region of previous frame and union it with
the damaged region of this frame and only copy this
union of the frame over. X11 capturer already has
such synchronization in place.
The change is beneficial especially when there are
small changes on the screen (e.g. clock ticking).
For a 4k screen with 128 cores, I observed the
capture latencies drop from 5 - 8 ms to 0 ms when the
system is left idle. This is in line with the X11
capturer.
Bug: chromium:1291247
Change-Id: Iffb441f9e1902d2658031f5f35b5372ee8e94073
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/299720
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Salman Malik <salmanmalik@chromium.org>
Cr-Commit-Position: refs/heads/main@{#39968}
* Removes a ~60Hz thread-wakeup signal caused by the FrameArrived event
* Initial power measurements shows a reduced power consumption
* No increase in time to first captured packet found
Bug: chromium:1428592
Change-Id: Ia23b5db0c87e70e5b0d6919394494a24d8944493
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/301200
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39861}
This CL removes the usage of the Magnifier screen capture API on
Windows. The idea is to remove the actual source in a second step
once this change lands.
Bug: chromium:1428341
Change-Id: Id2cb25632c7edbea2cf527959b14b27ee00b0e56
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/301164
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#39856}
The idea is to land this in Canary and ask for feedback from users
who can reproduce the issue, solve the issue and then revert this CL.
Example: https://paste.googleplex.com/6080504230051840
Bug: chromium:1421656
Change-Id: Ic214dc341a322470970abeca1794493f45b93843
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/301080
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39834}
Bug: chromium:1431897
Change-Id: Ib871dc22d2cf93180d7aa05016e34ffec944d73e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/301040
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Auto-Submit: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#39830}
Before:
No attempt was made to figure out of the cursor was embedded into the
captured video frame when using DXGI on Windows as screen capturer.
Instead the cursor is superimposed on the frame by an external mouse
and cursor composer.
After:
We now check if the display adapter supports embedding the mouse
cursor and if so use it as is and thereby avoid adding it independently.
Bug: chromium:1421656
Change-Id: Ie07fe13e1c8f9583769961328bb41fbc689cd8e0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/299241
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39742}
This change makes it more clear that there are three different
capture API combinations for screen sharing on Windows.
No option => GDI without fallback.
DirectX option => DirectX with GDI as fallback
Magnifier option => Magnifier API with GDI as fallback
Previously, if both DirectX and Magnifier were enabled, the end
result was Magnifier for unknown reasons.
With this change in place, we can remove usage of the Magnifier API
in Chrome and switch between DirectX and GDI simply by allowing
DirectX or not.
Bug: None
Change-Id: Ice915d6721fa84a25d275f22246df73fc61f64b5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/299061
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#39692}
Drop support for old compositors that don't use DmaBufs the way they are
supposed to be used now. There is now a whole negotiation process that
includes DmaBuf modifiers and there is also support for renegotiation in
case we fail to import DmaBufs with certain modifier. This is something
that didn't exist before and in such case, failing to import DmaBufs we
would just end up with broken screen sharing. For that reason it would
be better to use MemFD instead to make sure old compositors will work
just fine
Bug: webrtc:15029
Change-Id: Icc303504e510adc829c12feff7178ae01578a6da
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/298700
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Jan Grulich <grulja@gmail.com>
Cr-Commit-Position: refs/heads/main@{#39649}
Logs if the mouse cursor has moved and if so if it is embedded in the
captured DXGI frame or not.
Bug: chromium:1421656
Change-Id: Ic8fa8a5a3c020ec28b04064c765b1c204accec1c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/298564
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#39644}
Originally DMABufs were imported into a temporary buffer followed by a
copy operation into the desktop frame itself. This is not needed as we
can import them directly into desktop frames and avoid this overhead.
Also drop support for MemPtr buffers as both Mutter and KWin don't seem
to support them and they are going to be too slow anyway.
Testing with latest Chromium, I could see two processes with usage around 20% and 40% without this change going down to 10% and 20% with
this change applied.
Bug: webrtc:13429
Bug: chrome:1378258
Change-Id: Ice3292528ff56300931c8638f8e03d4883d5e331
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/297501
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Jan Grulich <grulja@gmail.com>
Cr-Commit-Position: refs/heads/main@{#39594}
`CopyPixelsFrom` uses libyuv underneath and has handrolled
implementation for copying with AVX.
Bug: chromium:1424776
Change-Id: I4fafeba97fcc1d2200a10070837672175a1dfc50
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/297800
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Auto-Submit: Salman Malik <salmanmalik@chromium.org>
Cr-Commit-Position: refs/heads/main@{#39567}