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 21 matching lines...) Expand all Loading... |
32 #include "media/base/bind_to_current_loop.h" | 32 #include "media/base/bind_to_current_loop.h" |
33 #include "media/base/media_switches.h" | 33 #include "media/base/media_switches.h" |
34 #include "media/capture/video/video_capture_device.h" | 34 #include "media/capture/video/video_capture_device.h" |
35 #include "media/capture/video/video_capture_device_factory.h" | 35 #include "media/capture/video/video_capture_device_factory.h" |
36 | 36 |
37 #if defined(ENABLE_SCREEN_CAPTURE) | 37 #if defined(ENABLE_SCREEN_CAPTURE) |
38 #include "content/browser/media/capture/desktop_capture_device.h" | 38 #include "content/browser/media/capture/desktop_capture_device.h" |
39 #if defined(USE_AURA) | 39 #if defined(USE_AURA) |
40 #include "content/browser/media/capture/desktop_capture_device_aura.h" | 40 #include "content/browser/media/capture/desktop_capture_device_aura.h" |
41 #endif | 41 #endif |
| 42 #if defined(OS_ANDROID) |
| 43 #include "content/browser/media/capture/screen_capture_device_android.h" |
| 44 #endif |
42 #endif | 45 #endif |
43 | 46 |
44 #if defined(OS_MACOSX) | 47 #if defined(OS_MACOSX) |
45 #include "media/base/mac/avfoundation_glue.h" | 48 #include "media/base/mac/avfoundation_glue.h" |
46 #endif | 49 #endif |
47 | 50 |
48 namespace { | 51 namespace { |
49 | 52 |
50 // Compares two VideoCaptureFormat by checking smallest frame_size area, then | 53 // Compares two VideoCaptureFormat by checking smallest frame_size area, then |
51 // by _largest_ frame_rate. Used to order a VideoCaptureFormats vector so that | 54 // by _largest_ frame_rate. Used to order a VideoCaptureFormats vector so that |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 return nullptr; | 581 return nullptr; |
579 } | 582 } |
580 | 583 |
581 if (desktop_id.type == DesktopMediaID::TYPE_WEB_CONTENTS) { | 584 if (desktop_id.type == DesktopMediaID::TYPE_WEB_CONTENTS) { |
582 video_capture_device.reset(WebContentsVideoCaptureDevice::Create(id)); | 585 video_capture_device.reset(WebContentsVideoCaptureDevice::Create(id)); |
583 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED); | 586 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED); |
584 } else { | 587 } else { |
585 #if defined(USE_AURA) | 588 #if defined(USE_AURA) |
586 video_capture_device = DesktopCaptureDeviceAura::Create(desktop_id); | 589 video_capture_device = DesktopCaptureDeviceAura::Create(desktop_id); |
587 #endif | 590 #endif |
| 591 #if defined(OS_ANDROID) |
| 592 DCHECK(desktop_id.type == DesktopMediaID::TYPE_SCREEN); |
| 593 video_capture_device = base::WrapUnique(new ScreenCaptureDeviceAndroid()); |
| 594 #endif |
588 if (!video_capture_device) | 595 if (!video_capture_device) |
589 video_capture_device = DesktopCaptureDevice::Create(desktop_id); | 596 video_capture_device = DesktopCaptureDevice::Create(desktop_id); |
590 } | 597 } |
591 #endif // defined(ENABLE_SCREEN_CAPTURE) | 598 #endif // defined(ENABLE_SCREEN_CAPTURE) |
592 | 599 |
593 if (!video_capture_device) { | 600 if (!video_capture_device) { |
594 device_client->OnError(FROM_HERE, "Could not create capture device"); | 601 device_client->OnError(FROM_HERE, "Could not create capture device"); |
595 return nullptr; | 602 return nullptr; |
596 } | 603 } |
597 | 604 |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 if (!device_in_queue) { | 1176 if (!device_in_queue) { |
1170 // Session ID is only valid for Screen capture. So we can fake it to | 1177 // Session ID is only valid for Screen capture. So we can fake it to |
1171 // resume video capture devices here. | 1178 // resume video capture devices here. |
1172 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); | 1179 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); |
1173 } | 1180 } |
1174 } | 1181 } |
1175 } | 1182 } |
1176 #endif // defined(OS_ANDROID) | 1183 #endif // defined(OS_ANDROID) |
1177 | 1184 |
1178 } // namespace content | 1185 } // namespace content |
OLD | NEW |