OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/media/capture/web_contents_video_capture_device.h" | 5 #include "content/browser/media/capture/web_contents_video_capture_device.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/debug/debugger.h" | 13 #include "base/debug/debugger.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
17 #include "base/test/test_timeouts.h" | 17 #include "base/test/test_timeouts.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "base/timer/timer.h" | 19 #include "base/timer/timer.h" |
20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
21 #include "content/browser/browser_thread_impl.h" | 21 #include "content/browser/browser_thread_impl.h" |
22 #include "content/browser/frame_host/render_frame_host_impl.h" | 22 #include "content/browser/frame_host/render_frame_host_impl.h" |
23 #include "content/browser/renderer_host/media/video_capture_buffer_tracker_facto
ry_impl.h" | |
24 #include "content/browser/renderer_host/render_view_host_factory.h" | 23 #include "content/browser/renderer_host/render_view_host_factory.h" |
25 #include "content/browser/renderer_host/render_widget_host_impl.h" | 24 #include "content/browser/renderer_host/render_widget_host_impl.h" |
26 #include "content/browser/web_contents/web_contents_impl.h" | 25 #include "content/browser/web_contents/web_contents_impl.h" |
27 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 26 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
28 #include "content/public/browser/web_contents_media_capture_id.h" | 27 #include "content/public/browser/web_contents_media_capture_id.h" |
29 #include "content/public/test/mock_render_process_host.h" | 28 #include "content/public/test/mock_render_process_host.h" |
30 #include "content/public/test/test_browser_context.h" | 29 #include "content/public/test/test_browser_context.h" |
31 #include "content/public/test/test_browser_thread_bundle.h" | 30 #include "content/public/test/test_browser_thread_bundle.h" |
32 #include "content/public/test/test_utils.h" | 31 #include "content/public/test/test_utils.h" |
33 #include "content/test/test_render_frame_host_factory.h" | 32 #include "content/test/test_render_frame_host_factory.h" |
34 #include "content/test/test_render_view_host.h" | 33 #include "content/test/test_render_view_host.h" |
35 #include "content/test/test_web_contents.h" | 34 #include "content/test/test_web_contents.h" |
36 #include "media/base/video_frame.h" | 35 #include "media/base/video_frame.h" |
37 #include "media/base/video_util.h" | 36 #include "media/base/video_util.h" |
38 #include "media/base/yuv_convert.h" | 37 #include "media/base/yuv_convert.h" |
39 #include "media/capture/video/video_capture_buffer_pool_impl.h" | 38 #include "media/capture/video/video_capture_buffer_pool_impl.h" |
| 39 #include "media/capture/video/video_capture_buffer_tracker_factory_impl.h" |
40 #include "media/capture/video_capture_types.h" | 40 #include "media/capture/video_capture_types.h" |
41 #include "skia/ext/platform_canvas.h" | 41 #include "skia/ext/platform_canvas.h" |
42 #include "testing/gmock/include/gmock/gmock.h" | 42 #include "testing/gmock/include/gmock/gmock.h" |
43 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
44 #include "third_party/skia/include/core/SkColor.h" | 44 #include "third_party/skia/include/core/SkColor.h" |
45 #include "ui/base/layout.h" | 45 #include "ui/base/layout.h" |
46 #include "ui/display/display.h" | 46 #include "ui/display/display.h" |
47 #include "ui/display/screen.h" | 47 #include "ui/display/screen.h" |
48 #include "ui/display/test/test_screen.h" | 48 #include "ui/display/test/test_screen.h" |
49 #include "ui/gfx/geometry/dip_util.h" | 49 #include "ui/gfx/geometry/dip_util.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // A stub consumer of captured video frames, which checks the output of | 327 // A stub consumer of captured video frames, which checks the output of |
328 // WebContentsVideoCaptureDevice. | 328 // WebContentsVideoCaptureDevice. |
329 class StubClient : public media::VideoCaptureDevice::Client { | 329 class StubClient : public media::VideoCaptureDevice::Client { |
330 public: | 330 public: |
331 StubClient( | 331 StubClient( |
332 const base::Callback<void(SkColor, const gfx::Size&)>& report_callback, | 332 const base::Callback<void(SkColor, const gfx::Size&)>& report_callback, |
333 const base::Closure& error_callback) | 333 const base::Closure& error_callback) |
334 : report_callback_(report_callback), | 334 : report_callback_(report_callback), |
335 error_callback_(error_callback) { | 335 error_callback_(error_callback) { |
336 buffer_pool_ = new media::VideoCaptureBufferPoolImpl( | 336 buffer_pool_ = new media::VideoCaptureBufferPoolImpl( |
337 base::MakeUnique<VideoCaptureBufferTrackerFactoryImpl>(), 2); | 337 base::MakeUnique<media::VideoCaptureBufferTrackerFactoryImpl>(), 2); |
338 } | 338 } |
339 ~StubClient() override {} | 339 ~StubClient() override {} |
340 | 340 |
341 MOCK_METHOD6(OnIncomingCapturedData, | 341 MOCK_METHOD6(OnIncomingCapturedData, |
342 void(const uint8_t* data, | 342 void(const uint8_t* data, |
343 int length, | 343 int length, |
344 const media::VideoCaptureFormat& frame_format, | 344 const media::VideoCaptureFormat& frame_format, |
345 int rotation, | 345 int rotation, |
346 base::TimeTicks reference_time, | 346 base::TimeTicks reference_time, |
347 base::TimeDelta timestamp)); | 347 base::TimeDelta timestamp)); |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 for (int i = 0; i < 3; ++i) { | 1263 for (int i = 0; i < 3; ++i) { |
1264 SimulateRefreshFrameRequest(); | 1264 SimulateRefreshFrameRequest(); |
1265 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); | 1265 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); |
1266 } | 1266 } |
1267 | 1267 |
1268 device()->StopAndDeAllocate(); | 1268 device()->StopAndDeAllocate(); |
1269 } | 1269 } |
1270 | 1270 |
1271 } // namespace | 1271 } // namespace |
1272 } // namespace content | 1272 } // namespace content |
OLD | NEW |