| 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 22 matching lines...) Expand all Loading... |
| 33 #include "content/public/browser/desktop_media_id.h" | 33 #include "content/public/browser/desktop_media_id.h" |
| 34 #include "content/public/common/media_stream_request.h" | 34 #include "content/public/common/media_stream_request.h" |
| 35 #include "media/base/bind_to_current_loop.h" | 35 #include "media/base/bind_to_current_loop.h" |
| 36 #include "media/base/media_switches.h" | 36 #include "media/base/media_switches.h" |
| 37 #include "media/capture/video/video_capture_buffer_pool_impl.h" | 37 #include "media/capture/video/video_capture_buffer_pool_impl.h" |
| 38 #include "media/capture/video/video_capture_buffer_tracker_factory_impl.h" | 38 #include "media/capture/video/video_capture_buffer_tracker_factory_impl.h" |
| 39 #include "media/capture/video/video_capture_device.h" | 39 #include "media/capture/video/video_capture_device.h" |
| 40 #include "media/capture/video/video_capture_device_client.h" | 40 #include "media/capture/video/video_capture_device_client.h" |
| 41 #include "media/capture/video/video_capture_device_factory.h" | 41 #include "media/capture/video/video_capture_device_factory.h" |
| 42 | 42 |
| 43 #if defined(ENABLE_SCREEN_CAPTURE) && !defined(OS_ANDROID) | 43 #if defined(ENABLE_SCREEN_CAPTURE) |
| 44 |
| 45 #if BUILDFLAG(ENABLE_WEBRTC) && !defined(OS_ANDROID) |
| 44 #include "content/browser/media/capture/desktop_capture_device.h" | 46 #include "content/browser/media/capture/desktop_capture_device.h" |
| 47 #endif |
| 48 |
| 45 #if defined(USE_AURA) | 49 #if defined(USE_AURA) |
| 46 #include "content/browser/media/capture/desktop_capture_device_aura.h" | 50 #include "content/browser/media/capture/desktop_capture_device_aura.h" |
| 47 #endif | 51 #endif |
| 52 |
| 53 #if defined(OS_ANDROID) |
| 54 #include "content/browser/media/capture/screen_capture_device_android.h" |
| 48 #endif | 55 #endif |
| 49 | 56 |
| 50 #if defined(ENABLE_SCREEN_CAPTURE) && defined(OS_ANDROID) | 57 #endif // defined(ENABLE_SCREEN_CAPTURE) |
| 51 #include "content/browser/media/capture/screen_capture_device_android.h" | |
| 52 #endif | |
| 53 | 58 |
| 54 namespace { | 59 namespace { |
| 55 | 60 |
| 56 class VideoFrameConsumerFeedbackObserverOnTaskRunner | 61 class VideoFrameConsumerFeedbackObserverOnTaskRunner |
| 57 : public media::VideoFrameConsumerFeedbackObserver { | 62 : public media::VideoFrameConsumerFeedbackObserver { |
| 58 public: | 63 public: |
| 59 VideoFrameConsumerFeedbackObserverOnTaskRunner( | 64 VideoFrameConsumerFeedbackObserverOnTaskRunner( |
| 60 media::VideoFrameConsumerFeedbackObserver* observer, | 65 media::VideoFrameConsumerFeedbackObserver* observer, |
| 61 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 66 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| 62 : observer_(observer), task_runner_(std::move(task_runner)) {} | 67 : observer_(observer), task_runner_(std::move(task_runner)) {} |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED_WITHOUT_AUDIO); | 705 IncrementDesktopCaptureCounter(TAB_VIDEO_CAPTURER_CREATED_WITHOUT_AUDIO); |
| 701 } | 706 } |
| 702 #endif | 707 #endif |
| 703 } else { | 708 } else { |
| 704 #if defined(OS_ANDROID) | 709 #if defined(OS_ANDROID) |
| 705 video_capture_device = base::MakeUnique<ScreenCaptureDeviceAndroid>(); | 710 video_capture_device = base::MakeUnique<ScreenCaptureDeviceAndroid>(); |
| 706 #else | 711 #else |
| 707 #if defined(USE_AURA) | 712 #if defined(USE_AURA) |
| 708 video_capture_device = DesktopCaptureDeviceAura::Create(desktop_id); | 713 video_capture_device = DesktopCaptureDeviceAura::Create(desktop_id); |
| 709 #endif // defined(USE_AURA) | 714 #endif // defined(USE_AURA) |
| 710 if (!video_capture_device) | 715 #if BUILDFLAG(ENABLE_WEBRTC) |
| 711 video_capture_device = DesktopCaptureDevice::Create(desktop_id); | 716 if (!video_capture_device) |
| 717 video_capture_device = DesktopCaptureDevice::Create(desktop_id); |
| 718 #endif // BUILDFLAG(ENABLE_WEBRTC) |
| 712 #endif // defined (OS_ANDROID) | 719 #endif // defined (OS_ANDROID) |
| 713 } | 720 } |
| 714 #endif // defined(ENABLE_SCREEN_CAPTURE) | 721 #endif // defined(ENABLE_SCREEN_CAPTURE) |
| 715 | 722 |
| 716 if (!video_capture_device) { | 723 if (!video_capture_device) { |
| 717 device_client->OnError(FROM_HERE, "Could not create capture device"); | 724 device_client->OnError(FROM_HERE, "Could not create capture device"); |
| 718 return nullptr; | 725 return nullptr; |
| 719 } | 726 } |
| 720 | 727 |
| 721 video_capture_device->AllocateAndStart(params, std::move(device_client)); | 728 video_capture_device->AllocateAndStart(params, std::move(device_client)); |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 | 1227 |
| 1221 devices_.emplace_back( | 1228 devices_.emplace_back( |
| 1222 new DeviceEntry(device_info.type, device_info.id, params)); | 1229 new DeviceEntry(device_info.type, device_info.id, params)); |
| 1223 return devices_.back().get(); | 1230 return devices_.back().get(); |
| 1224 } | 1231 } |
| 1225 | 1232 |
| 1226 void VideoCaptureManager::SetDesktopCaptureWindowIdOnDeviceThread( | 1233 void VideoCaptureManager::SetDesktopCaptureWindowIdOnDeviceThread( |
| 1227 media::VideoCaptureDevice* device, | 1234 media::VideoCaptureDevice* device, |
| 1228 gfx::NativeViewId window_id) { | 1235 gfx::NativeViewId window_id) { |
| 1229 DCHECK(IsOnDeviceThread()); | 1236 DCHECK(IsOnDeviceThread()); |
| 1230 #if defined(ENABLE_SCREEN_CAPTURE) && !defined(OS_ANDROID) | 1237 #if defined(ENABLE_SCREEN_CAPTURE) && BUILDFLAG(ENABLE_WEBRTC) && !defined(OS_AN
DROID) |
| 1231 DesktopCaptureDevice* desktop_device = | 1238 DesktopCaptureDevice* desktop_device = |
| 1232 static_cast<DesktopCaptureDevice*>(device); | 1239 static_cast<DesktopCaptureDevice*>(device); |
| 1233 desktop_device->SetNotificationWindowId(window_id); | 1240 desktop_device->SetNotificationWindowId(window_id); |
| 1234 VLOG(2) << "Screen capture notification window passed on device thread."; | 1241 VLOG(2) << "Screen capture notification window passed on device thread."; |
| 1235 #endif | 1242 #endif |
| 1236 } | 1243 } |
| 1237 | 1244 |
| 1238 void VideoCaptureManager::DoGetPhotoCapabilities( | 1245 void VideoCaptureManager::DoGetPhotoCapabilities( |
| 1239 VideoCaptureDevice::GetPhotoCapabilitiesCallback callback, | 1246 VideoCaptureDevice::GetPhotoCapabilitiesCallback callback, |
| 1240 VideoCaptureDevice* device) { | 1247 VideoCaptureDevice* device) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 if (!device_in_queue) { | 1328 if (!device_in_queue) { |
| 1322 // Session ID is only valid for Screen capture. So we can fake it to | 1329 // Session ID is only valid for Screen capture. So we can fake it to |
| 1323 // resume video capture devices here. | 1330 // resume video capture devices here. |
| 1324 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); | 1331 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); |
| 1325 } | 1332 } |
| 1326 } | 1333 } |
| 1327 } | 1334 } |
| 1328 #endif // defined(OS_ANDROID) | 1335 #endif // defined(OS_ANDROID) |
| 1329 | 1336 |
| 1330 } // namespace content | 1337 } // namespace content |
| OLD | NEW |