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

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: rebase to #407492(Jul 25) Created 4 years, 4 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
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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 device_client->OnError(FROM_HERE, "Desktop media ID is null"); 580 device_client->OnError(FROM_HERE, "Desktop media ID is null");
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);
590 #elif defined(OS_ANDROID)
591 DCHECK(desktop_id.type == DesktopMediaID::TYPE_SCREEN);
592 video_capture_device = base::WrapUnique(new ScreenCaptureDeviceAndroid());
587 #endif 593 #endif
588 if (!video_capture_device) 594 if (!video_capture_device)
589 video_capture_device = DesktopCaptureDevice::Create(desktop_id); 595 video_capture_device = DesktopCaptureDevice::Create(desktop_id);
Sergey Ulanov 2016/08/19 05:54:15 DesktopCapture device is not applicable on Android
braveyao 2016/08/23 21:18:54 Done.
590 } 596 }
591 #endif // defined(ENABLE_SCREEN_CAPTURE) 597 #endif // defined(ENABLE_SCREEN_CAPTURE)
592 598
593 if (!video_capture_device) { 599 if (!video_capture_device) {
594 device_client->OnError(FROM_HERE, "Could not create capture device"); 600 device_client->OnError(FROM_HERE, "Could not create capture device");
595 return nullptr; 601 return nullptr;
596 } 602 }
597 603
598 video_capture_device->AllocateAndStart(params, std::move(device_client)); 604 video_capture_device->AllocateAndStart(params, std::move(device_client));
599 return video_capture_device; 605 return video_capture_device;
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 if (!device_in_queue) { 1175 if (!device_in_queue) {
1170 // Session ID is only valid for Screen capture. So we can fake it to 1176 // Session ID is only valid for Screen capture. So we can fake it to
1171 // resume video capture devices here. 1177 // resume video capture devices here.
1172 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); 1178 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters);
1173 } 1179 }
1174 } 1180 }
1175 } 1181 }
1176 #endif // defined(OS_ANDROID) 1182 #endif // defined(OS_ANDROID)
1177 1183
1178 } // namespace content 1184 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698