| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/in_process_buildable_video_capture
_device.h" | 5 #include "content/browser/renderer_host/media/in_process_buildable_video_capture
_device.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" | 9 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" |
| 10 #include "content/browser/media/capture/web_contents_video_capture_device.h" | 10 #include "content/browser/media/capture/web_contents_video_capture_device.h" |
| 11 #include "content/browser/renderer_host/media/video_capture_controller.h" | 11 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 12 #include "content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h" | 12 #include "content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h" |
| 13 #include "content/browser/renderer_host/media/video_frame_receiver_on_io_thread.
h" | |
| 14 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/desktop_media_id.h" | 14 #include "content/public/browser/desktop_media_id.h" |
| 16 #include "content/public/common/media_stream_request.h" | 15 #include "content/public/common/media_stream_request.h" |
| 17 #include "media/base/bind_to_current_loop.h" | 16 #include "media/base/bind_to_current_loop.h" |
| 18 #include "media/capture/video/video_capture_buffer_pool_impl.h" | 17 #include "media/capture/video/video_capture_buffer_pool_impl.h" |
| 19 #include "media/capture/video/video_capture_buffer_tracker_factory_impl.h" | 18 #include "media/capture/video/video_capture_buffer_tracker_factory_impl.h" |
| 20 #include "media/capture/video/video_capture_device_client.h" | 19 #include "media/capture/video/video_capture_device_client.h" |
| 21 #include "media/capture/video/video_frame_receiver.h" | 20 #include "media/capture/video/video_frame_receiver_on_task_runner.h" |
| 22 | 21 |
| 23 #if defined(ENABLE_SCREEN_CAPTURE) && !defined(OS_ANDROID) | 22 #if defined(ENABLE_SCREEN_CAPTURE) && !defined(OS_ANDROID) |
| 24 #include "content/browser/media/capture/desktop_capture_device.h" | 23 #include "content/browser/media/capture/desktop_capture_device.h" |
| 25 #if defined(USE_AURA) | 24 #if defined(USE_AURA) |
| 26 #include "content/browser/media/capture/desktop_capture_device_aura.h" | 25 #include "content/browser/media/capture/desktop_capture_device_aura.h" |
| 27 #endif | 26 #endif |
| 28 #endif | 27 #endif |
| 29 | 28 |
| 30 #if defined(ENABLE_SCREEN_CAPTURE) && defined(OS_ANDROID) | 29 #if defined(ENABLE_SCREEN_CAPTURE) && defined(OS_ANDROID) |
| 31 #include "content/browser/media/capture/screen_capture_device_android.h" | 30 #include "content/browser/media/capture/screen_capture_device_android.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 base::Passed(&done_cb))); | 298 base::Passed(&done_cb))); |
| 300 } | 299 } |
| 301 | 300 |
| 302 std::unique_ptr<media::VideoCaptureDeviceClient> | 301 std::unique_ptr<media::VideoCaptureDeviceClient> |
| 303 InProcessBuildableVideoCaptureDevice::CreateDeviceClient( | 302 InProcessBuildableVideoCaptureDevice::CreateDeviceClient( |
| 304 int buffer_pool_max_buffer_count, | 303 int buffer_pool_max_buffer_count, |
| 305 base::WeakPtr<media::VideoFrameReceiver> receiver) { | 304 base::WeakPtr<media::VideoFrameReceiver> receiver) { |
| 306 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 305 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 307 | 306 |
| 308 return base::MakeUnique<media::VideoCaptureDeviceClient>( | 307 return base::MakeUnique<media::VideoCaptureDeviceClient>( |
| 309 base::MakeUnique<VideoFrameReceiverOnIOThread>(receiver), | 308 base::MakeUnique<media::VideoFrameReceiverOnTaskRunner>( |
| 309 receiver, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)), |
| 310 new media::VideoCaptureBufferPoolImpl( | 310 new media::VideoCaptureBufferPoolImpl( |
| 311 base::MakeUnique<media::VideoCaptureBufferTrackerFactoryImpl>(), | 311 base::MakeUnique<media::VideoCaptureBufferTrackerFactoryImpl>(), |
| 312 buffer_pool_max_buffer_count), | 312 buffer_pool_max_buffer_count), |
| 313 base::Bind(&CreateGpuJpegDecoder, | 313 base::Bind(&CreateGpuJpegDecoder, |
| 314 base::Bind(&media::VideoFrameReceiver::OnFrameReadyInBuffer, | 314 base::Bind(&media::VideoFrameReceiver::OnFrameReadyInBuffer, |
| 315 receiver))); | 315 receiver))); |
| 316 } | 316 } |
| 317 | 317 |
| 318 void InProcessBuildableVideoCaptureDevice::OnDeviceStarted( | 318 void InProcessBuildableVideoCaptureDevice::OnDeviceStarted( |
| 319 VideoCaptureController* controller, | 319 VideoCaptureController* controller, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 !defined(OS_ANDROID) | 463 !defined(OS_ANDROID) |
| 464 DesktopCaptureDevice* desktop_device = | 464 DesktopCaptureDevice* desktop_device = |
| 465 static_cast<DesktopCaptureDevice*>(device); | 465 static_cast<DesktopCaptureDevice*>(device); |
| 466 desktop_device->SetNotificationWindowId(window_id); | 466 desktop_device->SetNotificationWindowId(window_id); |
| 467 VLOG(2) << "Screen capture notification window passed on device thread."; | 467 VLOG(2) << "Screen capture notification window passed on device thread."; |
| 468 #endif | 468 #endif |
| 469 base::ResetAndReturn(&done_cb).Run(); | 469 base::ResetAndReturn(&done_cb).Run(); |
| 470 } | 470 } |
| 471 | 471 |
| 472 } // namespace content | 472 } // namespace content |
| OLD | NEW |