| 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/renderer_host/media/desktop_capture_device.h" | 5 #include "content/browser/renderer_host/media/desktop_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" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "base/threading/sequenced_worker_pool.h" | 13 #include "base/threading/sequenced_worker_pool.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/common/desktop_media_id.h" | 15 #include "content/public/browser/desktop_media_id.h" |
| 16 #include "media/base/video_util.h" | 16 #include "media/base/video_util.h" |
| 17 #include "third_party/libyuv/include/libyuv/scale_argb.h" | 17 #include "third_party/libyuv/include/libyuv/scale_argb.h" |
| 18 #include "third_party/webrtc/modules/desktop_capture/desktop_and_cursor_composer
.h" | 18 #include "third_party/webrtc/modules/desktop_capture/desktop_and_cursor_composer
.h" |
| 19 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" | 19 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" |
| 20 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" | 20 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
| 21 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 21 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
| 22 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h" | 22 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h" |
| 23 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 23 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
| 24 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h" | 24 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h" |
| 25 | 25 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 scoped_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( | 351 scoped_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( |
| 352 const DesktopMediaID& source) { | 352 const DesktopMediaID& source) { |
| 353 scoped_refptr<base::SequencedWorkerPool> blocking_pool = | 353 scoped_refptr<base::SequencedWorkerPool> blocking_pool = |
| 354 BrowserThread::GetBlockingPool(); | 354 BrowserThread::GetBlockingPool(); |
| 355 scoped_refptr<base::SequencedTaskRunner> task_runner = | 355 scoped_refptr<base::SequencedTaskRunner> task_runner = |
| 356 blocking_pool->GetSequencedTaskRunner( | 356 blocking_pool->GetSequencedTaskRunner( |
| 357 blocking_pool->GetSequenceToken()); | 357 blocking_pool->GetSequenceToken()); |
| 358 | 358 |
| 359 webrtc::DesktopCaptureOptions options = | 359 webrtc::DesktopCaptureOptions options = |
| 360 webrtc::DesktopCaptureOptions::CreateDefault(); | 360 webrtc::DesktopCaptureOptions::CreateDefault(); |
| 361 | |
| 362 #if defined(OS_CHROMEOS) | |
| 363 // Xdamage is not enabled by default because it's often broken. ChromeOS' | |
| 364 // drivers [can be patched to] support DAMAGE properly, so use it. | |
| 365 options.set_use_update_notifications(true); | |
| 366 #endif | |
| 367 | |
| 368 // Leave desktop effects enabled during WebRTC captures. | 361 // Leave desktop effects enabled during WebRTC captures. |
| 369 options.set_disable_effects(false); | 362 options.set_disable_effects(false); |
| 370 | 363 |
| 371 scoped_ptr<webrtc::DesktopCapturer> capturer; | 364 scoped_ptr<webrtc::DesktopCapturer> capturer; |
| 372 | 365 |
| 373 switch (source.type) { | 366 switch (source.type) { |
| 374 case DesktopMediaID::TYPE_SCREEN: { | 367 case DesktopMediaID::TYPE_SCREEN: { |
| 375 scoped_ptr<webrtc::DesktopCapturer> screen_capturer; | 368 scoped_ptr<webrtc::DesktopCapturer> screen_capturer; |
| 376 screen_capturer.reset(webrtc::ScreenCapturer::Create(options)); | 369 screen_capturer.reset(webrtc::ScreenCapturer::Create(options)); |
| 377 if (screen_capturer) { | 370 if (screen_capturer) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 const media::VideoCaptureParams& params, | 411 const media::VideoCaptureParams& params, |
| 419 scoped_ptr<Client> client) { | 412 scoped_ptr<Client> client) { |
| 420 core_->AllocateAndStart(params, client.Pass()); | 413 core_->AllocateAndStart(params, client.Pass()); |
| 421 } | 414 } |
| 422 | 415 |
| 423 void DesktopCaptureDevice::StopAndDeAllocate() { | 416 void DesktopCaptureDevice::StopAndDeAllocate() { |
| 424 core_->StopAndDeAllocate(); | 417 core_->StopAndDeAllocate(); |
| 425 } | 418 } |
| 426 | 419 |
| 427 } // namespace content | 420 } // namespace content |
| OLD | NEW |