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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 | 607 |
608 std::unique_ptr<media::VideoCaptureDevice> | 608 std::unique_ptr<media::VideoCaptureDevice> |
609 VideoCaptureManager::DoStartTabCaptureOnDeviceThread( | 609 VideoCaptureManager::DoStartTabCaptureOnDeviceThread( |
610 const std::string& id, | 610 const std::string& id, |
611 const media::VideoCaptureParams& params, | 611 const media::VideoCaptureParams& params, |
612 std::unique_ptr<VideoCaptureDevice::Client> device_client) { | 612 std::unique_ptr<VideoCaptureDevice::Client> device_client) { |
613 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); | 613 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); |
614 DCHECK(IsOnDeviceThread()); | 614 DCHECK(IsOnDeviceThread()); |
615 | 615 |
616 std::unique_ptr<VideoCaptureDevice> video_capture_device; | 616 std::unique_ptr<VideoCaptureDevice> video_capture_device; |
| 617 #if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN) |
617 video_capture_device = WebContentsVideoCaptureDevice::Create(id); | 618 video_capture_device = WebContentsVideoCaptureDevice::Create(id); |
| 619 #endif |
618 | 620 |
619 if (!video_capture_device) { | 621 if (!video_capture_device) { |
620 device_client->OnError(FROM_HERE, "Could not create capture device"); | 622 device_client->OnError(FROM_HERE, "Could not create capture device"); |
621 return nullptr; | 623 return nullptr; |
622 } | 624 } |
623 | 625 |
624 video_capture_device->AllocateAndStart(params, std::move(device_client)); | 626 video_capture_device->AllocateAndStart(params, std::move(device_client)); |
625 return video_capture_device; | 627 return video_capture_device; |
626 } | 628 } |
627 | 629 |
628 std::unique_ptr<media::VideoCaptureDevice> | 630 std::unique_ptr<media::VideoCaptureDevice> |
629 VideoCaptureManager::DoStartDesktopCaptureOnDeviceThread( | 631 VideoCaptureManager::DoStartDesktopCaptureOnDeviceThread( |
630 const std::string& id, | 632 const std::string& id, |
631 const media::VideoCaptureParams& params, | 633 const media::VideoCaptureParams& params, |
632 std::unique_ptr<VideoCaptureDevice::Client> device_client) { | 634 std::unique_ptr<VideoCaptureDevice::Client> device_client) { |
633 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); | 635 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); |
634 DCHECK(IsOnDeviceThread()); | 636 DCHECK(IsOnDeviceThread()); |
635 | 637 |
636 std::unique_ptr<VideoCaptureDevice> video_capture_device; | 638 std::unique_ptr<VideoCaptureDevice> video_capture_device; |
637 #if defined(ENABLE_SCREEN_CAPTURE) | 639 #if defined(ENABLE_SCREEN_CAPTURE) |
638 DesktopMediaID desktop_id = DesktopMediaID::Parse(id); | 640 DesktopMediaID desktop_id = DesktopMediaID::Parse(id); |
639 if (desktop_id.is_null()) { | 641 if (desktop_id.is_null()) { |
640 device_client->OnError(FROM_HERE, "Desktop media ID is null"); | 642 device_client->OnError(FROM_HERE, "Desktop media ID is null"); |
641 return nullptr; | 643 return nullptr; |
642 } | 644 } |
643 | 645 |
644 if (desktop_id.type == DesktopMediaID::TYPE_WEB_CONTENTS) { | 646 if (desktop_id.type == DesktopMediaID::TYPE_WEB_CONTENTS) { |
| 647 #if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN) |
645 video_capture_device = WebContentsVideoCaptureDevice::Create(id); | 648 video_capture_device = WebContentsVideoCaptureDevice::Create(id); |
646 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED); | 649 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED); |
647 if (desktop_id.audio_share) { | 650 if (desktop_id.audio_share) { |
648 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED_WITH_AUDIO); | 651 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED_WITH_AUDIO); |
649 } else { | 652 } else { |
650 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED_WITHOUT_AUDIO); | 653 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED_WITHOUT_AUDIO); |
651 } | 654 } |
| 655 #endif |
652 } else { | 656 } else { |
653 #if defined(OS_ANDROID) | 657 #if defined(OS_ANDROID) |
654 video_capture_device = base::MakeUnique<ScreenCaptureDeviceAndroid>(); | 658 video_capture_device = base::MakeUnique<ScreenCaptureDeviceAndroid>(); |
655 #else | 659 #else |
656 #if defined(USE_AURA) | 660 #if defined(USE_AURA) |
657 video_capture_device = DesktopCaptureDeviceAura::Create(desktop_id); | 661 video_capture_device = DesktopCaptureDeviceAura::Create(desktop_id); |
658 #endif // defined(USE_AURA) | 662 #endif // defined(USE_AURA) |
659 if (!video_capture_device) | 663 if (!video_capture_device) |
660 video_capture_device = DesktopCaptureDevice::Create(desktop_id); | 664 video_capture_device = DesktopCaptureDevice::Create(desktop_id); |
661 #endif // defined (OS_ANDROID) | 665 #endif // defined (OS_ANDROID) |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 if (!device_in_queue) { | 1283 if (!device_in_queue) { |
1280 // Session ID is only valid for Screen capture. So we can fake it to | 1284 // Session ID is only valid for Screen capture. So we can fake it to |
1281 // resume video capture devices here. | 1285 // resume video capture devices here. |
1282 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); | 1286 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); |
1283 } | 1287 } |
1284 } | 1288 } |
1285 } | 1289 } |
1286 #endif // defined(OS_ANDROID) | 1290 #endif // defined(OS_ANDROID) |
1287 | 1291 |
1288 } // namespace content | 1292 } // namespace content |
OLD | NEW |