| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "content/browser/browser_main_loop.h" | 8 #include "content/browser/browser_main_loop.h" |
| 9 #include "content/browser/renderer_host/media/media_stream_manager.h" | 9 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 10 #include "content/browser/renderer_host/media/video_capture_controller.h" | 10 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // VideoCaptureControllerEventHandler. To satisfy this, we have to post our | 95 // VideoCaptureControllerEventHandler. To satisfy this, we have to post our |
| 96 // invocation to the end of the IO message queue. | 96 // invocation to the end of the IO message queue. |
| 97 if (post_to_end_of_message_queue) { | 97 if (post_to_end_of_message_queue) { |
| 98 base::ThreadTaskRunnerHandle::Get()->PostTask( | 98 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 99 FROM_HERE, | 99 FROM_HERE, |
| 100 base::Bind(&VideoCaptureBrowserTest::TearDownCaptureDeviceOnIOThread, | 100 base::Bind(&VideoCaptureBrowserTest::TearDownCaptureDeviceOnIOThread, |
| 101 base::Unretained(this), continuation, false)); | 101 base::Unretained(this), continuation, false)); |
| 102 return; | 102 return; |
| 103 } | 103 } |
| 104 | 104 |
| 105 video_capture_manager_->StopCaptureForClient( | 105 video_capture_manager_->DisconnectClient(controller_.get(), stub_client_id_, |
| 106 controller_.get(), stub_client_id_, &mock_controller_event_handler_, | 106 &mock_controller_event_handler_, |
| 107 false); | 107 false); |
| 108 | 108 |
| 109 EXPECT_CALL(mock_stream_provider_listener_, Closed(_, _)) | 109 EXPECT_CALL(mock_stream_provider_listener_, Closed(_, _)) |
| 110 .WillOnce(InvokeWithoutArgs([continuation]() { continuation.Run(); })); | 110 .WillOnce(InvokeWithoutArgs([continuation]() { continuation.Run(); })); |
| 111 | 111 |
| 112 video_capture_manager_->Close(session_id_); | 112 video_capture_manager_->Close(session_id_); |
| 113 } | 113 } |
| 114 | 114 |
| 115 protected: | 115 protected: |
| 116 void SetUpCommandLine(base::CommandLine* command_line) override { | 116 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 117 command_line->AppendSwitchASCII( | 117 command_line->AppendSwitchASCII( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 142 ASSERT_TRUE(GetParam().device_index_to_use < descriptors.size()); | 142 ASSERT_TRUE(GetParam().device_index_to_use < descriptors.size()); |
| 143 const auto& descriptor = descriptors[GetParam().device_index_to_use]; | 143 const auto& descriptor = descriptors[GetParam().device_index_to_use]; |
| 144 MediaStreamDevice media_stream_device( | 144 MediaStreamDevice media_stream_device( |
| 145 MEDIA_DEVICE_VIDEO_CAPTURE, descriptor.device_id, | 145 MEDIA_DEVICE_VIDEO_CAPTURE, descriptor.device_id, |
| 146 descriptor.display_name, descriptor.facing); | 146 descriptor.display_name, descriptor.facing); |
| 147 session_id_ = video_capture_manager_->Open(media_stream_device); | 147 session_id_ = video_capture_manager_->Open(media_stream_device); |
| 148 media::VideoCaptureParams capture_params; | 148 media::VideoCaptureParams capture_params; |
| 149 capture_params.requested_format = media::VideoCaptureFormat( | 149 capture_params.requested_format = media::VideoCaptureFormat( |
| 150 GetParam().resolution_to_use, GetParam().frame_rate_to_use, | 150 GetParam().resolution_to_use, GetParam().frame_rate_to_use, |
| 151 GetParam().pixel_format_to_use); | 151 GetParam().pixel_format_to_use); |
| 152 video_capture_manager_->StartCaptureForClient( | 152 video_capture_manager_->ConnectClient( |
| 153 session_id_, capture_params, stub_client_id_, | 153 session_id_, capture_params, stub_client_id_, |
| 154 &mock_controller_event_handler_, | 154 &mock_controller_event_handler_, |
| 155 base::Bind(&VideoCaptureBrowserTest::OnConnectClientToControllerAnswer, | 155 base::Bind(&VideoCaptureBrowserTest::OnConnectClientToControllerAnswer, |
| 156 base::Unretained(this), std::move(continuation))); | 156 base::Unretained(this), std::move(continuation))); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void OnConnectClientToControllerAnswer( | 159 void OnConnectClientToControllerAnswer( |
| 160 base::Closure continuation, | 160 base::Closure continuation, |
| 161 const base::WeakPtr<VideoCaptureController>& controller) { | 161 const base::WeakPtr<VideoCaptureController>& controller) { |
| 162 ASSERT_TRUE(controller.get()); | 162 ASSERT_TRUE(controller.get()); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 gfx::Size(1280, 720), 25.0f, false}, | 280 gfx::Size(1280, 720), 25.0f, false}, |
| 281 TestParams{"fps=15,device-count=2", 1, media::PIXEL_FORMAT_Y16, | 281 TestParams{"fps=15,device-count=2", 1, media::PIXEL_FORMAT_Y16, |
| 282 gfx::Size(640, 480), 15.0f, false}, | 282 gfx::Size(640, 480), 15.0f, false}, |
| 283 // The 3rd device outputs MJPEG, which is converted to I420. | 283 // The 3rd device outputs MJPEG, which is converted to I420. |
| 284 TestParams{"fps=15,device-count=3", 2, media::PIXEL_FORMAT_I420, | 284 TestParams{"fps=15,device-count=3", 2, media::PIXEL_FORMAT_I420, |
| 285 gfx::Size(640, 480), 25.0f, false}, | 285 gfx::Size(640, 480), 25.0f, false}, |
| 286 TestParams{"fps=6,device-count=3", 2, media::PIXEL_FORMAT_I420, | 286 TestParams{"fps=6,device-count=3", 2, media::PIXEL_FORMAT_I420, |
| 287 gfx::Size(640, 480), 6.0f, true})); | 287 gfx::Size(640, 480), 6.0f, true})); |
| 288 | 288 |
| 289 } // namespace content | 289 } // namespace content |
| OLD | NEW |