DirectX capturer won't be able to update the DesktopFrame for the second
ScreenCapturerWinDirectx instance, if AcquireNextFrame() returns timeout or
unchanged error. Current solution uses |last_frame| of the second
ScreenCapturerWinDirectx instance, which also does not contain the updated frame
between this and last AcquireNextFrame() calls. Considering following situation,
(C1: capturer 1, C2: capturer 2, update: screen updated, next AcquireNextFrame()
call will return a new frame, Fx: a frame x)
update -> C2.capture returns F1 -> update -> C1.capture returns F2 ->
C2.capture unchanged
So using F1 to update the last capture frame is not correct, we need to use F2.
Refer to design doc https://goo.gl/hU1ifG for a detail description.
The change also makes DxgiDuplicatorController work with 2+ DesktopFrame queue.
Now TwoDirectxCapturers test can pass.
BUG=314516
Review-Url: https://codereview.webrtc.org/2299663003
Cr-Commit-Position: refs/heads/master@{#14077}
dirty region than the real screen change. A similar behavior may happen on other
platforms with damage notification support. So it's better to have an individual
layer to handle the Differ logic, and remove capturing independent logic out of
each ScreenCapturer* implementation.
So this change does following things,
1. Update differ_block to handle variable height. differ_block_sse2 has been
renamed to differ_vector_sse2.
2. A new ScreenCapturerDifferWrapper implementation to help set
DesktopFrame::updated_region(). It uses an underlying ScreenCapturer to do
the real capture work, and updates the updated region of DesktopFrame returned
from OnCaptureResult function.
3. FakeDesktopCapturer and FakeScreenCapturer to generate controllable
DesktopFrame by using DesktopFrameGenerator and DesktopFramePainter.
4. Test ScreenCapturerDifferWrapper by using FakeScreenCapturer.
After this change, we can eventually remove all Differ logic from
ScreenCapturer* implementations, and fix a potential crash bug in
ScreenCapturerLinux class. It wrongly assumes previous_frame() has a same size
as current_frame(). https://goo.gl/3nSqOC
BUG=633802
TBR=kjellander@webrtc.org
Review-Url: https://codereview.webrtc.org/2202443002
Cr-Commit-Position: refs/heads/master@{#14076}
Reason for revert:
ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.
Original issue's description:
> [WebRTC] A real ScreenCapturer test
>
> We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> ScreenDrawer interface is added to the code base to draw various shapes on the
> screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> cases, some other changes are included,
>
> 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> milliseconds on X11 and 100 milliseconds on Windows.
>
> 2. A Color structure to help handle a big-endian or little-endian safe color and
> provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> and compare with or paint to a DesktopFrame.
>
> 3. ScreenDrawer now uses Color structure instead of uint32_t.
>
> BUG=314516
>
> TBR=kjellander@chromium.org
>
> Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> Cr-Commit-Position: refs/heads/master@{#14058}
TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=314516
Review-Url: https://codereview.webrtc.org/2310953002
Cr-Commit-Position: refs/heads/master@{#14071}
Remove common_inherited_config from the targets and add it to the
template instead.
BUG=webrtc:6187
NOTRY=True
Review-Url: https://codereview.webrtc.org/2311843002
Cr-Commit-Position: refs/heads/master@{#14069}
Remove common_config from the targets' config and add
it to the template instead.
BUG=webrtc:6187
NOTRY=True
Review-Url: https://codereview.webrtc.org/2300413002
Cr-Commit-Position: refs/heads/master@{#14063}
We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
ScreenDrawer interface is added to the code base to draw various shapes on the
screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
cases, some other changes are included,
1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
ScreenDrawer to finish all the pending draws. This function now only sleeps 50
milliseconds on X11 and 100 milliseconds on Windows.
2. A Color structure to help handle a big-endian or little-endian safe color and
provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
DesktopFrameGenerator (in change 2202443002) can use this class to create colors
and compare with or paint to a DesktopFrame.
3. ScreenDrawer now uses Color structure instead of uint32_t.
BUG=314516
TBR=kjellander@chromium.org
Review-Url: https://codereview.webrtc.org/2268093002
Cr-Commit-Position: refs/heads/master@{#14058}
Defines the rtc_executable, rtc_source_set, rtc_test and
rtc_static_library templates.
These templates provide no functionality yet, but will enable common
configuration to be introduced, avoiding repetition in every target
Changes summary:
- Prepend rtc_ to test, source_set, executable and static_library targets
- Change "configs -= [" to "suppressed_configs += ["
- Include webrtc/build/webrtc.gni where it wasn't included yet
- Delete import("//testing/test.gni"), since rtc_test makes it unnecessary.
BUG=webrtc:6187
TBR=henrik.lundin@webrtc.org,tommi@webrtc.org
NOTRY=True
Review-Url: https://codereview.webrtc.org/2301053002
Cr-Commit-Position: refs/heads/master@{#14043}
Fix some out-of-sync differences between GYP and GN targets for
desktop capture.
Remove sources that aren't used on iOS for that platform, to solve
linking errors that surfaced when flipping iOS to GN by default.
BUG=webrtc:5949
NOTRY=True
TBR=sergeyu@chromium.org
Review-Url: https://codereview.webrtc.org/2289103002
Cr-Commit-Position: refs/heads/master@{#13971}
implementation can accurately capture updated regions. Especially in
ScreenCapturerWinDirectx, which has a specific updated region spreading logic
and cannot be tested through regular code path. So we need a controllable
ScreenDrawer to draw some basic shapes on the screen. And a platform independent
test case can use the ScreenDrawer to test a ScreenCapturer.
So this change addes a ScreenDrawer virtual class, and its Windows
implementation ScreenDrawerWin. A disabled gtest ScreenDrawerTest.DrawRectangles
is also added to manually test whether ScreenDrawer can work on a certain
platform.
BUG=314516
TBR=kjellander@webrtc.org
Review-Url: https://codereview.webrtc.org/2210443002
Cr-Commit-Position: refs/heads/master@{#13788}
It was disabled for some reason, even though in GYP it's enabled.
BUG=626067
NOTRY=True
Review-Url: https://codereview.webrtc.org/2247293002
Cr-Commit-Position: refs/heads/master@{#13780}
A recent DrMemory failure has been detected after change 2099123002. After some
investigation, an uninitialized read has been detected in
NtUserGetThreadDesktop
webrtc::Desktop::GetThreadDesktop
webrtc::ScopedThreadDesktop::ScopedThreadDesktop
webrtc::ScreenCapturerWinGdi::ScreenCapturerWinGdi
webrtc::ScreenCapturer::Create
webrtc::ScreenCapturerTest_UseDirectxCapturer_Test::TestBody
So there are two issues,
1. The Directx capturer won't be triggered as the system does not support it. So
these tests should be disabled in this scenario.
2. An uninitialized read in NtUserGetThreadDesktop -> ScopedThreadDesktop
stacks, which should be suppressed. By default, these suppressions should be
placed in chromium/external with other suppressions.
So this change is a quick fix to the failure, do not use ScreenCapturerWinGdi in
ScreenCaputrerWinDirectx tests.
BUG=
Review-Url: https://codereview.webrtc.org/2247943002
Cr-Commit-Position: refs/heads/master@{#13766}
Current DirectX capturer cannot capture multiple video cards or monitors. But
according to DXGI desktop duplication sample (https://goo.gl/An0L9l), we can
capture multiple video cards and monitors by duplicating them one by one. So
instead of one IDXGIOutputDuplication instance, this change creates an
IDXGIOutputDuplication instance for each monitor, and merge the output into
one DesktopFrame.
Several other changes are also included,
1. Add supports to DXGI_OUTDUPL_DESC.DesktopImageInSystemMemory. When this flag
is true, we won't copy its content to staging buffer.
2. Capture one monitor instead of entire screen.
Above changes make the logic complex. But with some refactor work, the logic is
not disordered. Please refer to the doc @ https://goo.gl/hU1ifG.
BUG=314516
Review-Url: https://codereview.webrtc.org/2099123002
Cr-Commit-Position: refs/heads/master@{#13684}
When Windows is switching display mode, DirectX based capturer may not be able
to create a new IDXGIOutputDuplication instance, which is expected. So it should
return a temporary error instead of a permanent error.
BUG=
Review-Url: https://codereview.webrtc.org/2092543003
Cr-Commit-Position: refs/heads/master@{#13279}
The method was deprecated and shouldn't be used anywhere now.
BUG=webrtc:5950
Review-Url: https://codereview.webrtc.org/2080573004
Cr-Commit-Position: refs/heads/master@{#13248}
Changes:
* Enabled protobuf for iOS globally.
* Set WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE on a global
scope similar to GYP since tests depend on it.
* Added missing rtc_libvpx_build_vp9 variable.
* Moved out audio_coding defines into .gni file to avoid code duplication
* Renamed files to avoid object naming conflicts that GN disallows:
* webrtc/modules/audio_processing/{echo_cancellation_unittest.cc->echo_cancellation_bit_exact_unittest.cc}
* webrtc/modules/video_coding/codecs/vp9/{screenshare_layers_unittest.cc->vp9_screenshare_layers_unittest.cc}
BUG=webrtc:5949
TESTED=Built and ran the tests on Mac. Also ran:
gn gen out/Default --args="rtc_enable_bwe_test_logging=true"
and verified that more objects are being built (1885 vs 1883)
when compiling modules_unittests.
NOTRY=True
NOPRESUBMIT=True
Review-Url: https://codereview.webrtc.org/2041233006
Cr-Commit-Position: refs/heads/master@{#13108}
Previously RefCountedObject was passing all parameters by value.
This meant that it was hard to use it with movable types, such
as unique_ptr<>. Now there is a constructor that takes r-value,
which means that RefCountedObject<std::unique_ptr<foo>> can be
initialized by passing std::unique_ptr<foo> to the constructor.
Review-Url: https://codereview.webrtc.org/2036123002
Cr-Commit-Position: refs/heads/master@{#13079}
Previously raw pointers were used for owned DesktopFrame instances.
Updated all screen and window capturer implementations to use
std::unique_ptr<>.
Also includes some other cleanups in the capturers:
- s/NULL/nullptr
- moved default initializers to class definition.
BUG=webrtc:5950
Review-Url: https://codereview.webrtc.org/1988783003
Cr-Commit-Position: refs/heads/master@{#13058}
Reason for revert:
Broke chromium builder
Original issue's description:
> Use std::unique_ptr<> to pass frame ownership in DesktopCapturer impls.
>
> Previously raw pointers were used for owned DesktopFrame instances.
> Updated all screen and window capturer implementations to use
> std::unique_ptr<>.
>
> Also includes some other cleanups in the capturers:
> - s/NULL/nullptr
> - moved default initializers to class definition.
>
> BUG=webrtc:5950
>
> Committed: https://crrev.com/4a627a8c13554d12412cabb8f751caee6e61ee32
> Cr-Commit-Position: refs/heads/master@{#13032}
TBR=wez@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5950
Review-Url: https://codereview.webrtc.org/2030333003
Cr-Commit-Position: refs/heads/master@{#13033}
Previously raw pointers were used for owned DesktopFrame instances.
Updated all screen and window capturer implementations to use
std::unique_ptr<>.
Also includes some other cleanups in the capturers:
- s/NULL/nullptr
- moved default initializers to class definition.
BUG=webrtc:5950
Review-Url: https://codereview.webrtc.org/1988783003
Cr-Commit-Position: refs/heads/master@{#13032}
Reason for revert:
Breaks user code. Said code needs to stop using scoped_ptr!
Original issue's description:
> Remove webrtc/base/scoped_ptr.h
>
> BUG=webrtc:5520
>
> NOTRY=True
>
> Committed: https://crrev.com/65fc62e9dd8a8716db625aaef76ab92f542ecc5a
> Cr-Commit-Position: refs/heads/master@{#12684}
TBR=tommi@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5520
Review-Url: https://codereview.webrtc.org/1965063003
Cr-Commit-Position: refs/heads/master@{#12686}
They're just no-ops now, and will soon go away.
BUG=webrtc:5520
Review URL: https://codereview.webrtc.org/1914153002
Cr-Commit-Position: refs/heads/master@{#12510}
Any file that uses the RTC_DISALLOW_* macros should #include
"webrtc/base/constructormagic.h", but a shocking number of them don't.
This causes trouble when we try to wean files off of #including
scoped_ptr.h, since a bunch of files get their constructormagic macros
only from there.
Rather than fixing these errors one by one as they turn up, this CL
simply ensures that every file in the WebRTC tree that uses the
RTC_DISALLOW_* macros #includes "webrtc/base/constructormagic.h".
BUG=webrtc:5520
Review URL: https://codereview.webrtc.org/1917043005
Cr-Commit-Position: refs/heads/master@{#12509}
They can all benefit from moving, since they contain std::string and
std::vector. We intended to add these in
https://codereview.webrtc.org/1896953004/, but got compiler errors we
couldn't make sense of, so we skipped them. It turns out that what the
compiler was complaining about was that when we said we'd have a
user-defined move constructor, it stopped generating a copy assignment
operator for us. This CL solves the problem by outfitting the types
with defaulted copy and move assignment operators too.
Review URL: https://codereview.webrtc.org/1899173002
Cr-Commit-Position: refs/heads/master@{#12469}
Removed deprecated files, types and methods in modules/webrtc that were
kept there to avoid breaking chromium, and which are no longer needed.
BUG=172183
Review URL: https://codereview.webrtc.org/1909593002
Cr-Commit-Position: refs/heads/master@{#12457}
Reason for revert:
This is preventing a WebRTC roll into Chromium. See https://codereview.chromium.org/1877263003/
Original issue's description:
> Fix screen capturers to initialize on the same thread on which Start() is called.
>
> Previously screen capturers were initialized when they are created.
> This means that in the CRD host they were initialized on the thread
> that's different from the thread on which they are used. Because of this
> on Linux the host was using XErrorTrap() on two different threads and
> this is not supported. Now ScreenCapturer implementations always
> initialize themselves on the thread on which Start() is called.
>
> Also added ThreadChecker to make sure the capturers are always called
> from the same thread.
>
> BUG=600432
>
> Committed: https://crrev.com/e8d4b7d8a3d298438a2ebd9ee8d5aa71f42cf033
> Cr-Commit-Position: refs/heads/master@{#12285}
TBR=jamiewalch@chromium.org,sergeyu@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=600432
Review URL: https://codereview.webrtc.org/1882083002
Cr-Commit-Position: refs/heads/master@{#12334}
Previously screen capturers were initialized when they are created.
This means that in the CRD host they were initialized on the thread
that's different from the thread on which they are used. Because of this
on Linux the host was using XErrorTrap() on two different threads and
this is not supported. Now ScreenCapturer implementations always
initialize themselves on the thread on which Start() is called.
Also added ThreadChecker to make sure the capturers are always called
from the same thread.
BUG=600432
Review URL: https://codereview.webrtc.org/1861893002
Cr-Commit-Position: refs/heads/master@{#12285}
ScreenCapturerMac wasn't handling the following two cases properly
which could cause crashes:
1. CGDisplayCreateImage() returns image with depth other than 32-bit
2. CGDisplayCreateImage() returns image with dimensions different
from expected (e.g. when screen resolution is being changed).
I suspect that (2) was causing the linked bug.
BUG=crbug.com/504927
R=jiayl@webrtc.org
Review URL: https://codereview.webrtc.org/1816723002 .
Cr-Commit-Position: refs/heads/master@{#12077}
Removes code duplication and use of the dangerous public destructor in
RefCountImpl.
Also making wider use of scoped_refptr and fixing various leaks in the
process.
BUG=webrtc:5229
R=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1477013005 .
Cr-Commit-Position: refs/heads/master@{#12075}
Reason for revert:
The openmax_dl include change breaks downstream projects.
Original issue's description:
> Add check_deps rules in DEPS files.
>
> Add fine-grained check_deps rules for all of WebRTC.
> This will help both maintaining sane dependencies and provides a way
> to visualize dependency graphs using the buildtools/checkdeps/graphdeps.py script.
>
> Example:
> buildtools/checkdeps/graphdeps.py --root=. --format=png \
> --out=./webrtc.png --incl='^webrtc/modules/bitrate_controller->' \
> --excl='chromium|base|external|testing|webrtc/test|\.h$|\.cc$'
>
> will produce a neat webrtc.png image showcasing the dependencies
> (according to the DEPS file) for the bitrate_controller module.
> Some dependencies are filtered out for readability.
>
> BUG=webrtc:5623
> TESTED=Passing runs using:
> buildtools/checkdeps/checkdeps.py --root=. talk
> buildtools/checkdeps/checkdeps.py --root=. webrtc
>
> R=tommi@webrtc.org
>
> Committed: https://crrev.com/086f851b7b9b4bcbd4fe507c3bf83b760bd7f4d9
> Cr-Commit-Position: refs/heads/master@{#12008}
TBR=tommi@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5623
Review URL: https://codereview.webrtc.org/1808573002
Cr-Commit-Position: refs/heads/master@{#12009}
Add fine-grained check_deps rules for all of WebRTC.
This will help both maintaining sane dependencies and provides a way
to visualize dependency graphs using the buildtools/checkdeps/graphdeps.py script.
Example:
buildtools/checkdeps/graphdeps.py --root=. --format=png \
--out=./webrtc.png --incl='^webrtc/modules/bitrate_controller->' \
--excl='chromium|base|external|testing|webrtc/test|\.h$|\.cc$'
will produce a neat webrtc.png image showcasing the dependencies
(according to the DEPS file) for the bitrate_controller module.
Some dependencies are filtered out for readability.
BUG=webrtc:5623
TESTED=Passing runs using:
buildtools/checkdeps/checkdeps.py --root=. talk
buildtools/checkdeps/checkdeps.py --root=. webrtc
R=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1796413002 .
Cr-Commit-Position: refs/heads/master@{#12008}