| 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> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "content/public/browser/web_contents_media_capture_id.h" | 27 #include "content/public/browser/web_contents_media_capture_id.h" |
| 28 #include "content/public/test/mock_render_process_host.h" | 28 #include "content/public/test/mock_render_process_host.h" |
| 29 #include "content/public/test/test_browser_context.h" | 29 #include "content/public/test/test_browser_context.h" |
| 30 #include "content/public/test/test_browser_thread_bundle.h" | 30 #include "content/public/test/test_browser_thread_bundle.h" |
| 31 #include "content/public/test/test_utils.h" | 31 #include "content/public/test/test_utils.h" |
| 32 #include "content/test/test_render_frame_host_factory.h" | 32 #include "content/test/test_render_frame_host_factory.h" |
| 33 #include "content/test/test_render_view_host.h" | 33 #include "content/test/test_render_view_host.h" |
| 34 #include "content/test/test_web_contents.h" | 34 #include "content/test/test_web_contents.h" |
| 35 #include "media/base/video_frame.h" | 35 #include "media/base/video_frame.h" |
| 36 #include "media/base/video_util.h" | 36 #include "media/base/video_util.h" |
| 37 #include "media/base/yuv_convert.h" | |
| 38 #include "media/capture/video/video_capture_buffer_pool_impl.h" | 37 #include "media/capture/video/video_capture_buffer_pool_impl.h" |
| 39 #include "media/capture/video/video_capture_buffer_tracker_factory_impl.h" | 38 #include "media/capture/video/video_capture_buffer_tracker_factory_impl.h" |
| 40 #include "media/capture/video/video_capture_device_client.h" | 39 #include "media/capture/video/video_capture_device_client.h" |
| 41 #include "media/capture/video_capture_types.h" | 40 #include "media/capture/video_capture_types.h" |
| 42 #include "skia/ext/platform_canvas.h" | 41 #include "skia/ext/platform_canvas.h" |
| 43 #include "testing/gmock/include/gmock/gmock.h" | 42 #include "testing/gmock/include/gmock/gmock.h" |
| 44 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
| 44 #include "third_party/libyuv/include/libyuv.h" |
| 45 #include "third_party/skia/include/core/SkColor.h" | 45 #include "third_party/skia/include/core/SkColor.h" |
| 46 #include "ui/base/layout.h" | 46 #include "ui/base/layout.h" |
| 47 #include "ui/display/display.h" | 47 #include "ui/display/display.h" |
| 48 #include "ui/display/screen.h" | 48 #include "ui/display/screen.h" |
| 49 #include "ui/display/test/test_screen.h" | 49 #include "ui/display/test/test_screen.h" |
| 50 #include "ui/gfx/geometry/dip_util.h" | 50 #include "ui/gfx/geometry/dip_util.h" |
| 51 #include "ui/gfx/geometry/size_conversions.h" | 51 #include "ui/gfx/geometry/size_conversions.h" |
| 52 | 52 |
| 53 namespace content { | 53 namespace content { |
| 54 namespace { | 54 namespace { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 78 deadline.Start( | 78 deadline.Start( |
| 79 FROM_HERE, TestTimeouts::action_max_timeout(), | 79 FROM_HERE, TestTimeouts::action_max_timeout(), |
| 80 base::Bind(&DeadlineExceeded, | 80 base::Bind(&DeadlineExceeded, |
| 81 base::MessageLoop::current()->QuitWhenIdleClosure())); | 81 base::MessageLoop::current()->QuitWhenIdleClosure())); |
| 82 base::RunLoop().Run(); | 82 base::RunLoop().Run(); |
| 83 deadline.Stop(); | 83 deadline.Stop(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 SkColor ConvertRgbToYuv(SkColor rgb) { | 86 SkColor ConvertRgbToYuv(SkColor rgb) { |
| 87 uint8_t yuv[3]; | 87 uint8_t yuv[3]; |
| 88 media::ConvertRGB32ToYUV(reinterpret_cast<uint8_t*>(&rgb), yuv, yuv + 1, | 88 libyuv::ARGBToI420(reinterpret_cast<uint8_t*>(&rgb), 1, yuv, 1, yuv + 1, 1, |
| 89 yuv + 2, 1, 1, 1, 1, 1); | 89 yuv + 2, 1, 1, 1); |
| 90 return SkColorSetRGB(yuv[0], yuv[1], yuv[2]); | 90 return SkColorSetRGB(yuv[0], yuv[1], yuv[2]); |
| 91 } | 91 } |
| 92 | 92 |
| 93 media::VideoCaptureParams DefaultCaptureParams() { | 93 media::VideoCaptureParams DefaultCaptureParams() { |
| 94 media::VideoCaptureParams capture_params; | 94 media::VideoCaptureParams capture_params; |
| 95 capture_params.requested_format.frame_size.SetSize(kTestWidth, kTestHeight); | 95 capture_params.requested_format.frame_size.SetSize(kTestWidth, kTestHeight); |
| 96 capture_params.requested_format.frame_rate = kTestFramesPerSecond; | 96 capture_params.requested_format.frame_rate = kTestFramesPerSecond; |
| 97 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; | 97 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; |
| 98 return capture_params; | 98 return capture_params; |
| 99 } | 99 } |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 for (int i = 0; i < 3; ++i) { | 1009 for (int i = 0; i < 3; ++i) { |
| 1010 SimulateRefreshFrameRequest(); | 1010 SimulateRefreshFrameRequest(); |
| 1011 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); | 1011 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 device()->StopAndDeAllocate(); | 1014 device()->StopAndDeAllocate(); |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 } // namespace | 1017 } // namespace |
| 1018 } // namespace content | 1018 } // namespace content |
| OLD | NEW |