| 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/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/desktop_media_id.h" | 24 #include "content/public/browser/desktop_media_id.h" |
| 25 #include "content/public/browser/power_save_blocker.h" | 25 #include "content/public/browser/power_save_blocker_factory.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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 DCHECK(client); | 163 DCHECK(client); |
| 164 DCHECK(!client_); | 164 DCHECK(!client_); |
| 165 | 165 |
| 166 client_ = std::move(client); | 166 client_ = std::move(client); |
| 167 requested_frame_rate_ = params.requested_format.frame_rate; | 167 requested_frame_rate_ = params.requested_format.frame_rate; |
| 168 resolution_chooser_.reset(new media::CaptureResolutionChooser( | 168 resolution_chooser_.reset(new media::CaptureResolutionChooser( |
| 169 params.requested_format.frame_size, | 169 params.requested_format.frame_size, |
| 170 params.resolution_change_policy)); | 170 params.resolution_change_policy)); |
| 171 | 171 |
| 172 power_save_blocker_.reset( | 172 power_save_blocker_.reset( |
| 173 PowerSaveBlocker::Create( | 173 CreatePowerSaveBlocker( |
| 174 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 174 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
| 175 PowerSaveBlocker::kReasonOther, | 175 PowerSaveBlocker::kReasonOther, "DesktopCaptureDevice is running") |
| 176 "DesktopCaptureDevice is running").release()); | 176 .release()); |
| 177 | 177 |
| 178 desktop_capturer_->Start(this); | 178 desktop_capturer_->Start(this); |
| 179 | 179 |
| 180 CaptureFrameAndScheduleNext(); | 180 CaptureFrameAndScheduleNext(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void DesktopCaptureDevice::Core::SetNotificationWindowId( | 183 void DesktopCaptureDevice::Core::SetNotificationWindowId( |
| 184 gfx::NativeViewId window_id) { | 184 gfx::NativeViewId window_id) { |
| 185 DCHECK(task_runner_->BelongsToCurrentThread()); | 185 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 186 DCHECK(window_id); | 186 DCHECK(window_id); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 #else | 449 #else |
| 450 base::MessageLoop::Type thread_type = base::MessageLoop::TYPE_DEFAULT; | 450 base::MessageLoop::Type thread_type = base::MessageLoop::TYPE_DEFAULT; |
| 451 #endif | 451 #endif |
| 452 | 452 |
| 453 thread_.StartWithOptions(base::Thread::Options(thread_type, 0)); | 453 thread_.StartWithOptions(base::Thread::Options(thread_type, 0)); |
| 454 | 454 |
| 455 core_.reset(new Core(thread_.task_runner(), std::move(capturer), type)); | 455 core_.reset(new Core(thread_.task_runner(), std::move(capturer), type)); |
| 456 } | 456 } |
| 457 | 457 |
| 458 } // namespace content | 458 } // namespace content |
| OLD | NEW |