Chromium Code Reviews| 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 "media/video/capture/screen/screen_capture_device.h" | 5 #include "media/video/capture/screen/screen_capture_device.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 // frame. crbug.com/173265 . | 264 // frame. crbug.com/173265 . |
| 265 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 265 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
| 266 } | 266 } |
| 267 | 267 |
| 268 void ScreenCaptureDevice::Core::DoAllocate(int frame_rate) { | 268 void ScreenCaptureDevice::Core::DoAllocate(int frame_rate) { |
| 269 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 269 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
| 270 | 270 |
| 271 frame_rate_ = frame_rate; | 271 frame_rate_ = frame_rate; |
| 272 | 272 |
| 273 // Create and start frame capturer. | 273 // Create and start frame capturer. |
| 274 #if defined(OS_CHROMEOS) | |
| 275 // ScreenCapturerX11 polls by default, due to poor driver support for DAMAGE. | |
| 276 // ChromeOS' drivers [can be patched to] support DAMAGE properly, so use it. | |
| 277 if (!screen_capturer_) | |
|
Sergey Ulanov
2013/03/17 05:36:32
nit: Maybe pull this line out of the #ifdef - it's
Wez
2013/03/19 18:25:44
Since it's only duplicating one line, I chose to a
| |
| 278 screen_capturer_ = ScreenCapturer::CreateWithXDamage(true); | |
| 279 #else | |
| 274 if (!screen_capturer_) | 280 if (!screen_capturer_) |
| 275 screen_capturer_ = ScreenCapturer::Create(); | 281 screen_capturer_ = ScreenCapturer::Create(); |
| 282 #endif | |
| 276 if (screen_capturer_) | 283 if (screen_capturer_) |
| 277 screen_capturer_->Start(this); | 284 screen_capturer_->Start(this); |
| 278 | 285 |
| 279 // Capture first frame, so that we can call OnFrameInfo() callback. | 286 // Capture first frame, so that we can call OnFrameInfo() callback. |
| 280 waiting_for_frame_size_ = true; | 287 waiting_for_frame_size_ = true; |
| 281 DoCapture(); | 288 DoCapture(); |
| 282 } | 289 } |
| 283 | 290 |
| 284 void ScreenCaptureDevice::Core::DoStart() { | 291 void ScreenCaptureDevice::Core::DoStart() { |
| 285 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 292 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 371 | 378 |
| 372 void ScreenCaptureDevice::DeAllocate() { | 379 void ScreenCaptureDevice::DeAllocate() { |
| 373 core_->DeAllocate(); | 380 core_->DeAllocate(); |
| 374 } | 381 } |
| 375 | 382 |
| 376 const VideoCaptureDevice::Name& ScreenCaptureDevice::device_name() { | 383 const VideoCaptureDevice::Name& ScreenCaptureDevice::device_name() { |
| 377 return name_; | 384 return name_; |
| 378 } | 385 } |
| 379 | 386 |
| 380 } // namespace media | 387 } // namespace media |
| OLD | NEW |