Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: content/browser/renderer_host/media/video_capture_browsertest.cc

Issue 2753073006: [Mojo Video Capture] Add support to BuildableVideoCaptureDevice for aborting the device start. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_manager.h" 10 #include "content/browser/renderer_host/media/video_capture_manager.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // VideoCaptureControllerEventHandler. To satisfy this, we have to post our 94 // VideoCaptureControllerEventHandler. To satisfy this, we have to post our
95 // invocation to the end of the IO message queue. 95 // invocation to the end of the IO message queue.
96 if (post_to_end_of_message_queue) { 96 if (post_to_end_of_message_queue) {
97 base::ThreadTaskRunnerHandle::Get()->PostTask( 97 base::ThreadTaskRunnerHandle::Get()->PostTask(
98 FROM_HERE, 98 FROM_HERE,
99 base::Bind(&VideoCaptureBrowserTest::TearDownCaptureDeviceOnIOThread, 99 base::Bind(&VideoCaptureBrowserTest::TearDownCaptureDeviceOnIOThread,
100 base::Unretained(this), continuation, false)); 100 base::Unretained(this), continuation, false));
101 return; 101 return;
102 } 102 }
103 103
104 video_capture_manager_->StopCaptureForClient( 104 video_capture_manager_->DisconnectClient(controller_.get(), stub_client_id_,
105 controller_.get(), stub_client_id_, &mock_controller_event_handler_, 105 &mock_controller_event_handler_,
106 false); 106 false);
107 107
108 EXPECT_CALL(mock_stream_provider_listener_, Closed(_, _)) 108 EXPECT_CALL(mock_stream_provider_listener_, Closed(_, _))
109 .WillOnce(InvokeWithoutArgs([continuation]() { continuation.Run(); })); 109 .WillOnce(InvokeWithoutArgs([continuation]() { continuation.Run(); }));
110 110
111 video_capture_manager_->Close(session_id_); 111 video_capture_manager_->Close(session_id_);
112 } 112 }
113 113
114 protected: 114 protected:
115 void SetUpCommandLine(base::CommandLine* command_line) override { 115 void SetUpCommandLine(base::CommandLine* command_line) override {
116 command_line->AppendSwitchASCII( 116 command_line->AppendSwitchASCII(
(...skipping 24 matching lines...) Expand all
141 ASSERT_TRUE(GetParam().device_index_to_use < descriptors.size()); 141 ASSERT_TRUE(GetParam().device_index_to_use < descriptors.size());
142 const auto& descriptor = descriptors[GetParam().device_index_to_use]; 142 const auto& descriptor = descriptors[GetParam().device_index_to_use];
143 MediaStreamDevice media_stream_device( 143 MediaStreamDevice media_stream_device(
144 MEDIA_DEVICE_VIDEO_CAPTURE, descriptor.device_id, 144 MEDIA_DEVICE_VIDEO_CAPTURE, descriptor.device_id,
145 descriptor.display_name, descriptor.facing); 145 descriptor.display_name, descriptor.facing);
146 session_id_ = video_capture_manager_->Open(media_stream_device); 146 session_id_ = video_capture_manager_->Open(media_stream_device);
147 media::VideoCaptureParams capture_params; 147 media::VideoCaptureParams capture_params;
148 capture_params.requested_format = media::VideoCaptureFormat( 148 capture_params.requested_format = media::VideoCaptureFormat(
149 GetParam().resolution_to_use, GetParam().frame_rate_to_use, 149 GetParam().resolution_to_use, GetParam().frame_rate_to_use,
150 GetParam().pixel_format_to_use); 150 GetParam().pixel_format_to_use);
151 video_capture_manager_->StartCaptureForClient( 151 video_capture_manager_->ConnectClient(
152 session_id_, capture_params, stub_client_id_, 152 session_id_, capture_params, stub_client_id_,
153 &mock_controller_event_handler_, 153 &mock_controller_event_handler_,
154 base::Bind(&VideoCaptureBrowserTest::OnConnectClientToControllerAnswer, 154 base::Bind(&VideoCaptureBrowserTest::OnConnectClientToControllerAnswer,
155 base::Unretained(this), std::move(continuation))); 155 base::Unretained(this), std::move(continuation)));
156 } 156 }
157 157
158 void OnConnectClientToControllerAnswer( 158 void OnConnectClientToControllerAnswer(
159 base::Closure continuation, 159 base::Closure continuation,
160 const base::WeakPtr<VideoCaptureController>& controller) { 160 const base::WeakPtr<VideoCaptureController>& controller) {
161 ASSERT_TRUE(controller.get()); 161 ASSERT_TRUE(controller.get());
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 gfx::Size(1280, 720), 25.0f, false}, 274 gfx::Size(1280, 720), 25.0f, false},
275 TestParams{"fps=15,device-count=2", 1, media::PIXEL_FORMAT_Y16, 275 TestParams{"fps=15,device-count=2", 1, media::PIXEL_FORMAT_Y16,
276 gfx::Size(640, 480), 15.0f, false}, 276 gfx::Size(640, 480), 15.0f, false},
277 // The 3rd device outputs MJPEG, which is converted to I420. 277 // The 3rd device outputs MJPEG, which is converted to I420.
278 TestParams{"fps=15,device-count=3", 2, media::PIXEL_FORMAT_I420, 278 TestParams{"fps=15,device-count=3", 2, media::PIXEL_FORMAT_I420,
279 gfx::Size(640, 480), 25.0f, false}, 279 gfx::Size(640, 480), 25.0f, false},
280 TestParams{"fps=6,device-count=3", 2, media::PIXEL_FORMAT_I420, 280 TestParams{"fps=6,device-count=3", 2, media::PIXEL_FORMAT_I420,
281 gfx::Size(640, 480), 6.0f, true})); 281 gfx::Size(640, 480), 6.0f, true}));
282 282
283 } // namespace content 283 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698