| 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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 DesktopMediaID desktop_id = DesktopMediaID::Parse(id); | 617 DesktopMediaID desktop_id = DesktopMediaID::Parse(id); |
| 615 if (desktop_id.is_null()) { | 618 if (desktop_id.is_null()) { |
| 616 device_client->OnError(FROM_HERE, "Desktop media ID is null"); | 619 device_client->OnError(FROM_HERE, "Desktop media ID is null"); |
| 617 return nullptr; | 620 return nullptr; |
| 618 } | 621 } |
| 619 | 622 |
| 620 if (desktop_id.type == DesktopMediaID::TYPE_WEB_CONTENTS) { | 623 if (desktop_id.type == DesktopMediaID::TYPE_WEB_CONTENTS) { |
| 621 video_capture_device.reset(WebContentsVideoCaptureDevice::Create(id)); | 624 video_capture_device.reset(WebContentsVideoCaptureDevice::Create(id)); |
| 622 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED); | 625 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED); |
| 623 } else { | 626 } else { |
| 624 #if defined(USE_AURA) | 627 #if defined(OS_ANDROID) |
| 628 video_capture_device = base::MakeUnique<ScreenCaptureDeviceAndroid>(); |
| 629 #elif defined(USE_AURA) |
| 625 video_capture_device = DesktopCaptureDeviceAura::Create(desktop_id); | 630 video_capture_device = DesktopCaptureDeviceAura::Create(desktop_id); |
| 626 #endif | 631 #endif |
| 627 if (!video_capture_device) | 632 if (!video_capture_device) |
| 628 video_capture_device = DesktopCaptureDevice::Create(desktop_id); | 633 video_capture_device = DesktopCaptureDevice::Create(desktop_id); |
| 629 } | 634 } |
| 630 #endif // defined(ENABLE_SCREEN_CAPTURE) | 635 #endif // defined(ENABLE_SCREEN_CAPTURE) |
| 631 | 636 |
| 632 if (!video_capture_device) { | 637 if (!video_capture_device) { |
| 633 device_client->OnError(FROM_HERE, "Could not create capture device"); | 638 device_client->OnError(FROM_HERE, "Could not create capture device"); |
| 634 return nullptr; | 639 return nullptr; |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 new DeviceEntry(device_info.type, device_info.id, | 1138 new DeviceEntry(device_info.type, device_info.id, |
| 1134 std::move(video_capture_controller), params); | 1139 std::move(video_capture_controller), params); |
| 1135 devices_.emplace_back(new_device); | 1140 devices_.emplace_back(new_device); |
| 1136 return new_device; | 1141 return new_device; |
| 1137 } | 1142 } |
| 1138 | 1143 |
| 1139 void VideoCaptureManager::SetDesktopCaptureWindowIdOnDeviceThread( | 1144 void VideoCaptureManager::SetDesktopCaptureWindowIdOnDeviceThread( |
| 1140 media::VideoCaptureDevice* device, | 1145 media::VideoCaptureDevice* device, |
| 1141 gfx::NativeViewId window_id) { | 1146 gfx::NativeViewId window_id) { |
| 1142 DCHECK(IsOnDeviceThread()); | 1147 DCHECK(IsOnDeviceThread()); |
| 1143 #if defined(ENABLE_SCREEN_CAPTURE) | 1148 #if !defined(OS_ANDROID) |
| 1144 DesktopCaptureDevice* desktop_device = | 1149 DesktopCaptureDevice* desktop_device = |
| 1145 static_cast<DesktopCaptureDevice*>(device); | 1150 static_cast<DesktopCaptureDevice*>(device); |
| 1146 desktop_device->SetNotificationWindowId(window_id); | 1151 desktop_device->SetNotificationWindowId(window_id); |
| 1147 VLOG(2) << "Screen capture notification window passed on device thread."; | 1152 VLOG(2) << "Screen capture notification window passed on device thread."; |
| 1148 #endif | 1153 #endif |
| 1149 } | 1154 } |
| 1150 | 1155 |
| 1151 void VideoCaptureManager::DoGetPhotoCapabilities( | 1156 void VideoCaptureManager::DoGetPhotoCapabilities( |
| 1152 VideoCaptureDevice::GetPhotoCapabilitiesCallback callback, | 1157 VideoCaptureDevice::GetPhotoCapabilitiesCallback callback, |
| 1153 VideoCaptureDevice* device) { | 1158 VideoCaptureDevice* device) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 if (!device_in_queue) { | 1265 if (!device_in_queue) { |
| 1261 // Session ID is only valid for Screen capture. So we can fake it to | 1266 // Session ID is only valid for Screen capture. So we can fake it to |
| 1262 // resume video capture devices here. | 1267 // resume video capture devices here. |
| 1263 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); | 1268 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); |
| 1264 } | 1269 } |
| 1265 } | 1270 } |
| 1266 } | 1271 } |
| 1267 #endif // defined(OS_ANDROID) | 1272 #endif // defined(OS_ANDROID) |
| 1268 | 1273 |
| 1269 } // namespace content | 1274 } // namespace content |
| OLD | NEW |