OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/desktop_capture_device.h" | 5 #include "content/browser/media/capture/desktop_capture_device.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
19 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
20 #include "base/timer/timer.h" | 20 #include "base/timer/timer.h" |
21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
22 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" | 22 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" |
23 #include "content/browser/power_save_blocker_factory.h" | |
24 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
25 #include "content/public/browser/desktop_media_id.h" | 24 #include "content/public/browser/desktop_media_id.h" |
| 25 #include "device/power_save_blocker/power_save_blocker.h" |
26 #include "media/base/video_util.h" | 26 #include "media/base/video_util.h" |
27 #include "media/capture/content/capture_resolution_chooser.h" | 27 #include "media/capture/content/capture_resolution_chooser.h" |
28 #include "third_party/libyuv/include/libyuv/scale_argb.h" | 28 #include "third_party/libyuv/include/libyuv/scale_argb.h" |
29 #include "third_party/webrtc/modules/desktop_capture/cropping_window_capturer.h" | 29 #include "third_party/webrtc/modules/desktop_capture/cropping_window_capturer.h" |
30 #include "third_party/webrtc/modules/desktop_capture/desktop_and_cursor_composer
.h" | 30 #include "third_party/webrtc/modules/desktop_capture/desktop_and_cursor_composer
.h" |
31 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" | 31 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" |
32 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" | 32 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
33 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 33 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
34 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h" | 34 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h" |
35 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 35 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 DCHECK(client); | 166 DCHECK(client); |
167 DCHECK(!client_); | 167 DCHECK(!client_); |
168 | 168 |
169 client_ = std::move(client); | 169 client_ = std::move(client); |
170 requested_frame_rate_ = params.requested_format.frame_rate; | 170 requested_frame_rate_ = params.requested_format.frame_rate; |
171 resolution_chooser_.reset(new media::CaptureResolutionChooser( | 171 resolution_chooser_.reset(new media::CaptureResolutionChooser( |
172 params.requested_format.frame_size, | 172 params.requested_format.frame_size, |
173 params.resolution_change_policy)); | 173 params.resolution_change_policy)); |
174 | 174 |
175 power_save_blocker_.reset( | 175 power_save_blocker_.reset( |
176 CreatePowerSaveBlocker( | 176 device::PowerSaveBlocker::CreateWithTaskRunners( |
177 device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 177 device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
178 device::PowerSaveBlocker::kReasonOther, | 178 device::PowerSaveBlocker::kReasonOther, |
179 "DesktopCaptureDevice is running") | 179 "DesktopCaptureDevice is running", |
| 180 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| 181 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)) |
180 .release()); | 182 .release()); |
181 | 183 |
182 desktop_capturer_->Start(this); | 184 desktop_capturer_->Start(this); |
183 | 185 |
184 CaptureFrameAndScheduleNext(); | 186 CaptureFrameAndScheduleNext(); |
185 } | 187 } |
186 | 188 |
187 void DesktopCaptureDevice::Core::SetNotificationWindowId( | 189 void DesktopCaptureDevice::Core::SetNotificationWindowId( |
188 gfx::NativeViewId window_id) { | 190 gfx::NativeViewId window_id) { |
189 DCHECK(task_runner_->BelongsToCurrentThread()); | 191 DCHECK(task_runner_->BelongsToCurrentThread()); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 #else | 458 #else |
457 base::MessageLoop::Type thread_type = base::MessageLoop::TYPE_DEFAULT; | 459 base::MessageLoop::Type thread_type = base::MessageLoop::TYPE_DEFAULT; |
458 #endif | 460 #endif |
459 | 461 |
460 thread_.StartWithOptions(base::Thread::Options(thread_type, 0)); | 462 thread_.StartWithOptions(base::Thread::Options(thread_type, 0)); |
461 | 463 |
462 core_.reset(new Core(thread_.task_runner(), std::move(capturer), type)); | 464 core_.reset(new Core(thread_.task_runner(), std::move(capturer), type)); |
463 } | 465 } |
464 | 466 |
465 } // namespace content | 467 } // namespace content |
OLD | NEW |