Commit graph

17 commits

Author SHA1 Message Date
Harald Alvestrand
23cecc1d43 Move scoped_refptr from rtc:: to webrtc::
leaving a compatible alias.

Bug: webrtc:15622
Change-Id: Ie25d87fa372cc71eaf52882454f4dd24c7c33789
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/325462
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41072}
2023-11-03 07:36:07 +00:00
Joe Downing
60795e8c7a Re-initialize the DXGI capturer when the DPI of the monitor changes
I am updating Chrome Remote Desktop to apply a scale factor when using
curtain mode (i.e. a loopback RDP session) and I've found that while
the changes are applied and the desktop is scaled, DXGI stops
producing frames.

This is essentially the same issue as crbug.com/1307357 except this
issue is occurring when the DPI is changed rather than the desktop
size.

The fix is to look at the effective DPI for the source being
captured (or the primary monitor when capturing the full desktop)
and then signaling an environment change when the DPI differs.

Bug: webrtc:14894,b:154733991
Change-Id: Id768d4a384434ba59e7396bc919d0ba30d0f6acc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/292791
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Joe Downing <joedow@google.com>
Cr-Commit-Position: refs/heads/main@{#39305}
2023-02-13 18:26:29 +00:00
henrika
b0e1cb254e Adds WebRTC.DesktopCapture.Win.DirectXCapturerResult UMA
This records high level errors, or success, encountered across the entire capture flow in the DXGI based capturer.

Using the same style as for WebRTC.DesktopCapture.Win.WgcCapturerResult

Bug: chromium:1400204
Change-Id: I7096d1790d7c2a23bbe29761b7dbf40426ce1e6a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291707
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39259}
2023-02-04 12:26:02 +00:00
Alex Cooper
56b836d958 Ensure there is a unique FrameQueue for each DxgiOutputDuplicator
DxgiOutputDuplicator objects hold a reference to the last frame that
they succesfully captured by maintaining a reference to the
SharedDesktopFrame that was passed as their target. This is done because
the DirectX capture APIs may fail to provide an update if there has been
no (or no substantial) change since the last capture call was made.
However, the higher levels of this capture stack
(DxgiDuplicatorController and ScreenCapturerWinDirectX), were unaware of
this, and assumed that the caller of CaptureFrame is the only one who
may have held a reference to the frame. Thus, when CaptureFrame is
called, the DirectX screen capturer assumes that the oldest frame in its
queue can be safely reused.

In the steady state, where capture is not being switched between
monitors, this is fine as there are no competing DxgiOutputDuplicators
being run and this assumption mostly holds true (or the frame is being
overwritten only when the DxgiOutputDuplicator is also done holding it).
However, when capture is being rapidly switched between multiple targets
(e.g. to show a preview of each of the available monitors), this can
result in a frame being held by one DxgiOutputDuplicator being passed to
another as a valid target and overwritten. In the common case of only a
single monitor this is essentially the same as steady state capture,
where there are no competing DxgiOutputDuplicator. In the other common
case of two monitors being captured, the fact that the
ScreenCaptureFrameQueue has two frames ends up masking this issue. Since
each monitor is captured in the same order, the same frame ends up
getting passed to each DxgiOutputDuplicator, so no data actually ends
up getting overwritten. In the case of 3 monitors, the 1st and 3rd
monitor end up sharing a frame, which when capture fails on one of them
surfaces as the other monitor being duplicately shown.

This change addresses the issue by ensuring that each screen that the
ScreenCapturerWinDirectX *actually attempts* to capture, gets it's own
FrameQueue, and thus essentially brings us back to the "steady state"
case for each monitor. Note that this does increase memory usage of
capturers that are switched between multiple targets by 2 frames/target
used (and actually attempted to be captured).

Alternatives considered:
DxgiOutputDuplicator makes a copy of the frame, rather than holding
a reference
  This was rejected because adding an additional copy for every
  capture upon getting a new frame, would expensive and could degrade
  performance.

Allow the DxgiOutputDuplicators to "fail" when there has been no update
  This would result in either a breaking change to the API for consumers
  or would require the ScreenCapturerWinDirectX to track these last
  captured frames; which would result in essentially the same approach,
  but with less abstraction for re-using the frames.

Bug: chromium:1296228
Change-Id: I5442ec40e9f234046010b562b258db63693ccc6b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256043
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#36295}
2022-03-22 16:53:53 +00:00
Romain Pokrzywka
66528d7e90 Export DxgiDuplicatorController when building as shared lib
This class is accessed by Electron for its desktop capture support,
but it breaks with component builds on Windows because the symbols
aren't exported by the dll.
No behavior change at runtime, only modifies the generated .lib
when building as a shared library (static builds are unchanged).

