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/renderer_host/media/video_capture_manager.h" | 5 #include "content/browser/renderer_host/media/video_capture_manager.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 253 } |
254 | 254 |
255 void VideoCaptureManager::OnStart( | 255 void VideoCaptureManager::OnStart( |
256 const media::VideoCaptureParams capture_params, | 256 const media::VideoCaptureParams capture_params, |
257 media::VideoCaptureDevice::EventHandler* video_capture_receiver) { | 257 media::VideoCaptureDevice::EventHandler* video_capture_receiver) { |
258 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.OnStartTime"); | 258 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.OnStartTime"); |
259 DCHECK(IsOnDeviceThread()); | 259 DCHECK(IsOnDeviceThread()); |
260 DCHECK(video_capture_receiver != NULL); | 260 DCHECK(video_capture_receiver != NULL); |
261 DVLOG(1) << "VideoCaptureManager::OnStart, (" << capture_params.width | 261 DVLOG(1) << "VideoCaptureManager::OnStart, (" << capture_params.width |
262 << ", " << capture_params.height | 262 << ", " << capture_params.height |
263 << ", " << capture_params.frame_per_second | 263 << ", " << capture_params.frame_rate |
264 << ", " << capture_params.session_id | 264 << ", " << capture_params.session_id |
265 << ")"; | 265 << ")"; |
266 | 266 |
267 media::VideoCaptureDevice* video_capture_device = | 267 media::VideoCaptureDevice* video_capture_device = |
268 GetDeviceInternal(capture_params.session_id); | 268 GetDeviceInternal(capture_params.session_id); |
269 if (!video_capture_device) { | 269 if (!video_capture_device) { |
270 // Invalid session id. | 270 // Invalid session id. |
271 video_capture_receiver->OnError(); | 271 video_capture_receiver->OnError(); |
272 return; | 272 return; |
273 } | 273 } |
274 // TODO(mcasas): Variable resolution video capture devices, are not yet | 274 // TODO(mcasas): Variable resolution video capture devices, are not yet |
275 // fully supported, see crbug.com/261410, second part, and crbug.com/266082 . | 275 // fully supported, see crbug.com/261410, second part, and crbug.com/266082 . |
276 if (capture_params.frame_size_type != | 276 if (capture_params.frame_size_type != |
277 media::ConstantResolutionVideoCaptureDevice) { | 277 media::ConstantResolutionVideoCaptureDevice) { |
278 LOG(DFATAL) << "Only constant Video Capture resolution device supported."; | 278 LOG(DFATAL) << "Only constant Video Capture resolution device supported."; |
279 video_capture_receiver->OnError(); | 279 video_capture_receiver->OnError(); |
280 return; | 280 return; |
281 } | 281 } |
282 Controllers::iterator cit = controllers_.find(video_capture_device); | 282 Controllers::iterator cit = controllers_.find(video_capture_device); |
283 if (cit != controllers_.end()) { | 283 if (cit != controllers_.end()) { |
284 cit->second->ready_to_delete = false; | 284 cit->second->ready_to_delete = false; |
285 } | 285 } |
286 | 286 |
287 // Possible errors are signaled to video_capture_receiver by | 287 // Possible errors are signaled to video_capture_receiver by |
288 // video_capture_device. video_capture_receiver to perform actions. | 288 // video_capture_device. video_capture_receiver to perform actions. |
289 media::VideoCaptureCapability params_as_capability_copy; | 289 media::VideoCaptureCapability params_as_capability_copy; |
290 params_as_capability_copy.width = capture_params.width; | 290 params_as_capability_copy.width = capture_params.width; |
291 params_as_capability_copy.height = capture_params.height; | 291 params_as_capability_copy.height = capture_params.height; |
292 params_as_capability_copy.frame_rate = capture_params.frame_per_second; | 292 params_as_capability_copy.frame_rate = capture_params.frame_rate; |
293 params_as_capability_copy.session_id = capture_params.session_id; | 293 params_as_capability_copy.session_id = capture_params.session_id; |
294 params_as_capability_copy.frame_size_type = capture_params.frame_size_type; | 294 params_as_capability_copy.frame_size_type = capture_params.frame_size_type; |
295 video_capture_device->Allocate(params_as_capability_copy, | 295 video_capture_device->Allocate(params_as_capability_copy, |
296 video_capture_receiver); | 296 video_capture_receiver); |
297 video_capture_device->Start(); | 297 video_capture_device->Start(); |
298 } | 298 } |
299 | 299 |
300 void VideoCaptureManager::OnStop( | 300 void VideoCaptureManager::OnStop( |
301 const media::VideoCaptureSessionId capture_session_id, | 301 const media::VideoCaptureSessionId capture_session_id, |
302 base::Closure stopped_cb) { | 302 base::Closure stopped_cb) { |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 584 |
585 VideoCaptureDevices::iterator dit = devices_.find(capture_session_id); | 585 VideoCaptureDevices::iterator dit = devices_.find(capture_session_id); |
586 if (dit != devices_.end()) { | 586 if (dit != devices_.end()) { |
587 return dit->second.capture_device; | 587 return dit->second.capture_device; |
588 } | 588 } |
589 } | 589 } |
590 return NULL; | 590 return NULL; |
591 } | 591 } |
592 | 592 |
593 } // namespace content | 593 } // namespace content |
OLD | NEW |