| 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 10 matching lines...) Expand all Loading... |
| 21 #include "base/task_runner_util.h" | 21 #include "base/task_runner_util.h" |
| 22 #include "base/threading/sequenced_worker_pool.h" | 22 #include "base/threading/sequenced_worker_pool.h" |
| 23 #include "base/threading/thread_task_runner_handle.h" | 23 #include "base/threading/thread_task_runner_handle.h" |
| 24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 25 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" | 25 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" |
| 26 #include "content/browser/media/capture/web_contents_video_capture_device.h" | 26 #include "content/browser/media/capture/web_contents_video_capture_device.h" |
| 27 #include "content/browser/media/media_internals.h" | 27 #include "content/browser/media/media_internals.h" |
| 28 #include "content/browser/renderer_host/media/video_capture_controller.h" | 28 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 29 #include "content/browser/renderer_host/media/video_capture_controller_event_han
dler.h" | 29 #include "content/browser/renderer_host/media/video_capture_controller_event_han
dler.h" |
| 30 #include "content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h" | 30 #include "content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h" |
| 31 #include "content/browser/renderer_host/media/video_frame_receiver_on_io_thread.
h" | |
| 32 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
| 33 #include "content/public/browser/desktop_media_id.h" | 32 #include "content/public/browser/desktop_media_id.h" |
| 34 #include "content/public/common/media_stream_request.h" | 33 #include "content/public/common/media_stream_request.h" |
| 35 #include "media/base/bind_to_current_loop.h" | 34 #include "media/base/bind_to_current_loop.h" |
| 36 #include "media/base/media_switches.h" | 35 #include "media/base/media_switches.h" |
| 37 #include "media/base/video_facing.h" | 36 #include "media/base/video_facing.h" |
| 38 #include "media/capture/video/video_capture_buffer_pool_impl.h" | 37 #include "media/capture/video/video_capture_buffer_pool_impl.h" |
| 39 #include "media/capture/video/video_capture_buffer_tracker_factory_impl.h" | 38 #include "media/capture/video/video_capture_buffer_tracker_factory_impl.h" |
| 40 #include "media/capture/video/video_capture_device.h" | 39 #include "media/capture/video/video_capture_device.h" |
| 41 #include "media/capture/video/video_capture_device_client.h" | 40 #include "media/capture/video/video_capture_device_client.h" |
| 42 #include "media/capture/video/video_capture_device_factory.h" | 41 #include "media/capture/video/video_capture_device_factory.h" |
| 42 #include "media/capture/video/video_frame_receiver_on_task_runner.h" |
| 43 | 43 |
| 44 #if defined(ENABLE_SCREEN_CAPTURE) | 44 #if defined(ENABLE_SCREEN_CAPTURE) |
| 45 | 45 |
| 46 #if BUILDFLAG(ENABLE_WEBRTC) && !defined(OS_ANDROID) | 46 #if BUILDFLAG(ENABLE_WEBRTC) && !defined(OS_ANDROID) |
| 47 #include "content/browser/media/capture/desktop_capture_device.h" | 47 #include "content/browser/media/capture/desktop_capture_device.h" |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 #if defined(USE_AURA) | 50 #if defined(USE_AURA) |
| 51 #include "content/browser/media/capture/desktop_capture_device_aura.h" | 51 #include "content/browser/media/capture/desktop_capture_device_aura.h" |
| 52 #endif | 52 #endif |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 258 |
| 259 const int max_buffers = stream_type == MEDIA_TAB_VIDEO_CAPTURE | 259 const int max_buffers = stream_type == MEDIA_TAB_VIDEO_CAPTURE |
| 260 ? kMaxNumberOfBuffersForTabCapture | 260 ? kMaxNumberOfBuffersForTabCapture |
| 261 : kMaxNumberOfBuffers; | 261 : kMaxNumberOfBuffers; |
| 262 scoped_refptr<media::VideoCaptureBufferPool> buffer_pool = | 262 scoped_refptr<media::VideoCaptureBufferPool> buffer_pool = |
| 263 new media::VideoCaptureBufferPoolImpl( | 263 new media::VideoCaptureBufferPoolImpl( |
| 264 base::MakeUnique<media::VideoCaptureBufferTrackerFactoryImpl>(), | 264 base::MakeUnique<media::VideoCaptureBufferTrackerFactoryImpl>(), |
| 265 max_buffers); | 265 max_buffers); |
| 266 | 266 |
| 267 return base::MakeUnique<media::VideoCaptureDeviceClient>( | 267 return base::MakeUnique<media::VideoCaptureDeviceClient>( |
| 268 base::MakeUnique<VideoFrameReceiverOnIOThread>( | 268 base::MakeUnique<media::VideoFrameReceiverOnTaskRunner>( |
| 269 video_capture_controller.GetWeakPtrForIOThread()), | 269 video_capture_controller.GetWeakPtrForIOThread(), |
| 270 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)), |
| 270 std::move(buffer_pool), | 271 std::move(buffer_pool), |
| 271 base::Bind(&CreateGpuJpegDecoder, | 272 base::Bind(&CreateGpuJpegDecoder, |
| 272 base::Bind(&media::VideoFrameReceiver::OnFrameReadyInBuffer, | 273 base::Bind(&media::VideoFrameReceiver::OnFrameReadyInBuffer, |
| 273 video_capture_controller.GetWeakPtrForIOThread()))); | 274 video_capture_controller.GetWeakPtrForIOThread()))); |
| 274 } | 275 } |
| 275 | 276 |
| 276 VideoCaptureManager::DeviceInfo::DeviceInfo() = default; | 277 VideoCaptureManager::DeviceInfo::DeviceInfo() = default; |
| 277 | 278 |
| 278 VideoCaptureManager::DeviceInfo::DeviceInfo( | 279 VideoCaptureManager::DeviceInfo::DeviceInfo( |
| 279 media::VideoCaptureDeviceDescriptor descriptor) | 280 media::VideoCaptureDeviceDescriptor descriptor) |
| (...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 if (!device_in_queue) { | 1329 if (!device_in_queue) { |
| 1329 // Session ID is only valid for Screen capture. So we can fake it to | 1330 // Session ID is only valid for Screen capture. So we can fake it to |
| 1330 // resume video capture devices here. | 1331 // resume video capture devices here. |
| 1331 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); | 1332 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); |
| 1332 } | 1333 } |
| 1333 } | 1334 } |
| 1334 } | 1335 } |
| 1335 #endif // defined(OS_ANDROID) | 1336 #endif // defined(OS_ANDROID) |
| 1336 | 1337 |
| 1337 } // namespace content | 1338 } // namespace content |
| OLD | NEW |