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 <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
19 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
20 #include "base/task_runner_util.h" | 20 #include "base/task_runner_util.h" |
21 #include "base/thread_task_runner_handle.h" | 21 #include "base/thread_task_runner_handle.h" |
22 #include "base/threading/sequenced_worker_pool.h" | 22 #include "base/threading/sequenced_worker_pool.h" |
23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 24 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" |
24 #include "content/browser/media/capture/web_contents_video_capture_device.h" | 25 #include "content/browser/media/capture/web_contents_video_capture_device.h" |
25 #include "content/browser/media/media_internals.h" | 26 #include "content/browser/media/media_internals.h" |
26 #include "content/browser/renderer_host/media/video_capture_controller.h" | 27 #include "content/browser/renderer_host/media/video_capture_controller.h" |
27 #include "content/browser/renderer_host/media/video_capture_controller_event_han
dler.h" | 28 #include "content/browser/renderer_host/media/video_capture_controller_event_han
dler.h" |
28 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
29 #include "content/public/browser/desktop_media_id.h" | 30 #include "content/public/browser/desktop_media_id.h" |
30 #include "content/public/common/media_stream_request.h" | 31 #include "content/public/common/media_stream_request.h" |
31 #include "media/base/bind_to_current_loop.h" | 32 #include "media/base/bind_to_current_loop.h" |
32 #include "media/base/media_switches.h" | 33 #include "media/base/media_switches.h" |
33 #include "media/capture/video/video_capture_device.h" | 34 #include "media/capture/video/video_capture_device.h" |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 scoped_ptr<media::VideoCaptureDevice> video_capture_device; | 518 scoped_ptr<media::VideoCaptureDevice> video_capture_device; |
518 #if defined(ENABLE_SCREEN_CAPTURE) | 519 #if defined(ENABLE_SCREEN_CAPTURE) |
519 DesktopMediaID desktop_id = DesktopMediaID::Parse(id); | 520 DesktopMediaID desktop_id = DesktopMediaID::Parse(id); |
520 if (desktop_id.is_null()) { | 521 if (desktop_id.is_null()) { |
521 device_client->OnError(FROM_HERE, "Desktop media ID is null"); | 522 device_client->OnError(FROM_HERE, "Desktop media ID is null"); |
522 return nullptr; | 523 return nullptr; |
523 } | 524 } |
524 | 525 |
525 if (desktop_id.type == DesktopMediaID::TYPE_WEB_CONTENTS) { | 526 if (desktop_id.type == DesktopMediaID::TYPE_WEB_CONTENTS) { |
526 video_capture_device.reset(WebContentsVideoCaptureDevice::Create(id)); | 527 video_capture_device.reset(WebContentsVideoCaptureDevice::Create(id)); |
| 528 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED); |
527 } else { | 529 } else { |
528 #if defined(USE_AURA) | 530 #if defined(USE_AURA) |
529 video_capture_device = DesktopCaptureDeviceAura::Create(desktop_id); | 531 video_capture_device = DesktopCaptureDeviceAura::Create(desktop_id); |
530 #endif | 532 #endif |
531 if (!video_capture_device) | 533 if (!video_capture_device) |
532 video_capture_device = DesktopCaptureDevice::Create(desktop_id); | 534 video_capture_device = DesktopCaptureDevice::Create(desktop_id); |
533 } | 535 } |
534 #endif // defined(ENABLE_SCREEN_CAPTURE) | 536 #endif // defined(ENABLE_SCREEN_CAPTURE) |
535 | 537 |
536 if (!video_capture_device) { | 538 if (!video_capture_device) { |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 977 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
976 BrowserThread::PostTaskAndReply( | 978 BrowserThread::PostTaskAndReply( |
977 BrowserThread::UI, FROM_HERE, | 979 BrowserThread::UI, FROM_HERE, |
978 base::Bind(&AVFoundationGlue::InitializeAVFoundation), | 980 base::Bind(&AVFoundationGlue::InitializeAVFoundation), |
979 base::Bind(&VideoCaptureManager::OnDeviceLayerInitialized, this, | 981 base::Bind(&VideoCaptureManager::OnDeviceLayerInitialized, this, |
980 and_then)); | 982 and_then)); |
981 } | 983 } |
982 #endif | 984 #endif |
983 | 985 |
984 } // namespace content | 986 } // namespace content |
OLD | NEW |