Bug: None
Change-Id: I5dc606846de990c1bf4d375ddbb1c73dfc512762
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/230200
Reviewed-by: Joe Downing <joedow@chromium.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Commit-Queue: Jamie Walch <jamiewalch@chromium.org>
Cr-Commit-Position: refs/heads/main@{#34858}
2021-08-26 17:34:45 +00:00
Artem Titov
cec4343fb4 Use backticks not vertical bars to denote variables in comments for /modules/desktop_capture
Bug: webrtc:12338
Change-Id: I300ba78fc4423db7030e555d7e51d2cb2246e9a4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227162
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34678}
2021-08-09 13:12:52 +00:00
Niels Möller
563fbc1dc5 Replace RecursiveCriticalSection with Mutex in DxgiDuplicatorController
Bug: webrtc:11567
Change-Id: I6d59de7ca60b69765118787fff023c485b1f405e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/207160
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33264}
2021-02-15 14:40:57 +00:00
Niels Möller
590b1bad08 Add lock annotations to DxgiDuplicatorController
Bug: webrtc:11567
Change-Id: I34b9138cc15cd534059dd64bb990d41174eeef21
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206471
Reviewed-by: Markus Handell <handellm@webrtc.org>
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33242}
2021-02-12 07:51:19 +00:00
Markus Handell
3cb525b378 Rename CriticalSection to RecursiveCriticalSection.
This name change communicates that the recursive critical section
should not be used for new code.
The relevant files are renamed rtc_base/critical_section* ->
rtc_base/deprecated/recursive_critical_section*

Bug: webrtc:11567
Change-Id: I73483a1c5e59c389407a981efbfc2cfe76ccdb43
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179483
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31754}
2020-07-17 09:19:50 +00:00
Markus Handell
1added5666 Revert "Migrate modules/desktop_capture and modules/video_capture to webrtc::Mutex."
This reverts commit 44dd3d7435.

Reason for revert: crbug.com/1104081

Original change's description:
> Migrate modules/desktop_capture and modules/video_capture to webrtc::Mutex.
> 
> Bug: webrtc:11567
> Change-Id: I7bfca17f91bf44151148f863480ce77804d53a04
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178805
> Commit-Queue: Markus Handell <handellm@webrtc.org>
> Reviewed-by: Tommi <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31681}

TBR=tommi@webrtc.org,handellm@webrtc.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: webrtc:11567
Change-Id: I4ee39947ba206522bce611341caef84ddb538068
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179080
Reviewed-by: Markus Handell <handellm@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31702}
2020-07-10 13:43:22 +00:00
Markus Handell
44dd3d7435 Migrate modules/desktop_capture and modules/video_capture to webrtc::Mutex.
Bug: webrtc:11567
Change-Id: I7bfca17f91bf44151148f863480ce77804d53a04
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178805
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31681}
2020-07-08 20:35:04 +00:00
Noah Richards
40244407e3 Lowercase windows includes in desktop_capture/.
Allows building on case-sensitive file systems.

BUG=None

Change-Id: I0ecd494a5ed6e6dc2658d3918f88fa8692a471cf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138180
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@{#28031}
2019-05-23 06:36:19 +00:00
Mirko Bonadei
d970807e0c Remove rtc_base/scoped_ref_ptr.h.
The type rtc::scoped_refptr<T> is now part of api/. Please include it from
api/scoped_refptr.h.

More info: See: https://groups.google.com/forum/#!topic/discuss-webrtc/Mme2MSz4z4o.

Bug: webrtc:9887, webrtc:8205
No-Try: True
Change-Id: Ic6c7c81e226e59f12f7933e472f573ae097b55bf
Reviewed-on: https://webrtc-review.googlesource.com/c/119041
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26414}
2019-01-25 20:29:58 +00:00
Steve Anton
10542f21c8 (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries
Mechanically generated by running this command:

tools_webrtc/do-renames.sh update all-renames.txt && git cl format

Then manually updating:

tools_webrtc/sanitizers/tsan_suppressions_webrtc.cc

Bug: webrtc:10159
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I54824cd91dada8fc3ee3d098f971bc319d477833
Reviewed-on: https://webrtc-review.googlesource.com/c/115653
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26226}
2019-01-11 17:11:39 +00:00
Zijie He
8f1b93c104 Add more logs in DX capturer
This is a trivial change to add more logs in DX capturer components for
debugging purpose.

Bug: chromium:764258
Change-Id: I406127d838a522f0226720434e840c7163b4719d
Reviewed-on: https://webrtc-review.googlesource.com/3541
Commit-Queue: Zijie He <zijiehe@chromium.org>
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#19960}
2017-09-26 02:02:42 +00:00
Mirko Bonadei
92ea95e34a Fixing WebRTC after moving from src/webrtc to src/
In https://webrtc-review.googlesource.com/c/src/+/1560 we moved WebRTC
from src/webrtc to src/ (in order to preserve an healthy git history).
This CL takes care of fixing header guards, #include paths, etc...

NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org


Bug: chromium:611808
Change-Id: Iea91618212bee0af16aa3f05071eab8f93706578
Reviewed-on: https://webrtc-review.googlesource.com/1561
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19846}
2017-09-15 05:02:56 +00:00
Mirko Bonadei
bb547203bf Moving src/webrtc into src/.
In order to eliminate the WebRTC Subtree mirror in Chromium, 
WebRTC is moving the content of the src/webrtc directory up
to the src/ directory.

NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org

Bug: chromium:611808
Change-Id: Iac59c5b51b950f174119565bac87955a7994bc38
Reviewed-on: https://webrtc-review.googlesource.com/1560
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19845}
2017-09-15 04:25:06 +00:00
Renamed from webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.h (Browse further)