| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/video_capture_manager.h" | 5 #include "content/browser/renderer_host/media/video_capture_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 488 |
| 489 scoped_ptr<media::VideoCaptureDevice> | 489 scoped_ptr<media::VideoCaptureDevice> |
| 490 VideoCaptureManager::DoStartTabCaptureOnDeviceThread( | 490 VideoCaptureManager::DoStartTabCaptureOnDeviceThread( |
| 491 const std::string& id, | 491 const std::string& id, |
| 492 const media::VideoCaptureParams& params, | 492 const media::VideoCaptureParams& params, |
| 493 scoped_ptr<media::VideoCaptureDevice::Client> device_client) { | 493 scoped_ptr<media::VideoCaptureDevice::Client> device_client) { |
| 494 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); | 494 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); |
| 495 DCHECK(IsOnDeviceThread()); | 495 DCHECK(IsOnDeviceThread()); |
| 496 | 496 |
| 497 scoped_ptr<media::VideoCaptureDevice> video_capture_device; | 497 scoped_ptr<media::VideoCaptureDevice> video_capture_device; |
| 498 video_capture_device.reset(WebContentsVideoCaptureDevice::Create(id)); | 498 video_capture_device.reset(WebContentsVideoCaptureDevice::Create( |
| 499 id, WebContentsVideoCaptureDevice::CHROME_TAB_CAPTURE)); |
| 499 | 500 |
| 500 if (!video_capture_device) { | 501 if (!video_capture_device) { |
| 501 device_client->OnError(FROM_HERE, "Could not create capture device"); | 502 device_client->OnError(FROM_HERE, "Could not create capture device"); |
| 502 return nullptr; | 503 return nullptr; |
| 503 } | 504 } |
| 504 | 505 |
| 505 video_capture_device->AllocateAndStart(params, std::move(device_client)); | 506 video_capture_device->AllocateAndStart(params, std::move(device_client)); |
| 506 return video_capture_device; | 507 return video_capture_device; |
| 507 } | 508 } |
| 508 | 509 |
| 509 scoped_ptr<media::VideoCaptureDevice> | 510 scoped_ptr<media::VideoCaptureDevice> |
| 510 VideoCaptureManager::DoStartDesktopCaptureOnDeviceThread( | 511 VideoCaptureManager::DoStartDesktopCaptureOnDeviceThread( |
| 511 const std::string& id, | 512 const std::string& id, |
| 512 const media::VideoCaptureParams& params, | 513 const media::VideoCaptureParams& params, |
| 513 scoped_ptr<media::VideoCaptureDevice::Client> device_client) { | 514 scoped_ptr<media::VideoCaptureDevice::Client> device_client) { |
| 514 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); | 515 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); |
| 515 DCHECK(IsOnDeviceThread()); | 516 DCHECK(IsOnDeviceThread()); |
| 516 | 517 |
| 517 scoped_ptr<media::VideoCaptureDevice> video_capture_device; | 518 scoped_ptr<media::VideoCaptureDevice> video_capture_device; |
| 518 #if defined(ENABLE_SCREEN_CAPTURE) | 519 #if defined(ENABLE_SCREEN_CAPTURE) |
| 519 DesktopMediaID desktop_id = DesktopMediaID::Parse(id); | 520 DesktopMediaID desktop_id = DesktopMediaID::Parse(id); |
| 520 if (desktop_id.is_null()) { | 521 if (desktop_id.is_null()) { |
| 521 device_client->OnError(FROM_HERE, "Desktop media ID is null"); | 522 device_client->OnError(FROM_HERE, "Desktop media ID is null"); |
| 522 return nullptr; | 523 return nullptr; |
| 523 } | 524 } |
| 524 | 525 |
| 525 if (desktop_id.type == DesktopMediaID::TYPE_WEB_CONTENTS) { | 526 if (desktop_id.type == DesktopMediaID::TYPE_WEB_CONTENTS) { |
| 526 video_capture_device.reset(WebContentsVideoCaptureDevice::Create(id)); | 527 video_capture_device.reset(WebContentsVideoCaptureDevice::Create( |
| 528 id, WebContentsVideoCaptureDevice::CHROME_CHOOSE_DESKTOP_MEDIA)); |
| 527 } else { | 529 } else { |
| 528 #if defined(USE_AURA) | 530 #if defined(USE_AURA) |
| 529 video_capture_device = DesktopCaptureDeviceAura::Create(desktop_id); | 531 video_capture_device = DesktopCaptureDeviceAura::Create(desktop_id); |
| 530 #endif | 532 #endif |
| 531 if (!video_capture_device) | 533 if (!video_capture_device) |
| 532 video_capture_device = DesktopCaptureDevice::Create(desktop_id); | 534 video_capture_device = DesktopCaptureDevice::Create(desktop_id); |
| 533 } | 535 } |
| 534 #endif // defined(ENABLE_SCREEN_CAPTURE) | 536 #endif // defined(ENABLE_SCREEN_CAPTURE) |
| 535 | 537 |
| 536 if (!video_capture_device) { | 538 if (!video_capture_device) { |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 977 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 976 BrowserThread::PostTaskAndReply( | 978 BrowserThread::PostTaskAndReply( |
| 977 BrowserThread::UI, FROM_HERE, | 979 BrowserThread::UI, FROM_HERE, |
| 978 base::Bind(&AVFoundationGlue::InitializeAVFoundation), | 980 base::Bind(&AVFoundationGlue::InitializeAVFoundation), |
| 979 base::Bind(&VideoCaptureManager::OnDeviceLayerInitialized, this, | 981 base::Bind(&VideoCaptureManager::OnDeviceLayerInitialized, this, |
| 980 and_then)); | 982 and_then)); |
| 981 } | 983 } |
| 982 #endif | 984 #endif |
| 983 | 985 |
| 984 } // namespace content | 986 } // namespace content |
| OLD | NEW |