Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: content/browser/renderer_host/media/video_capture_manager.cc

Issue 2123863004: ScreenCapture for Android phase1, part II (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/BUILD.gn ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 new DeviceEntry(device_info.type, device_info.id, 1140 new DeviceEntry(device_info.type, device_info.id,
1136 std::move(video_capture_controller), params); 1141 std::move(video_capture_controller), params);
1137 devices_.emplace_back(new_device); 1142 devices_.emplace_back(new_device);
1138 return new_device; 1143 return new_device;
1139 } 1144 }
1140 1145
1141 void VideoCaptureManager::SetDesktopCaptureWindowIdOnDeviceThread( 1146 void VideoCaptureManager::SetDesktopCaptureWindowIdOnDeviceThread(
1142 media::VideoCaptureDevice* device, 1147 media::VideoCaptureDevice* device,
1143 gfx::NativeViewId window_id) { 1148 gfx::NativeViewId window_id) {
1144 DCHECK(IsOnDeviceThread()); 1149 DCHECK(IsOnDeviceThread());
1145 #if defined(ENABLE_SCREEN_CAPTURE) 1150 #if !defined(OS_ANDROID)
1146 DesktopCaptureDevice* desktop_device = 1151 DesktopCaptureDevice* desktop_device =
1147 static_cast<DesktopCaptureDevice*>(device); 1152 static_cast<DesktopCaptureDevice*>(device);
1148 desktop_device->SetNotificationWindowId(window_id); 1153 desktop_device->SetNotificationWindowId(window_id);
1149 VLOG(2) << "Screen capture notification window passed on device thread."; 1154 VLOG(2) << "Screen capture notification window passed on device thread.";
1150 #endif 1155 #endif
1151 } 1156 }
1152 1157
1153 void VideoCaptureManager::DoGetPhotoCapabilities( 1158 void VideoCaptureManager::DoGetPhotoCapabilities(
1154 VideoCaptureDevice::GetPhotoCapabilitiesCallback callback, 1159 VideoCaptureDevice::GetPhotoCapabilitiesCallback callback,
1155 VideoCaptureDevice* device) { 1160 VideoCaptureDevice* device) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 if (!device_in_queue) { 1267 if (!device_in_queue) {
1263 // Session ID is only valid for Screen capture. So we can fake it to 1268 // Session ID is only valid for Screen capture. So we can fake it to
1264 // resume video capture devices here. 1269 // resume video capture devices here.
1265 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); 1270 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters);
1266 } 1271 }
1267 } 1272 }
1268 } 1273 }
1269 #endif // defined(OS_ANDROID) 1274 #endif // defined(OS_ANDROID)
1270 1275
1271 } // namespace content 1276 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/BUILD.gn ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698