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> |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // The type of the capturer. | 126 // The type of the capturer. |
127 DesktopMediaID::Type capturer_type_; | 127 DesktopMediaID::Type capturer_type_; |
128 | 128 |
129 // The system time when we receive the first frame. | 129 // The system time when we receive the first frame. |
130 base::TimeTicks first_ref_time_; | 130 base::TimeTicks first_ref_time_; |
131 | 131 |
132 std::unique_ptr<webrtc::BasicDesktopFrame> black_frame_; | 132 std::unique_ptr<webrtc::BasicDesktopFrame> black_frame_; |
133 | 133 |
134 // TODO(jiayl): Remove power_save_blocker_ when there is an API to keep the | 134 // TODO(jiayl): Remove power_save_blocker_ when there is an API to keep the |
135 // screen from sleeping for the drive-by web. | 135 // screen from sleeping for the drive-by web. |
136 std::unique_ptr<PowerSaveBlocker> power_save_blocker_; | 136 std::unique_ptr<device::PowerSaveBlocker> power_save_blocker_; |
137 | 137 |
138 DISALLOW_COPY_AND_ASSIGN(Core); | 138 DISALLOW_COPY_AND_ASSIGN(Core); |
139 }; | 139 }; |
140 | 140 |
141 DesktopCaptureDevice::Core::Core( | 141 DesktopCaptureDevice::Core::Core( |
142 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 142 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
143 std::unique_ptr<webrtc::DesktopCapturer> capturer, | 143 std::unique_ptr<webrtc::DesktopCapturer> capturer, |
144 DesktopMediaID::Type type) | 144 DesktopMediaID::Type type) |
145 : task_runner_(task_runner), | 145 : task_runner_(task_runner), |
146 desktop_capturer_(std::move(capturer)), | 146 desktop_capturer_(std::move(capturer)), |
(...skipping 20 matching lines...) Expand all Loading... |
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 CreatePowerSaveBlocker( |
177 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 177 device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
178 PowerSaveBlocker::kReasonOther, "DesktopCaptureDevice is running") | 178 device::PowerSaveBlocker::kReasonOther, |
| 179 "DesktopCaptureDevice is running") |
179 .release()); | 180 .release()); |
180 | 181 |
181 desktop_capturer_->Start(this); | 182 desktop_capturer_->Start(this); |
182 | 183 |
183 CaptureFrameAndScheduleNext(); | 184 CaptureFrameAndScheduleNext(); |
184 } | 185 } |
185 | 186 |
186 void DesktopCaptureDevice::Core::SetNotificationWindowId( | 187 void DesktopCaptureDevice::Core::SetNotificationWindowId( |
187 gfx::NativeViewId window_id) { | 188 gfx::NativeViewId window_id) { |
188 DCHECK(task_runner_->BelongsToCurrentThread()); | 189 DCHECK(task_runner_->BelongsToCurrentThread()); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 #else | 456 #else |
456 base::MessageLoop::Type thread_type = base::MessageLoop::TYPE_DEFAULT; | 457 base::MessageLoop::Type thread_type = base::MessageLoop::TYPE_DEFAULT; |
457 #endif | 458 #endif |
458 | 459 |
459 thread_.StartWithOptions(base::Thread::Options(thread_type, 0)); | 460 thread_.StartWithOptions(base::Thread::Options(thread_type, 0)); |
460 | 461 |
461 core_.reset(new Core(thread_.task_runner(), std::move(capturer), type)); | 462 core_.reset(new Core(thread_.task_runner(), std::move(capturer), type)); |
462 } | 463 } |
463 | 464 |
464 } // namespace content | 465 } // namespace content |
OLD | NEW |