300 Commits

Author SHA1 Message Date
zijiehe
8a8b238556 ScreenCapturerWinDirectx should have two DxgiDuplicatorController::Context instances, each for one DesktopFrame. So both DesktopFrame instances can be correctly updated.
I have verified this change on my laptop, which cannot reproduce the issue anymore.

BUG=704205

Review-Url: https://codereview.webrtc.org/2781253002
Cr-Commit-Position: refs/heads/master@{#17494}
2017-03-31 21:13:40 +00:00
zijiehe
cf757cf3fd ScreenCapturerWinDirectx may flicker on certain hardware
Once the first capture attempt failed, we should keep the
context->updated_region unchanged for next attempt. This change can (partially?)
fix issue 704205.

BUG=704205

Review-Url: https://codereview.webrtc.org/2780093002
Cr-Commit-Position: refs/heads/master@{#17456}
2017-03-29 21:37:53 +00:00
sergeyu
858b0f4703 Update XServerPixelBuffer to handle shmget() errors properly.
When screen/window capturers fail to use shared memory, they are
supposed to fall back to XGetImage(). It's slower, but should still
allow to capture desktop content. This wasn't implemented correclty in
XScreenPixelBuffer - it was failing completely when shmget() returns an
error.

BUG=705146

Review-Url: https://codereview.webrtc.org/2775793003
Cr-Commit-Position: refs/heads/master@{#17401}
2017-03-27 20:47:32 +00:00
zijiehe
65cb53a5c6 Use constexpr function FourCC instead of macro
constexpr function should be preferred than a macro. So this change replaces
FOURCC() macro with a constexpr uint32_t FourCC() function.

BUG=679523, 650926

Review-Url: https://codereview.webrtc.org/2771573002
Cr-Commit-Position: refs/heads/master@{#17351}
2017-03-23 07:02:01 +00:00
zijiehe
88ac827877 Add DesktopCapturerId and attach it to DesktopFrame
This change adds a DesktopCapturerId namespace, and attaches an int to each
DesktopFrame. ScreenCapturerWinGdi and ScreenCapturerWinDirectx now actively set
this field to differentiate themselves.

BUG=679523, 650926

Review-Url: https://codereview.webrtc.org/2759493002
Cr-Original-Commit-Position: refs/heads/master@{#17329}
Committed: 41e3d9ff3b
Review-Url: https://codereview.webrtc.org/2759493002
Cr-Commit-Position: refs/heads/master@{#17347}
2017-03-22 18:38:46 +00:00
henrikg
060987699b Revert of Add DesktopCapturerId and attach it to DesktopFrame (patchset #4 id:100002 of https://codereview.webrtc.org/2759493002/ )
Reason for revert:
I suspect that this CL breaks Chromium WebRTC FYI bots. (Thanks kjellander@ for spotting.) The added dep in BUILD.gn would be the problem.

Example:

https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2FLinux_Builder%2F15058%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout

FAILED: newlib_pnacl/obj/third_party/webrtc/api/libjingle_peerconnection_api/mediaconstraintsinterface.o
/b/c/goma_client/gomacc ../../native_client/toolchain/linux_x86/pnacl_newlib/bin/pnacl-clang++ -MMD -MF newlib_pnacl/obj/third_party/webrtc/api/libjingle_peerconnection_api/mediaconstraintsinterface.o.d -DNACL_TC_REV=5dfe030a71ca66e72c5719ef5034c2ed24706c43 -DV8_DEPRECATION_WARNINGS -DUSE_OPENSSL_CERTS=1 -DNO_TCMALLOC -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DENABLE_MEDIA_ROUTER=1 -DFIELDTRIAL_TESTING_ENABLED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -DNDEBUG -DNVALGRIND -DWEBRTC_RESTRICT_LOGGING -DEXPAT_RELATIVE_PATH -DHAVE_SCTP -DENABLE_EXTERNAL_AUTH -DHAVE_WEBRTC_VIDEO -DHAVE_WEBRTC_VOICE -DLOGGING_INSIDE_WEBRTC -DUSE_WEBRTC_DEV_BRANCH -DFEATURE_ENABLE_VOICEMAIL -DEXPAT_RELATIVE_PATH -DGTEST_RELATIVE_PATH -DNO_MAIN_THREAD_WRAPPING -DNO_SOUND_SYSTEM -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -I../.. -Inewlib_pnacl/gen -I../../third_party/webrtc_overrides -I../../third_party -fno-strict-aliasing -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -fcolor-diagnostics -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-deprecated-register -Wno-unneeded-internal-declaration -Wno-inconsistent-missing-override -O2 -fno-ident -fdata-sections -ffunction-sections -g0 -fvisibility=hidden -fvisibility-inlines-hidden -std=gnu++11 -fno-rtti -fno-exceptions -c ../../third_party/webrtc/api/mediaconstraintsinterface.cc -o newlib_pnacl/obj/third_party/webrtc/api/libjingle_peerconnection_api/mediaconstraintsinterface.o
In file included from ../../third_party/webrtc/api/mediaconstraintsinterface.cc:11:
In file included from ../../third_party/webrtc/api/mediaconstraintsinterface.h:27:
In file included from ../../third_party/webrtc/api/peerconnectioninterface.h:77:
In file included from ../../third_party/webrtc/api/dtmfsenderinterface.h:16:
In file included from ../../third_party/webrtc/api/mediastreaminterface.h:33:
In file included from ../../third_party/webrtc/media/base/mediachannel.h:28:
../../third_party/webrtc/base/socket.h:18:10: fatal error: 'sys/socket.h' file not found
#include <sys/socket.h>
         ^
1 error generated.

Original issue's description:
> Add DesktopCapturerId and attach it to DesktopFrame
>
> This change adds a DesktopCapturerId namespace, and attaches an int to each
> DesktopFrame. ScreenCapturerWinGdi and ScreenCapturerWinDirectx now actively set
> this field to differentiate themselves.
>
> BUG=679523, 650926
>
> Review-Url: https://codereview.webrtc.org/2759493002
> Cr-Commit-Position: refs/heads/master@{#17329}
> Committed: 41e3d9ff3b

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=679523, 650926

Review-Url: https://codereview.webrtc.org/2767003002
Cr-Commit-Position: refs/heads/master@{#17336}
2017-03-22 08:13:39 +00:00
zijiehe
41e3d9ff3b Add DesktopCapturerId and attach it to DesktopFrame
This change adds a DesktopCapturerId namespace, and attaches an int to each
DesktopFrame. ScreenCapturerWinGdi and ScreenCapturerWinDirectx now actively set
this field to differentiate themselves.

BUG=679523, 650926

Review-Url: https://codereview.webrtc.org/2759493002
Cr-Commit-Position: refs/heads/master@{#17329}
2017-03-21 19:41:18 +00:00
sergeyu
3eba2d8273 Fix DesktopCapturer constructors to handle failures properly.
CreateRawScreenCapturer() and CreateRawWindowCapturer() in
DesktopCapturer are allowed to return nullptr when capturer cannot be
initialized for some reason. CreateWindowCapturer() and
CreateScreenCapturer() in DesktopCapturer were not handling this case
correctly, which may lead to crash.

BUG=chromium:702745

Review-Url: https://codereview.webrtc.org/2754403002
Cr-Commit-Position: refs/heads/master@{#17298}
2017-03-17 22:33:27 +00:00
zijiehe
299b67809a DxgiOutputDuplicator should initialize num_frames_captured_
Otherwise Check failed: !!last_frame_ == num_frames_captured_ > 0 (1 vs. 0) may
be triggered.

BUG=webrtc:7339

Review-Url: https://codereview.webrtc.org/2755493003
Cr-Commit-Position: refs/heads/master@{#17266}
2017-03-15 22:52:20 +00:00
zijiehe
bc935b4c49 Ignore unmoved moved_rects in DxgiOutputDuplicator
I cannot even imagine this change is useful. But it consistently reduces average
capture time by 0.375% (4.07 -> 4.055), and average encode time by 0.313%
(8.042 -> 8.016) without other impacts. Considering this is a one-line change,
it's worthy to be added.

BUG=679523

Review-Url: https://codereview.webrtc.org/2743233002
Cr-Commit-Position: refs/heads/master@{#17235}
2017-03-15 00:27:58 +00:00
braveyao
95b27217f2 Mac: fix screen capture freezes when context menu popup in Chrome.
Previously we grab a run loop source and add a source with mode
kCFRunLoopDefaultMode. With this mode, it won't callback when context menu popup
(which needs the NSEventTrackingRunLoopMode), then screen capture can't get
refreshed frame with context menu until the context menu is gone.
The fix is to use kCFRunLoopComonModes, which includes default,modal and event
tracking modes by default.

BUG=chromium:697780

Review-Url: https://codereview.webrtc.org/2732393003
Cr-Commit-Position: refs/heads/master@{#17171}
2017-03-10 17:46:49 +00:00
erikchen
31bbee73a0 mac: Fix screen capture for whole-desktop capture.
DisplayStream refresh rects are in display coordinates. When the whole screen is
being captured, the coordinates passed to the ScreenCapturerHelper need to be in
screen coordinates. This CL translates display coordinates to screen
coordinates for whole screen capture.

BUG=chromium:699672

Review-Url: https://codereview.webrtc.org/2740823002
Cr-Commit-Position: refs/heads/master@{#17153}
2017-03-09 21:19:03 +00:00
sergeyu
9fa7e4a0ac Fix error handling in X11 screen capturer
Previusly errors from XServerPixelBuffer::CaptureRect() were not always
handled, which results in a black frame returned from the capturer
instead of an error.

BUG=webrtc:7305

Review-Url: https://codereview.webrtc.org/2738513005
Cr-Commit-Position: refs/heads/master@{#17101}
2017-03-08 01:02:20 +00:00
zijiehe
ccf57a71eb BlankDetectorDesktopCapturerWrapper to detect a blank DesktopFrame
DXGI capturer highly depends on video adapter and its driver, as well as Windows
itself. I recently found it cannot work on my virtualbox instance any more,
which indicates it may not work well on some specific systems. What worse is,
the APIs do not return a failure in such case.

So this change adds a BlankDetectorDesktopCapturerWrapper, which samples several
pixels in the frame returned by a DesktopCapturer implementation. If all the
pixels selected are blank, this wrapper returns a failure. A typical usage is to
combine BlankDetectorDesktopCapturerWrapper with FallbackDesktopCapturerWrapper,
and use GDI capturer in case of failure.

Usually less than 10000 pixels are checked, so the
BlankDetectorDesktopCapturerWrapper should not significant impact the capturer
performance.

This change is expected to resolve bug 682112 in another dimension.

BUG=682112

Review-Url: https://codereview.webrtc.org/2709523003
Cr-Original-Commit-Position: refs/heads/master@{#16984}
Committed: c4e9d210b3
Review-Url: https://codereview.webrtc.org/2709523003
Cr-Commit-Position: refs/heads/master@{#17024}
2017-03-03 22:40:15 +00:00
perkj
528a834ef0 Revert of BlankDetectorDesktopCapturerWrapper to detect a blank DesktopFrame (patchset #7 id:180001 of https://codereview.webrtc.org/2709523003/ )
Reason for revert:
Misses  deps for RTC_HISTOGRAM in Chrome.
email sent separately.

Also see https://codereview.chromium.org/2725143004/.

Original issue's description:
> BlankDetectorDesktopCapturerWrapper to detect a blank DesktopFrame
>
> DXGI capturer highly depends on video adapter and its driver, as well as Windows
> itself. I recently found it cannot work on my virtualbox instance any more,
> which indicates it may not work well on some specific systems. What worse is,
> the APIs do not return a failure in such case.
>
> So this change adds a BlankDetectorDesktopCapturerWrapper, which samples several
> pixels in the frame returned by a DesktopCapturer implementation. If all the
> pixels selected are blank, this wrapper returns a failure. A typical usage is to
> combine BlankDetectorDesktopCapturerWrapper with FallbackDesktopCapturerWrapper,
> and use GDI capturer in case of failure.
>
> Usually less than 500 pixels are checked, so the
> BlankDetectorDesktopCapturerWrapper should not impact the capturer performance.
>
> This change is expected to resolve bug 682112 in another dimension.
>
> BUG=682112
>
> Review-Url: https://codereview.webrtc.org/2709523003
> Cr-Commit-Position: refs/heads/master@{#16984}
> Committed: c4e9d210b3

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=682112

Review-Url: https://codereview.webrtc.org/2726983005
Cr-Commit-Position: refs/heads/master@{#16993}
2017-03-03 08:01:48 +00:00
zijiehe
c4e9d210b3 BlankDetectorDesktopCapturerWrapper to detect a blank DesktopFrame
DXGI capturer highly depends on video adapter and its driver, as well as Windows
itself. I recently found it cannot work on my virtualbox instance any more,
which indicates it may not work well on some specific systems. What worse is,
the APIs do not return a failure in such case.

So this change adds a BlankDetectorDesktopCapturerWrapper, which samples several
pixels in the frame returned by a DesktopCapturer implementation. If all the
pixels selected are blank, this wrapper returns a failure. A typical usage is to
combine BlankDetectorDesktopCapturerWrapper with FallbackDesktopCapturerWrapper,
and use GDI capturer in case of failure.

Usually less than 500 pixels are checked, so the
BlankDetectorDesktopCapturerWrapper should not impact the capturer performance.

This change is expected to resolve bug 682112 in another dimension.

BUG=682112

Review-Url: https://codereview.webrtc.org/2709523003
Cr-Commit-Position: refs/heads/master@{#16984}
2017-03-03 01:38:36 +00:00
zijiehe
634fcb32e3 DxgiOutputDuplicator AcquireNextFrame timeout can be 0
Timeout of AcquireNextFrame() can be 0. Though MSDN does not state it clear, I
tried it on my laptop, it works well, with almost zero capture time.
The screenshot is at https://drive.google.com/open?id=0B0OFNI4uoZGRNVZxekxCbm0ycmc.

BUG=682112

Review-Url: https://codereview.webrtc.org/2712353002
Cr-Commit-Position: refs/heads/master@{#16953}
2017-03-01 19:45:37 +00:00
zijiehe
8697f9afba Skips the first frame in DxgiDuplicatorController
A bug has been reported to complaint the ScreenCapturerWinDirectx cannot capture
the first frame, which is used in "Report an issue" page.
A simple solution here is to skip the first frame.

This change also removes the friend relationship between
DxgiDuplicatorController / DxgiAdapterDuplicator / DxgiOutputDuplicator, which
is not really necessary.

BUG=682112

Review-Url: https://codereview.webrtc.org/2703123002
Cr-Commit-Position: refs/heads/master@{#16815}
2017-02-24 05:43:40 +00:00
zijiehe
3fa87f782e Use FallbackDesktopCapturerWrapper in ScreenCapturerWinMagnifier
This is a trivial change to remove duplicate logic, i.e. fallback capturer, from
ScreenCapturerWinMagnifier.

BUG=webrtc:7215

Review-Url: https://codereview.webrtc.org/2704943002
Cr-Commit-Position: refs/heads/master@{#16781}
2017-02-22 21:47:00 +00:00
zijiehe
e352dbe6d5 Update comments in FallbackDesktopCapturerWrapper
Update the year in copyright headers from 2016 to 2017, and also rename a
variable in FallbackDesktopCapturerWrapperTest to follow coding style.

BUG=webrtc:7205

Review-Url: https://codereview.webrtc.org/2706193005
Cr-Commit-Position: refs/heads/master@{#16759}
2017-02-21 23:00:07 +00:00
zijiehe
8fefe9889d [DesktopCapturer] FallbackDesktopCapturerWrapper and its tests
FallbackDesktopCapturerWrapper is a DesktopCapturer implementation, which owns
two DesktopCapturer implementations. If the main DesktopCapturer fails, it uses
the secondary capturer. The logic is now used in ScreenCapturerWinMagnifier, and
it can also be shared in ScreenCapturerWinDirectx to fallback to Gdi capturer on
privilege prompt or login screen.

BUG=684937

Review-Url: https://codereview.webrtc.org/2697453002
Cr-Commit-Position: refs/heads/master@{#16677}
2017-02-17 22:32:04 +00:00
zijiehe
5fea5fb183 [DesktopCapture] Detect screen resolution changes in DirectX capturer
This change adds a ResolutionChangeDetector to help dxgi components, say
DxgiDuplicatorController and DxgiTexture to detect resolution changes.

BUG=684162

Review-Url: https://codereview.webrtc.org/2682913002
Cr-Commit-Position: refs/heads/master@{#16654}
2017-02-16 20:07:44 +00:00
ehmaldonado
0d729b3039 Check for use_x11 before runnig desktop_capture_modules_tests on linux.
The tests need "x11/shared_x_display.h" which is not included when use_x11 is false and we're on linux.

The problem is:

screen_capturer_integration_test.cc
 - requires ->
screen_drawer.h
 - requires ->
screen_drawer_linux.cc
 - requires ->
x11/shared_x_display.h
 which is not included when use_x11 is false.

BUG=None
NOTRY=True

Review-Url: https://codereview.webrtc.org/2684683003
Cr-Commit-Position: refs/heads/master@{#16529}
2017-02-10 09:38:23 +00:00
ehmaldonado
656610fbe7 Move frame_generator_capture.{cc, h} and video_capturer.h to video_test_common.
Remove video_capture as a dependency of test_common and add it as a dependency of modules_unittests, as it was before the refactor in https://codereview.webrtc.org/2629923002

BUG=webrtc:7037
NOTRY=True

Review-Url: https://codereview.webrtc.org/2666113003
Cr-Commit-Position: refs/heads/master@{#16439}
2017-02-06 10:21:11 +00:00
ehmaldonado
9cbb0a16e5 Reland of GN: Refactor modules_unittests to eliminate package boundary violations. (patchset #1 id:1 of https://codereview.webrtc.org/2651023005/ )
Reason for revert:
Will change the name from bwe_simulator to bwe_simulator_test.

Original issue's description:
> Revert of GN: Refactor modules_unittests to eliminate package boundary violations. (patchset #4 id:130001 of https://codereview.webrtc.org/2649563002/ )
>
> Reason for revert:
> Did break the bots.
> https://build.chromium.org/p/client.webrtc/builders/iOS32%20Release/builds/9807
>
> Original issue's description:
> > GN: Refactor modules_unittests to eliminate package boundary violations.
> >
> > Also move bwe_simulator to webrtc/modules/remote_bitrate_estimator
> >
> > BUG=webrtc:6954
> > NOTRY=True
> >
> > Review-Url: https://codereview.webrtc.org/2649563002
> > Cr-Commit-Position: refs/heads/master@{#16270}
> > Committed: 36cb55d715
>
> TBR=kjellander@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:6954
>
> Review-Url: https://codereview.webrtc.org/2651023005
> Cr-Commit-Position: refs/heads/master@{#16271}
> Committed: 3373eaa577

R=kjellander@webrtc.org
NOTRY=true
BUG=webrtc:6954

Review-Url: https://codereview.webrtc.org/2653173003
Cr-Commit-Position: refs/heads/master@{#16356}
2017-01-30 11:07:03 +00:00
ehmaldonado
3373eaa577 Revert of GN: Refactor modules_unittests to eliminate package boundary violations. (patchset #4 id:130001 of https://codereview.webrtc.org/2649563002/ )
Reason for revert:
Did break the bots.
https://build.chromium.org/p/client.webrtc/builders/iOS32%20Release/builds/9807

Original issue's description:
> GN: Refactor modules_unittests to eliminate package boundary violations.
>
> Also move bwe_simulator to webrtc/modules/remote_bitrate_estimator
>
> BUG=webrtc:6954
> NOTRY=True
>
> Review-Url: https://codereview.webrtc.org/2649563002
> Cr-Commit-Position: refs/heads/master@{#16270}
> Committed: 36cb55d715

TBR=kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:6954

Review-Url: https://codereview.webrtc.org/2651023005
Cr-Commit-Position: refs/heads/master@{#16271}
2017-01-25 16:11:28 +00:00
ehmaldonado
36cb55d715 GN: Refactor modules_unittests to eliminate package boundary violations.
Also move bwe_simulator to webrtc/modules/remote_bitrate_estimator

BUG=webrtc:6954
NOTRY=True

Review-Url: https://codereview.webrtc.org/2649563002
Cr-Commit-Position: refs/heads/master@{#16270}
2017-01-25 16:00:15 +00:00
mbonadei
9aa3f0a200 Reland of Moving webrtc.gni up one level from build/ (patchset #1 id:1 of https://codereview.webrtc.org/2657563002/ )
Reason for revert:
Starting to work on a fix (it seems that there are third_party dependencies that depends on the path to the webrtc.gni file)

Original issue's description:
> Revert of Moving webrtc.gni up one level from build/ (patchset #1 id:1 of https://codereview.webrtc.org/2651543003/ )
>
> Reason for revert:
> This was causing the following failure: https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Builder/builds/838/steps/generate_build_files/logs/stdio
>
> Original issue's description:
> > Moving webrtc.gni up one level from build/
> >
> > BUG=webrtc:7030
> >
> > Review-Url: https://codereview.webrtc.org/2651543003
> > Cr-Commit-Position: refs/heads/master@{#16241}
> > Committed: 35a32700fc
>
> TBR=kjellander@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7030
>
> Review-Url: https://codereview.webrtc.org/2657563002
> Cr-Commit-Position: refs/heads/master@{#16244}
> Committed: 69dc7dbe24

TBR=kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7030

Review-Url: https://codereview.webrtc.org/2654773002
Cr-Commit-Position: refs/heads/master@{#16247}
2017-01-24 14:58:22 +00:00
mbonadei
69dc7dbe24 Revert of Moving webrtc.gni up one level from build/ (patchset #1 id:1 of https://codereview.webrtc.org/2651543003/ )
Reason for revert:
This was causing the following failure: https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Builder/builds/838/steps/generate_build_files/logs/stdio

Original issue's description:
> Moving webrtc.gni up one level from build/
>
> BUG=webrtc:7030
>
> Review-Url: https://codereview.webrtc.org/2651543003
> Cr-Commit-Position: refs/heads/master@{#16241}
> Committed: 35a32700fc

TBR=kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7030

Review-Url: https://codereview.webrtc.org/2657563002
Cr-Commit-Position: refs/heads/master@{#16244}
2017-01-24 13:14:35 +00:00
mbonadei
35a32700fc Moving webrtc.gni up one level from build/
BUG=webrtc:7030

Review-Url: https://codereview.webrtc.org/2651543003
Cr-Commit-Position: refs/heads/master@{#16241}
2017-01-24 12:49:35 +00:00
floppymaster
888874f761 Allow GCC 4.9 to compile Chromium
In order to implicit cast an lvalue to an rvalue when returning
from a function, the return type and type of variable in the return
statement previously had to be exactly the same. When this was not
the case, std::move was required. For instance, when returning a
std::unique_ptr<Derived> variable in a function with a
std::unique_ptr<Base> return type, std::move is required.

DR 1579 changed this, and allows for implicitly converting
to the return type, if the return type has a constructor(T&&), where
T is the type of the local variable being returned. DR 1579 was
implemented in GCC 5, but not in GCC 4.9 and below. By explicitly
qualifying the local variable with std::move, we allow for compiling
with GCC 4.9 and incur no performance penalty. The code is still
absolutely correct to the word of C++11.

BUG=chromium:682965

See also:
* https://bugs.gentoo.org/show_bug.cgi?id=600288
* https://stackoverflow.com/questions/22018115/converting-stdunique-ptrderived-to-stdunique-ptrbase#comment33375875_22018521
* http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3833.html#1579

Review-Url: https://codereview.webrtc.org/2642053003
Cr-Commit-Position: refs/heads/master@{#16175}
2017-01-20 04:20:45 +00:00
ehmaldonado
3626865be2 GN: Refactor modules_unittests to eliminate package boundary violations.
BUG=webrtc:6954

Review-Url: https://codereview.webrtc.org/2629923002
Cr-Commit-Position: refs/heads/master@{#16166}
2017-01-19 16:27:11 +00:00
nisse
eb4ca4e823 Replace RTC_DCHECK(false) with RTC_NOTREACHED().
Bulk of changes done using

  git grep -l 'RTC_DCHECK(false)' | \
    xargs sed -i 's/RTC_DCHECK(false)/RTC_NOTREACHED()/'

peerconnection.cc also used RTC_DCHECK(false && "msg") in two places,
which were updated manually.

BUG=webrtc:6424

Review-Url: https://codereview.webrtc.org/2623313004
Cr-Commit-Position: refs/heads/master@{#16026}
2017-01-12 10:24:27 +00:00
mbonadei
f423593f55 Reland of Refactor webrtc/modules/desktop_capture for GN check
Reason for revert:
Trying to reland this CL.

Original issue's description:
> Revert of Refactor webrtc/modules/desktop_capture for GN check (patchset #1 id:1 of https://codereview.webrtc.org/2593713002/ )
>
> Reason for revert:
> Apparently breaks Chromium compile for unknown reason:
> https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux%20Builder/builds/12314
>
> Original issue's description:
> > Refactor webrtc/modules/desktop_capture for GN check
> >
> > This moves some GN check configurations out of .gn to individual
> > targets.
> >
> > The now checked target is:
> > "//webrtc/modules/desktop_capture/*"
> >
> > BUG=webrtc:6828
> > NOTRY=True
> >
> > Review-Url: https://codereview.webrtc.org/2593713002
> > Cr-Commit-Position: refs/heads/master@{#15725}
> > Committed: 70870b9211
>
> TBR=sergeyu@chromium.org,mbonadei@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:6828
>
> Review-Url: https://codereview.webrtc.org/2597923002
> Cr-Commit-Position: refs/heads/master@{#15750}
> Committed: d943c48454

TBR=sergeyu@chromium.org,kjellander@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:6828

Review-Url: https://codereview.webrtc.org/2609523002
Cr-Commit-Position: refs/heads/master@{#15832}
2016-12-29 11:35:56 +00:00
kjellander
d943c48454 Revert of Refactor webrtc/modules/desktop_capture for GN check (patchset #1 id:1 of https://codereview.webrtc.org/2593713002/ )
Reason for revert:
Apparently breaks Chromium compile for unknown reason:
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux%20Builder/builds/12314

Original issue's description:
> Refactor webrtc/modules/desktop_capture for GN check
>
> This moves some GN check configurations out of .gn to individual
> targets.
>
> The now checked target is:
> "//webrtc/modules/desktop_capture/*"
>
> BUG=webrtc:6828
> NOTRY=True
>
> Review-Url: https://codereview.webrtc.org/2593713002
> Cr-Commit-Position: refs/heads/master@{#15725}
> Committed: 70870b9211

TBR=sergeyu@chromium.org,mbonadei@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:6828

Review-Url: https://codereview.webrtc.org/2597923002
Cr-Commit-Position: refs/heads/master@{#15750}
2016-12-22 07:19:59 +00:00
mbonadei
70870b9211 Refactor webrtc/modules/desktop_capture for GN check
This moves some GN check configurations out of .gn to individual
targets.

The now checked target is:
"//webrtc/modules/desktop_capture/*"

BUG=webrtc:6828
NOTRY=True

Review-Url: https://codereview.webrtc.org/2593713002
Cr-Commit-Position: refs/heads/master@{#15725}
2016-12-21 07:42:05 +00:00
erikchen
494dff4c07 Fix a screen capture issue on retina macOS devices.
The CGDisplayStream API returns rects in physical pixel coordinates, not
Density-Independent Pixel coordinates. The code was incorrectly re-applying the
dip_to_pixel scaling.

BUG=chromium:675490

Review-Url: https://codereview.webrtc.org/2588973002
Cr-Commit-Position: refs/heads/master@{#15720}
2016-12-21 01:00:22 +00:00
Henrik Kjellander
99f7bfde28 Change MANUAL -> DISABLED for ScreenCapturerIntegrationTest tests
It turns out MANUAL_ isn't a part of the supported gtest prefixes: it's a part of the
Chromium test launcher: https://cs.chromium.org/chromium/src/content/public/test/test_launcher.cc?rcl=0&l=69

Luckily, we can use DISABLED_ for the same purpose, since there's the --gtest_also_run_disabled_tests
flag we can use.

BUG=webrtc:6666, webrtc:6843
TBR=zijiehe@chromium.org

Review-Url: https://codereview.webrtc.org/2568013002 .
Cr-Commit-Position: refs/heads/master@{#15539}
2016-12-12 07:30:09 +00:00
zijiehe
8d1649d71b MANUAL tests of GDI capturers
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}
2016-12-10 00:00:10 +00:00
zijiehe
e83f4b3835 Enable screen capturer tests for Linux / DirectX capturer / magnifier capturer
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}
2016-12-08 19:47:09 +00:00
zijiehe
2cd872a939 Log BitBlt failure
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}
2016-12-07 20:40:34 +00:00
zijiehe
d3de4abb50 Remove deprecated comments
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}
2016-12-07 00:32:12 +00:00
ossu
f4a5942e62 Disabled all ScreenCapturerIntegrationTests on Windows
TBR=zijiehe@chromium.org
BUG=webrtc:6666

Review-Url: https://codereview.webrtc.org/2538093002
Cr-Commit-Position: refs/heads/master@{#15321}
2016-11-30 10:39:00 +00:00
zijiehe
e61fbfffda Use RotateDesktopFrame in DirectX capturer
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}
2016-11-30 00:09:57 +00:00
zijiehe
166e59a70f Enable ScreenCapturerIntegrationTests
This change enables ScreenCapturerIntegrationTests.

BUG=webrtc:6666

Review-Url: https://codereview.webrtc.org/2513213002
Cr-Commit-Position: refs/heads/master@{#15307}
2016-11-29 22:46:56 +00:00
kwiberg
b890c95c33 Replace some asserts with DCHECKs
NOPRESUBMIT=true
BUG=webrtc:6779

Review-Url: https://codereview.webrtc.org/2535643002
Cr-Commit-Position: refs/heads/master@{#15295}
2016-11-29 13:30:47 +00:00
zijiehe
90ea7362fc Add DesktopFrame rotation functions
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}
2016-11-23 01:17:19 +00:00
Sergey Ulanov
1c062bf0af Fix module/desktop_capture compilation on iOS
modules/desktop_capture was failing to compile on iOS because some
files were not compiled.

BUG=667898
R=nicholss@chromium.org

Review URL: https://codereview.webrtc.org/2522083002 .

Cr-Commit-Position: refs/heads/master@{#15203}
2016-11-23 00:07:23 +00:00
zijiehe
1b0e3aa440 Remove deprecated CroppingWindowCapturer::Create
BUG=webrtc:6513

Review-Url: https://codereview.webrtc.org/2513103003
Cr-Commit-Position: refs/heads/master@{#15173}
2016-11-21 21:54:30 +00:00
zijiehe
2184155782 Add more logging in ScreenCapturerIntegrationTest
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}
2016-11-19 04:31:10 +00:00