In DxgiOutputDuplicator, we need to convert between a monitor based coordinate
and a entire screen based coordinate. i.e. Copying an updated area from a
monitor (an output in DirectX API) to the entire screen frame (DesktopFrame).
But DxgiOutputDuplicator always assumes the coordinate is based on screen frame.
So we only need to convert a rectange in updated_region to monitor based
coordinate when copying data from texture_. But in last_frame_, the data are
always based on screen coordinate.
So fixes are both required in line 167 and line 180. In the previous one, we do
not need to convert the DesktopRect, which is already screen based, into screen
based coordinate. In the late one, we do not need to convert the DesktopRect at
all. So after these two changes, DxgiOutputDuplicator::TargetRect() function can
be removed.
Flickers of DirectX capturer can happen on any devices, but a virtual machine
can easily reproduce it. While on a regular high performance machine, it's
harder, but not totally impossible, to reproduce the issue.
BUG=314516
Review-Url: https://codereview.webrtc.org/2495143002
Cr-Commit-Position: refs/heads/master@{#15075}
This is a trivial change to remove MockScreenCapturerCallback, and use
MockDesktopCapturerCallback to replace it.
BUG=webrtc:6513
Review-Url: https://codereview.webrtc.org/2494013003
Cr-Commit-Position: refs/heads/master@{#15047}
A tiny but critical change to avoid a crash failure in DirectX capturer.
A good news is this failure is caught by ScreenCapturer integration tests.
BUG=314516
Review-Url: https://codereview.webrtc.org/2494893002
Cr-Commit-Position: refs/heads/master@{#15046}
The old CroppingWindowCapturer::Create() function returns a raw pointer, which
cannot explain the ownership.
So this change adds a CreateCapturer() function to return a unique_ptr.
BUG=webrtc:6513
Review-Url: https://codereview.webrtc.org/2496993003
Cr-Commit-Position: refs/heads/master@{#15045}
This change removes ScreenCapturer and WindowCapturer from WebRTC.
BUG=webrtc:6513
Review-Url: https://codereview.webrtc.org/2490063002
Cr-Commit-Position: refs/heads/master@{#15033}
This change removes references of ScreenCapturer and WindowCapturer from WebRTC.
So after this change, ScreenCapturer and WindowCapturer classes can be entirely
removed.
BUG=webrtc:6513
Review-Url: https://codereview.webrtc.org/2489943004
Cr-Commit-Position: refs/heads/master@{#15006}
This is a trivial but dangerous change to remove X11/Xlib.h out of
shared_x_display.h. Since we do not have a strict and automatically
Include-What-You-Use rule, I cannot quite tell whether any Chromium source files
wrongly assume X11/Xlib.h will be included through shared_x_display.h. We can
fix the breaks in Chromium after this change has been failed to integrate to
Chromium.
BUG=webrtc:6513
Review-Url: https://codereview.webrtc.org/2482963003
Cr-Commit-Position: refs/heads/master@{#14987}
D3D_FEATURE_LEVEL_11_0 is not offically documented on MSDN to be a requirement
of DXGI duplicator APIs. So instead of using D3D_FEATURE_LEVEL_11_0 as a
requirement in D3dDevice::Initialize(), this change adds a
ScreenCapturerWinDirectx::SupportedFeatureLevel() function to retrieves minimum
and maximium for further reference (in HostTraits to control the experiment).
BUG=314516
Review-Url: https://codereview.webrtc.org/2468083002
Cr-Commit-Position: refs/heads/master@{#14962}
This change replaces all GetWindowList / GetScreenList with GetScreenList,
SelectWindow / SelectScreen with SelectSource, and BringSelectedWindowToFront
with FocusOnSelectedSource in WebRTC.
BUG=webrtc:6513
Review-Url: https://codereview.webrtc.org/2479553006
Cr-Commit-Position: refs/heads/master@{#14960}
This change copies ScreenCapturerDifferWrapper to a new
DesktopCapturerDifferWrapper, and adds DesktopCapturer::CreateWindowCapturer and
DesktopCapturer::CreateScreenCapturer functions to replace
WindowCapturer::Create and ScreenCapturer::Create.
BUG=webrtc:6513
Committed: https://crrev.com/b763e39beba92b45baa09542f949daabbe6258a3
Review-Url: https://codereview.webrtc.org/2468753002
Cr-Original-Commit-Position: refs/heads/master@{#14880}
Cr-Commit-Position: refs/heads/master@{#14903}
Reason for revert:
Prevents WebRTC rolls into Chrome.
https://build.chromium.org/p/chromium.linux/builders/Blimp%20Linux%20%28dbg%29/builds/14848/steps/compile/logs/stdio
The reason for reverting is: Breaks
https://build.chromium.org/p/chromium.linux/builders/Blimp%20Linux%20%28dbg%2...
[881/894] SOLINK ./libcontent.so
FAILED: libcontent.so libcontent.so.TOC
../../third_party/webrtc/modules/desktop_capture/desktop_capturer.cc:45: error:
undefined reference to
'webrtc::DesktopCapturer::CreateRawWindowCapturer(webrtc::DesktopCaptureOptions
const&)'
../../third_party/webrtc/modules/desktop_capture/desktop_capturer.cc:56: error:
undefined reference to
'webrtc::DesktopCapturer::CreateRawScreenCapturer(webrtc::DesktopCaptureOptions
const&)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Original issue's description:
> Add CreateWindowCapturer() and CreateScreenCapturer() in DesktopCapturer
>
> This change copies ScreenCapturerDifferWrapper to a new
> DesktopCapturerDifferWrapper, and adds DesktopCapturer::CreateWindowCapturer and
> DesktopCapturer::CreateScreenCapturer functions to replace
> WindowCapturer::Create and ScreenCapturer::Create.
>
> BUG=webrtc:6513
>
> Committed: https://crrev.com/b763e39beba92b45baa09542f949daabbe6258a3
> Cr-Commit-Position: refs/heads/master@{#14880}
TBR=sergeyu@chromium.org,zijiehe@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:6513
Review-Url: https://codereview.webrtc.org/2471773002
Cr-Commit-Position: refs/heads/master@{#14884}
This change copies ScreenCapturerDifferWrapper to a new
DesktopCapturerDifferWrapper, and adds DesktopCapturer::CreateWindowCapturer and
DesktopCapturer::CreateScreenCapturer functions to replace
WindowCapturer::Create and ScreenCapturer::Create.
BUG=webrtc:6513
Review-Url: https://codereview.webrtc.org/2468753002
Cr-Commit-Position: refs/heads/master@{#14880}
I have chosen part of 2435603010 changes to compose this change.
According to the discussion we have made in previous change, this CL contains,
1. Source structure to represent a source of a DesktopCapturer.
2. GetSourceList / SelectSource / FocusOnSelectedSource functions in
DesktopCapturer.
3. ScreenCapturer and WindowCapturer forward corresponding functions to the new
DesktopCapturer APIs.
After this change, We can remove WindowCapturer & ScreenCapturer references from
Chromium, and use the new APIs.
BUG=webrtc:6513
Committed: https://crrev.com/9cb0b3b4ac916cdf52d97a63d923dfbe73f0541e
Review-Url: https://codereview.webrtc.org/2452263003
Cr-Original-Commit-Position: refs/heads/master@{#14830}
Cr-Commit-Position: refs/heads/master@{#14832}
Reason for revert:
Build break in Chromium
Original issue's description:
> Add DesktopCapturer GetSourceList SelectSource FocusOnSelectedSource functions
>
> I have chosen part of 2435603010 changes to compose this change.
> According to the discussion we have made in previous change, this CL contains,
> 1. Source structure to represent a source of a DesktopCapturer.
> 2. GetSourceList / SelectSource / FocusOnSelectedSource functions in
> DesktopCapturer.
> 3. ScreenCapturer and WindowCapturer forward corresponding functions to the new
> DesktopCapturer APIs.
>
> After this change, We can remove WindowCapturer & ScreenCapturer references from
> Chromium, and use the new APIs.
>
> BUG=webrtc:6513
>
> Committed: https://crrev.com/9cb0b3b4ac916cdf52d97a63d923dfbe73f0541e
> Cr-Commit-Position: refs/heads/master@{#14830}
TBR=sergeyu@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:6513
Review-Url: https://codereview.webrtc.org/2464553002
Cr-Commit-Position: refs/heads/master@{#14831}
I have chosen part of 2435603010 changes to compose this change.
According to the discussion we have made in previous change, this CL contains,
1. Source structure to represent a source of a DesktopCapturer.
2. GetSourceList / SelectSource / FocusOnSelectedSource functions in
DesktopCapturer.
3. ScreenCapturer and WindowCapturer forward corresponding functions to the new
DesktopCapturer APIs.
After this change, We can remove WindowCapturer & ScreenCapturer references from
Chromium, and use the new APIs.
BUG=webrtc:6513
Review-Url: https://codereview.webrtc.org/2452263003
Cr-Commit-Position: refs/heads/master@{#14830}
This is a trivial change, I just cutted and pasted part of the code in
screen_capturer_unittest.cc to screen_capturer_integration_test.cc, removed
DISABLED_ prefixes, and updated build file.
BUG=webrtc:6366
Review-Url: https://codereview.webrtc.org/2444583002
Cr-Commit-Position: refs/heads/master@{#14806}
Enabled the plugin and cleaned up all issues it found, mainly virtual
destructors not being marked as override.
BUG=webrtc:163
Review-Url: https://codereview.webrtc.org/2436503004
Cr-Commit-Position: refs/heads/master@{#14793}
XGetImage() may return NULL and XServerPixelBuffer wasn't handling this
case properly.
BUG=649487
Review-Url: https://codereview.webrtc.org/2446733003
Cr-Commit-Position: refs/heads/master@{#14754}
Previously shared_desktop_frame.cc wasn't in primitives target, but it
is used in remoting client on android and the client should depend only
on primitives, but not desktop_capture overall.
BUG=653612
R=nicholss@chromium.org
Review URL: https://codereview.webrtc.org/2436913002 .
Cr-Commit-Position: refs/heads/master@{#14709}
The main reason for doing this is to allow refcounted objects to accept rvalue references in ctor and be able to std::move ctor rvalue arguments.
Also, refcounted.h is now generated using pump.py instead of manually creating each ctor version.
BUG= none
Review-Url: https://codereview.webrtc.org/2425683003
Cr-Commit-Position: refs/heads/master@{#14687}
ScreenCapturer tests may fail on trybot, so this change is to fix the issue.
Changes include,
1. Sometimes, a capturer may capture part of the change, i.e. usually the draw
actions are not atomic. So the updated_region may be inaccurate. So I have added
a MayDrawIncompleteShapes() function in ScreenDrawer. If it returns false, the
updated_region check will be ignored.
2. Several test cases may run concurrently, which makes one ScreenDrawer won't
really work. Its window may be covered by another ScreenDrawer. So I have added
a system wide lock to ensure only one ScreenDrawer is working at a certain time.
3. On unity (Linux), the top several pixels of a window may be covered by a
shadow effect if the window is not focused. So I have added a BringToFront()
function, and call it in WaitForPendingDraws().
4. On Windows, the drawn shapes are 'temporary drawing', which will be erased
once the window is covered by another one. So I repeat DrawRectangle() function
call in the test case.
TODO(zijiehe): The DISABLED_ prefixes will be added back after the code review.
And I will move these test cases into modules_test in a coming change.
BUG=647067
Review-Url: https://codereview.webrtc.org/2337073007
Cr-Commit-Position: refs/heads/master@{#14674}
To ensure this change won't break Chromium, this is the first change, to add a
new CaptureFrame() function, and let Capture(DesktopRegion) and CaptureFrame()
call each other. So both a legacy consumer or a legacy implementation won't be
broken.
BUG=https://bugs.chromium.org/p/webrtc/issues/detail?id=6513
Review-Url: https://codereview.webrtc.org/2409833002
Cr-Commit-Position: refs/heads/master@{#14635}
Make sure that the appropriate run loop source gets added/removed. More clean up
to remove unnecessary functions and suppress deprecated declaration warnings.
BUG=webrtc:6029
Review-Url: https://codereview.webrtc.org/2417603002
Cr-Commit-Position: refs/heads/master@{#14615}
CGRegisterScreenRefreshCallback (and similar) have been replaced by
CGDisplayStream.
Most of the structure is pretty comparable. The main difference is that a
CGDisplayStream needs to be destroyed asynchronously, potentially after
ScreenCapturerMac has been destroyed. This CL creates a self-owned
DisplayStreamManager which will destroy itself once all streams have been
destroyed.
BUG=webrtc:6029
Review-Url: https://codereview.webrtc.org/2391743004
Cr-Commit-Position: refs/heads/master@{#14590}
We can use ScreenCapturerDifferWrapper if needed, otherwise ScreenCapturer does
not need to calculate updated region itself, setting to entire screen is enough.
BUG=633802
Review-Url: https://codereview.webrtc.org/2348803003
Cr-Commit-Position: refs/heads/master@{#14377}
This changes most non-test related rtc_source_set targets to be
rtc_static_library instead. Targets without any .cc files are excluded.
This should bring back the build behavior we used to have with GYP
(i.e. same symbols exported in the libjingle_peerconnection.a file, which
are used by some downstream projects).
After doing an Android build with these changes:
$ nm --defined-only -g -C out/Release/lib.unstripped/libjingle_peerconnection_so.so | grep -i createpeerconnectionf
00077c51 T Java_org_webrtc_PeerConnectionFactory_nativeCreatePeerConnectionFactory
$ nm --defined-only -g -C out/Release/obj/webrtc/api/libjingle_peerconnection.a | grep -i createpeerconnectionf
00000001 T webrtc::CreatePeerConnectionFactory(rtc::Thread*, rtc::Thread*, rtc::Thread*, webrtc::AudioDeviceModule*, cricket::WebRtcVideoEncoderFactory*, cricket::WebRtcVideoDecoderFactory*)
00000001 T webrtc::CreatePeerConnectionFactory()
See https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/cookbook.md#Note-on-static-libraries
for more details on this.
NOTICE: This should be further cleaned up in the future, to reduce
binary bloat and unnecessary linking time. Right now it's more
important to restore the desired build output though.
BUG=webrtc:6410, chromium:630755
Review-Url: https://codereview.webrtc.org/2361623004
Cr-Commit-Position: refs/heads/master@{#14364}
1. Remove legacy screen-saver-blocking logic
2. tls_index_ is not a good choice, we can use thread-static
3. ScreenCapturerHelper is not designed for this scenario
4. Disable this capturer on 2+ monitors system
BUG=638802
Review-Url: https://codereview.webrtc.org/2319383002
Cr-Commit-Position: refs/heads/master@{#14342}
1. It looks like ComPtr cannot work well with vector::emplace_back, I got a
consistent crash on one of my machine, but not the other. Move constructor
should have no impact to lvalue reference, but I may be wrong here. The
impact here is ComPtr released before it should be. So a simple solution is to
use copy instead of reference. The D3dDevice is a collection of reference
counted pointers (Microsoft::WRL::ComPtr), there is almost no extra cost.
2. Actively set several fields in D3D11_TEXTURE2D_DESC to avoid potential break
if there are some platform changes later.
3. AcquireNextFrame returns both a DXGI_OUTDUPL_FRAME_INFO with
AccumulatedFrames and an IDXGIResource. But there is no comment in MSDN to
ensure IDXGIResource won't be nullptr if AccumulatedFrames > 0. Adding an extra
check in DxgiOutputDuplicator makes it a safer.
BUG=314516
Review-Url: https://codereview.webrtc.org/2345163002
Cr-Commit-Position: refs/heads/master@{#14341}
On retina display, when we do screen capture, the mouse cursor
looks too small. The reason is that we painted the cursor with
low resolution on to the frame directly.
This CL fixes the bug.
BUG=632995
Review-Url: https://codereview.webrtc.org/2350743003
Cr-Commit-Position: refs/heads/master@{#14340}
This change uses RgbaColor in DesktopFrameGenerator instead of raw uint32_t to
avoid potential endian issues.
BUG=633802
Review-Url: https://codereview.webrtc.org/2334853002
Cr-Commit-Position: refs/heads/master@{#14337}
This change is to add an DesktopCapturerOptions accurate_updated_region() with
default value as false to indicate whether a pixel-wise differentiation is
required. And ScreenCapturer::Create() function will wrap the implementation
with ScreenCapturerDifferWrapper.
Chromoting will use this option to filter out unchanged frames.
BUG=314516
Review-Url: https://codereview.webrtc.org/2314323002
Cr-Commit-Position: refs/heads/master@{#14248}
ScreenCapturerTest.CaptureUpdatedRegion* tests are flaky and are running in the
wrong executable.
BUG=webrtc:6366, chromium:647067
NOTRY=True
Review-Url: https://codereview.webrtc.org/2342823002
Cr-Commit-Position: refs/heads/master@{#14232}
This change is to add more test cases for ScreenCapturer implementation.
BUG=
Review-Url: https://codereview.webrtc.org/2320763003
Cr-Commit-Position: refs/heads/master@{#14218}
Reason for revert:
Chromium build issues have been resolved.
Original issue's description:
> Revert of Remove all reference to carbon api (patchset #2 id:20001 of https://codereview.webrtc.org/2299633002/ )
>
> Reason for revert:
> Breaks chromium build
>
> Original issue's description:
> > Remove all reference to carbon api
> >
> > BUG=webrtc:6282
> >
> > Committed: https://crrev.com/dbd8b6bec4143c940b2f2ca8cd85c25d17327964
> > Cr-Commit-Position: refs/heads/master@{#14080}
>
> TBR=magjed@webrtc.org,mflodman@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:6282
>
> Committed: https://crrev.com/b096aa7fd375a980daab3a986596548ca5de2a1c
> Cr-Commit-Position: refs/heads/master@{#14081}
TBR=magjed@webrtc.org,mflodman@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:6282
Review-Url: https://codereview.webrtc.org/2321493002
Cr-Commit-Position: refs/heads/master@{#14125}
Reason for revert:
Resubmit capturer tests
Original issue's description:
> Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
>
> 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
>
> Committed: https://crrev.com/4c44202dc348613695a4b529bbd7c9bdab6195ec
> Cr-Commit-Position: refs/heads/master@{#14071}
TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,asapersson@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644130
Review-Url: https://codereview.webrtc.org/2313653003
Cr-Commit-Position: refs/heads/master@{#14113}
Reason for revert:
Breaks chromium build
Original issue's description:
> Remove all reference to carbon api
>
> BUG=webrtc:6282
>
> Committed: https://crrev.com/dbd8b6bec4143c940b2f2ca8cd85c25d17327964
> Cr-Commit-Position: refs/heads/master@{#14080}
TBR=magjed@webrtc.org,mflodman@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:6282
Review-Url: https://codereview.webrtc.org/2316563002
Cr-Commit-Position: refs/heads/master@{#14081}