blob: 6b7fb22eaa98121483654d19131a0492027d7a1b [file] [log] [blame]
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +00001# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +00009import("//build/config/ui.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -080010import("../../webrtc.gni")
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +000011
Sergey Ulanov1c062bf2016-11-22 16:07:10 -080012use_desktop_capture_differ_sse2 = current_cpu == "x86" || current_cpu == "x64"
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000013
kjellanderb62dbbe2016-09-23 00:38:52 -070014rtc_static_library("primitives") {
Sergey Ulanov098c1de2015-09-01 11:36:40 -070015 sources = [
16 "desktop_capture_types.h",
17 "desktop_frame.cc",
18 "desktop_frame.h",
19 "desktop_geometry.cc",
20 "desktop_geometry.h",
21 "desktop_region.cc",
22 "desktop_region.h",
Sergey Ulanov58000a02016-10-20 09:33:52 -070023 "shared_desktop_frame.cc",
24 "shared_desktop_frame.h",
mbonadeif4235932016-12-29 03:35:56 -080025 "shared_memory.cc",
26 "shared_memory.h",
Sergey Ulanov58000a02016-10-20 09:33:52 -070027 ]
28
29 deps = [
mbonadeif4235932016-12-29 03:35:56 -080030 "../..:webrtc_common",
ehmaldonadof6a861a2017-07-19 10:40:47 -070031 "../../rtc_base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
Sergey Ulanov098c1de2015-09-01 11:36:40 -070032 ]
Sergey Ulanov098c1de2015-09-01 11:36:40 -070033}
34
zijiehe6be0a652016-10-27 16:50:35 -070035if (rtc_include_tests) {
ehmaldonado9cbb0a12017-01-30 03:07:03 -080036 rtc_source_set("desktop_capture_modules_tests") {
37 testonly = true
kjellandere0629c02017-04-25 04:04:50 -070038
39 # Skip restricting visibility on mobile platforms since the tests on those
40 # gets additional generated targets which would require many lines here to
41 # cover (which would be confusing to read and hard to maintain).
42 if (!is_android && !is_ios) {
jianjun.zhuc0247402017-07-11 06:20:45 -070043 visibility = [ "..:modules_tests" ]
kjellandere0629c02017-04-25 04:04:50 -070044 }
ehmaldonado9cbb0a12017-01-30 03:07:03 -080045 sources = []
46 deps = []
47 if (rtc_desktop_capture_supported) {
48 deps += [
49 ":desktop_capture_mock",
50 ":primitives",
51 ":screen_drawer",
ehmaldonadof6a861a2017-07-19 10:40:47 -070052 "../../rtc_base:rtc_base",
53 "../../rtc_base:rtc_base_approved",
zijieheccf57a72017-03-03 14:40:15 -080054 "../../system_wrappers",
ehmaldonado9cbb0a12017-01-30 03:07:03 -080055 "../../test:test_support",
ehmaldonado656610f2017-02-06 02:21:11 -080056 "../../test:video_test_support",
ehmaldonado9cbb0a12017-01-30 03:07:03 -080057 ]
58 sources += [
59 "screen_capturer_integration_test.cc",
60 "screen_drawer_unittest.cc",
61 ]
62 }
63 }
64
ehmaldonado36268652017-01-19 08:27:11 -080065 rtc_source_set("desktop_capture_unittests") {
66 testonly = true
kjellandere0629c02017-04-25 04:04:50 -070067
68 # Skip restricting visibility on mobile platforms since the tests on those
69 # gets additional generated targets which would require many lines here to
70 # cover (which would be confusing to read and hard to maintain).
71 if (!is_android && !is_ios) {
jianjun.zhuc0247402017-07-11 06:20:45 -070072 visibility = [ "..:modules_unittests" ]
kjellandere0629c02017-04-25 04:04:50 -070073 }
ehmaldonado0d729b32017-02-10 01:38:23 -080074 sources = [
zijieheccf57a72017-03-03 14:40:15 -080075 "blank_detector_desktop_capturer_wrapper_unittest.cc",
ehmaldonado0d729b32017-02-10 01:38:23 -080076 "desktop_and_cursor_composer_unittest.cc",
77 "desktop_capturer_differ_wrapper_unittest.cc",
78 "desktop_frame_rotation_unittest.cc",
zijiehe8eef7aa2017-05-18 12:27:16 -070079 "desktop_geometry_unittest.cc",
ehmaldonado0d729b32017-02-10 01:38:23 -080080 "desktop_region_unittest.cc",
81 "differ_block_unittest.cc",
zijiehe8fefe982017-02-17 14:32:04 -080082 "fallback_desktop_capturer_wrapper_unittest.cc",
ehmaldonado0d729b32017-02-10 01:38:23 -080083 "mouse_cursor_monitor_unittest.cc",
84 "rgba_color_unittest.cc",
85 "test_utils.cc",
86 "test_utils.h",
87 "test_utils_unittest.cc",
88 "win/cursor_unittest.cc",
89 "win/cursor_unittest_resources.h",
90 "win/cursor_unittest_resources.rc",
zijiehe4ff42082017-07-13 16:05:24 -070091 "win/screen_capture_utils_unittest.cc",
Zijie He3e45cb52017-07-17 20:33:47 -070092 "win/screen_capturer_win_directx_unittest.cc",
ehmaldonado0d729b32017-02-10 01:38:23 -080093 ]
94 deps = [
95 ":desktop_capture",
96 ":desktop_capture_mock",
97 ":primitives",
ehmaldonado0d729b32017-02-10 01:38:23 -080098 "../..:webrtc_common",
ehmaldonadof6a861a2017-07-19 10:40:47 -070099 "../../rtc_base:rtc_base_approved",
zijieheccf57a72017-03-03 14:40:15 -0800100 "../../system_wrappers",
ehmaldonado0d729b32017-02-10 01:38:23 -0800101 "../../test:test_support",
102 "//testing/gmock",
103 ]
ehmaldonado36268652017-01-19 08:27:11 -0800104 if (rtc_desktop_capture_supported) {
105 sources += [
ehmaldonado36268652017-01-19 08:27:11 -0800106 "screen_capturer_helper_unittest.cc",
107 "screen_capturer_mac_unittest.cc",
108 "screen_capturer_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800109 "window_capturer_unittest.cc",
110 ]
111 deps += [ ":desktop_capture_mock" ]
112 }
113 if (!build_with_chromium && is_clang) {
114 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
115 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
116 }
117 }
118
perkj528a8342017-03-03 00:01:48 -0800119 source_set("screen_drawer") {
120 testonly = true
121
122 public_deps = [
zijieheccf57a72017-03-03 14:40:15 -0800123 ":desktop_capture",
perkj528a8342017-03-03 00:01:48 -0800124 ]
125
126 sources = [
zijiehe6be0a652016-10-27 16:50:35 -0700127 "screen_drawer.cc",
128 "screen_drawer.h",
129 "screen_drawer_linux.cc",
Zijie He825f65e2017-08-16 14:56:42 -0700130 "screen_drawer_lock_posix.cc",
131 "screen_drawer_lock_posix.h",
zijiehe6be0a652016-10-27 16:50:35 -0700132 "screen_drawer_mac.cc",
133 "screen_drawer_win.cc",
134 ]
mbonadeif4235932016-12-29 03:35:56 -0800135
136 deps = [
137 ":primitives",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700138 "../../rtc_base:rtc_base_approved",
mbonadeif4235932016-12-29 03:35:56 -0800139 "../../system_wrappers",
140 ]
zijiehe6be0a652016-10-27 16:50:35 -0700141 }
zijiehe54fd5792016-11-02 14:49:35 -0700142
143 source_set("desktop_capture_mock") {
144 testonly = true
145
146 public_deps = [
147 ":desktop_capture",
zijiehe372719b2016-11-11 17:18:34 -0800148 "//testing/gmock",
zijiehe54fd5792016-11-02 14:49:35 -0700149 ]
150
151 sources = [
152 "desktop_frame_generator.cc",
153 "desktop_frame_generator.h",
zijiehe98903d22016-11-10 21:57:10 -0800154 "fake_desktop_capturer.cc",
zijiehe54fd5792016-11-02 14:49:35 -0700155 "fake_desktop_capturer.h",
zijiehe372719b2016-11-11 17:18:34 -0800156 "mock_desktop_capturer_callback.cc",
zijiehe54fd5792016-11-02 14:49:35 -0700157 "mock_desktop_capturer_callback.h",
mbonadeif4235932016-12-29 03:35:56 -0800158 ]
159
160 deps = [
161 ":primitives",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700162 "../../rtc_base:rtc_base_approved",
mbonadeif4235932016-12-29 03:35:56 -0800163 "../../test:test_support",
zijiehe54fd5792016-11-02 14:49:35 -0700164 ]
165 }
zijiehe6be0a652016-10-27 16:50:35 -0700166}
167
mbonadei13b98822017-08-30 07:24:43 -0700168rtc_source_set("desktop_capture") {
mbonadeiedb84292017-09-04 07:58:29 -0700169 public_deps = [
170 ":desktop_capture_generic",
171 ]
mbonadei13b98822017-08-30 07:24:43 -0700172 if (is_mac) {
mbonadeiedb84292017-09-04 07:58:29 -0700173 public_deps += [ ":desktop_capture_objc" ]
mbonadei13b98822017-08-30 07:24:43 -0700174 }
175}
176
177if (is_mac) {
178 rtc_source_set("desktop_capture_objc") {
mbonadeiedb84292017-09-04 07:58:29 -0700179 visibility = [ ":desktop_capture" ]
mbonadei13b98822017-08-30 07:24:43 -0700180 sources = [
181 "mac/desktop_configuration.mm",
182 "mouse_cursor_monitor_mac.mm",
183 "screen_capturer_mac.mm",
184 "window_capturer_mac.mm",
185 ]
mbonadei13b98822017-08-30 07:24:43 -0700186 deps = [
mbonadeiedb84292017-09-04 07:58:29 -0700187 ":desktop_capture_generic",
mbonadei13b98822017-08-30 07:24:43 -0700188 ":primitives",
189 "../../rtc_base:rtc_base",
190 "../../rtc_base:rtc_base_approved",
191 ]
192 libs = [
193 "AppKit.framework",
194 "IOKit.framework",
195 "OpenGL.framework",
196 ]
197 }
198}
199
200rtc_static_library("desktop_capture_generic") {
mbonadeiedb84292017-09-04 07:58:29 -0700201 visibility = [
202 ":desktop_capture",
203 ":desktop_capture_objc",
204 ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000205 sources = [
zijieheccf57a72017-03-03 14:40:15 -0800206 "blank_detector_desktop_capturer_wrapper.cc",
207 "blank_detector_desktop_capturer_wrapper.h",
jiayl@webrtc.org0e710702014-11-11 18:15:55 +0000208 "cropped_desktop_frame.cc",
209 "cropped_desktop_frame.h",
210 "cropping_window_capturer.cc",
211 "cropping_window_capturer.h",
212 "cropping_window_capturer_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000213 "desktop_and_cursor_composer.cc",
214 "desktop_and_cursor_composer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200215 "desktop_capture_options.cc",
216 "desktop_capture_options.h",
zijieheb68d6552016-10-28 17:35:11 -0700217 "desktop_capturer.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000218 "desktop_capturer.h",
Sergey Ulanov1c062bf2016-11-22 16:07:10 -0800219 "desktop_capturer_differ_wrapper.cc",
220 "desktop_capturer_differ_wrapper.h",
zijiehe90ea7362016-11-22 17:17:09 -0800221 "desktop_frame_rotation.cc",
222 "desktop_frame_rotation.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000223 "desktop_frame_win.cc",
224 "desktop_frame_win.h",
Sergey Ulanov1c062bf2016-11-22 16:07:10 -0800225 "differ_block.cc",
226 "differ_block.h",
zijiehe8fefe982017-02-17 14:32:04 -0800227 "fallback_desktop_capturer_wrapper.cc",
228 "fallback_desktop_capturer_wrapper.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000229 "mac/desktop_configuration.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000230 "mac/desktop_configuration_monitor.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200231 "mac/desktop_configuration_monitor.h",
jiayl@webrtc.org12b4efe2014-07-08 22:05:24 +0000232 "mac/full_screen_chrome_window_detector.cc",
233 "mac/full_screen_chrome_window_detector.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000234 "mac/scoped_pixel_buffer_object.cc",
235 "mac/scoped_pixel_buffer_object.h",
jiayl@webrtc.org12b4efe2014-07-08 22:05:24 +0000236 "mac/window_list_utils.cc",
237 "mac/window_list_utils.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000238 "mouse_cursor.cc",
239 "mouse_cursor.h",
240 "mouse_cursor_monitor.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000241 "mouse_cursor_monitor_win.cc",
Zijie He7e1c24c2017-07-27 18:06:12 -0700242 "resolution_tracker.cc",
243 "resolution_tracker.h",
zijieheccf57a72017-03-03 14:40:15 -0800244 "rgba_color.cc",
245 "rgba_color.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000246 "screen_capture_frame_queue.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000247 "screen_capturer_helper.cc",
248 "screen_capturer_helper.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000249 "screen_capturer_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000250 "win/cursor.cc",
251 "win/cursor.h",
zijiehe2d618de2016-08-08 17:50:21 -0700252 "win/d3d_device.cc",
253 "win/d3d_device.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000254 "win/desktop.cc",
255 "win/desktop.h",
Zijie He74544f92017-07-24 16:52:17 -0700256 "win/display_configuration_monitor.cc",
257 "win/display_configuration_monitor.h",
zijiehe2d618de2016-08-08 17:50:21 -0700258 "win/dxgi_adapter_duplicator.cc",
259 "win/dxgi_adapter_duplicator.h",
zijiehecf5753d2017-04-20 12:06:04 -0700260 "win/dxgi_context.cc",
261 "win/dxgi_context.h",
zijiehe2d618de2016-08-08 17:50:21 -0700262 "win/dxgi_duplicator_controller.cc",
263 "win/dxgi_duplicator_controller.h",
zijiehecf5753d2017-04-20 12:06:04 -0700264 "win/dxgi_frame.cc",
265 "win/dxgi_frame.h",
zijiehe2d618de2016-08-08 17:50:21 -0700266 "win/dxgi_output_duplicator.cc",
267 "win/dxgi_output_duplicator.h",
268 "win/dxgi_texture.cc",
269 "win/dxgi_texture.h",
270 "win/dxgi_texture_mapping.cc",
271 "win/dxgi_texture_mapping.h",
272 "win/dxgi_texture_staging.cc",
273 "win/dxgi_texture_staging.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000274 "win/scoped_gdi_object.h",
275 "win/scoped_thread_desktop.cc",
276 "win/scoped_thread_desktop.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200277 "win/screen_capture_utils.cc",
278 "win/screen_capture_utils.h",
zijiehe2970c2a2016-05-20 22:08:00 -0700279 "win/screen_capturer_win_directx.cc",
280 "win/screen_capturer_win_directx.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000281 "win/screen_capturer_win_gdi.cc",
282 "win/screen_capturer_win_gdi.h",
283 "win/screen_capturer_win_magnifier.cc",
284 "win/screen_capturer_win_magnifier.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000285 "win/window_capture_utils.cc",
286 "win/window_capture_utils.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000287 "window_capturer_win.cc",
Zijie He70fbbad2017-08-15 15:45:00 -0700288 "window_finder.h",
289 "window_finder_mac.h",
290 "window_finder_mac.mm",
291 "window_finder_win.cc",
292 "window_finder_win.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000293 ]
294
295 if (use_x11) {
296 sources += [
297 "mouse_cursor_monitor_x11.cc",
298 "screen_capturer_x11.cc",
299 "window_capturer_x11.cc",
Zijie He70fbbad2017-08-15 15:45:00 -0700300 "window_finder_x11.cc",
301 "window_finder_x11.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000302 "x11/shared_x_display.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200303 "x11/shared_x_display.h",
Zijie Head501d12017-08-10 11:58:34 -0700304 "x11/window_list_utils.cc",
305 "x11/window_list_utils.h",
306 "x11/x_atom_cache.cc",
307 "x11/x_atom_cache.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000308 "x11/x_error_trap.cc",
309 "x11/x_error_trap.h",
310 "x11/x_server_pixel_buffer.cc",
311 "x11/x_server_pixel_buffer.h",
312 ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200313 configs += [ "//build/config/linux:x11" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000314 }
315
316 if (!is_win && !is_mac && !use_x11) {
317 sources += [
318 "mouse_cursor_monitor_null.cc",
319 "screen_capturer_null.cc",
320 "window_capturer_null.cc",
321 ]
322 }
323
zijiehe2970c2a2016-05-20 22:08:00 -0700324 if (is_win) {
zijiehe2d618de2016-08-08 17:50:21 -0700325 libs = [
326 "d3d11.lib",
327 "dxgi.lib",
328 ]
zijiehe2970c2a2016-05-20 22:08:00 -0700329 }
330
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000331 deps = [
Sergey Ulanov098c1de2015-09-01 11:36:40 -0700332 ":primitives",
mbonadeif4235932016-12-29 03:35:56 -0800333 "../..:webrtc_common",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700334 "../../rtc_base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000335 "../../system_wrappers",
zijiehe90ea7362016-11-22 17:17:09 -0800336 "//third_party/libyuv",
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000337 ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000338
339 if (use_desktop_capture_differ_sse2) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200340 deps += [ ":desktop_capture_differ_sse2" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000341 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000342}
343
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000344if (use_desktop_capture_differ_sse2) {
345 # Have to be compiled as a separate target because it needs to be compiled
346 # with SSE2 enabled.
kjellanderb62dbbe2016-09-23 00:38:52 -0700347 rtc_static_library("desktop_capture_differ_sse2") {
brettw@chromium.org0867f692014-09-10 16:24:11 +0000348 visibility = [ ":*" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000349 sources = [
zijiehefef86532016-09-05 15:26:32 -0700350 "differ_vector_sse2.cc",
351 "differ_vector_sse2.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000352 ]
353
ehmaldonado90920d52016-08-16 04:13:01 -0700354 if (is_posix) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200355 cflags = [ "-msse2" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000356 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000357 }
358}