ScreenCapturerWinGdi randomly returns black frames in test environment. The root
cause is still unknown, so change ScreenCapturerWinGdi tests into MANUAL mode to
execute in test environment, but unblock other developers. We can eventually get
a failure ratio and more samples for debugging.
BUG=webrtc:6666, webrtc:6843
Review-Url: https://codereview.webrtc.org/2564173002
Cr-Commit-Position: refs/heads/master@{#15518}
GDI capturer may randomly return a blank frame. So this change enables tests for
Linux / DirectX capturer / magnifier capturer.
BUG=webrtc:6666
Review-Url: https://codereview.webrtc.org/2559583002
Cr-Commit-Position: refs/heads/master@{#15489}
BitBlt returns a BOOL value, which should be taken care in ScreenCapturerWinGdi.
Meanwhile, this change also replaces assert() / abort() with RTC_DCHECK() /
RTC_CHECK() / RTC_NOTREACHED().
This change cannot fix the bug, the reason of the issue is still unknown, but it
is still the right thing to do.
In ScreenCapturerIntegrationTest, each frame will be captured at most 600 times.
Since the test case fails, which means the ScreenCapturerWinGdi consistently
returns a white frame for 600 times under a certain state. With this change,
instead of returning white frame, ScreenCapturerWinGdi will return a temporary
error. But I do not think a ScreenCapturerWinGdi can automatically recover by
retrying.
BUG=webrtc:6843
Review-Url: https://codereview.webrtc.org/2553353002
Cr-Commit-Position: refs/heads/master@{#15465}
A trivial change to remove a deprecated comment.
BUG=chromium:314516
Review-Url: https://codereview.webrtc.org/2553283002
Cr-Commit-Position: refs/heads/master@{#15454}
To support rotation in DirectX capturer, several other changes are also
required.
1. Removing AddRect in RotateDesktopFrame, this is a performance improvement.
DxgiOutputDuplicator creates a rotated DesktopRegion, which can be directly
add to updated_region.
2. DxgiOutputDuplicator::SourceRect() is not accurate, the rectangle in source
is controlled by |offset| or |rotation_| + |offset|, instead of desktop_rect().
3. The |region| in DxgiTexture::CopyFrom() is not accurate. It needs an
unrotated DesktopRegion which offsets by |offset| instead of desktop_rect(). To
avoid generating both rotated and unrotated updated_region, this parameter has
been removed. This impacts DxgiTextureStagning performance a little bit (1.5ms).
Refer to bug for details.
BUG=webrtc:6646
Review-Url: https://codereview.webrtc.org/2530303002
Cr-Commit-Position: refs/heads/master@{#15308}
This change adds RotateDesktopFrame(), RotateRect(), RotateSize(),
ReverseRotate() functions, so an implementation can use these free functions to
rotate and copy pixels from one DesktopFrame to another at the same time.
This is the first part of the change to support rotation in DirectX capturer. In
a coming change, these functions will be used in DxgiOutputDuplicator to do the
rotation and copying.
Background,
DirectX APIs always return unrotated data buffer, so we need to rotate it to
match the user-selected rotation. What worse is except for the data buffer,
other variables return by these APIs are all rotated, e.g. output size, monitor
position. So we will eventually not be able to capture the rotated monitors,
because we cannot set their position and size correctly. Though
DXGI_OUTDUPL_DESC provides a DXGI_MODE_ROTATION enumeration to indicate the
output rotation, it does not provide a simple way to rotate an IDXGIResource,
which is the only thing we can get from duplication APIs. A typical user case
here is to use a matrix to transform the IDXGIResource and render it to a
surface. But since we do not render the IDXGIResource at all, we need to
manually rotate it.
BUG=314516
Review-Url: https://codereview.webrtc.org/2500883004
Cr-Commit-Position: refs/heads/master@{#15205}
ScreenCapturerIntegrationTest is flaky on Windows systems due to some unknown
reason. But it's do easily impacted by the environment, so this change adds more
logging (entire screenshot) to help debugging.
Meanwhile, this change also includes a nice-to-have change in ScreenDrawerWin to
always bring the window to front in each WaitForPendingDraws() function call. I
cannot quite tell whether this change can help to resolve the issue, but it is
worth trying.
BUG=webrtc:6666
Review-Url: https://codereview.webrtc.org/2492723002
Cr-Commit-Position: refs/heads/master@{#15158}
The old API CGScreenRegisterMoveCallback returned update rects in desktop
coordinates [secondary display has an origin != 0,0]. The new CGDisplayStream
API returns update rects in display coordinates [origin == 0,0]. Translating the
update rect based on the display's position on the desktop is now incorrect.
BUG=webrtc:6702
Review-Url: https://codereview.webrtc.org/2496413002
Cr-Commit-Position: refs/heads/master@{#15092}
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}