| 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_video_capture_device_la
uncher.h" | 5 #include "content/browser/renderer_host/media/in_process_video_capture_device_la
uncher.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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #endif | 28 #endif |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 #if defined(ENABLE_SCREEN_CAPTURE) && defined(OS_ANDROID) | 31 #if defined(ENABLE_SCREEN_CAPTURE) && defined(OS_ANDROID) |
| 32 #include "content/browser/media/capture/screen_capture_device_android.h" | 32 #include "content/browser/media/capture/screen_capture_device_android.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 std::unique_ptr<media::VideoCaptureJpegDecoder> CreateGpuJpegDecoder( | 37 std::unique_ptr<media::VideoCaptureJpegDecoder> CreateGpuJpegDecoder( |
| 38 const media::VideoCaptureJpegDecoder::DecodeDoneCB& decode_done_cb) { | 38 media::VideoCaptureJpegDecoder::DecodeDoneCB decode_done_cb, |
| 39 return base::MakeUnique<content::VideoCaptureGpuJpegDecoder>(decode_done_cb); | 39 base::Callback<void(const std::string&)> send_log_message_cb) { |
| 40 return base::MakeUnique<content::VideoCaptureGpuJpegDecoder>( |
| 41 std::move(decode_done_cb), std::move(send_log_message_cb)); |
| 40 } | 42 } |
| 41 | 43 |
| 42 // The maximum number of video frame buffers in-flight at any one time. This | 44 // The maximum number of video frame buffers in-flight at any one time. This |
| 43 // value should be based on the logical capacity of the capture pipeline, and | 45 // value should be based on the logical capacity of the capture pipeline, and |
| 44 // not on hardware performance. For example, tab capture requires more buffers | 46 // not on hardware performance. For example, tab capture requires more buffers |
| 45 // than webcam capture because the pipeline is longer (it includes read-backs | 47 // than webcam capture because the pipeline is longer (it includes read-backs |
| 46 // pending in the GPU pipeline). | 48 // pending in the GPU pipeline). |
| 47 const int kMaxNumberOfBuffers = 3; | 49 const int kMaxNumberOfBuffers = 3; |
| 48 // TODO(miu): The value for tab capture should be determined programmatically. | 50 // TODO(miu): The value for tab capture should be determined programmatically. |
| 49 // http://crbug.com/460318 | 51 // http://crbug.com/460318 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 new media::VideoCaptureBufferPoolImpl( | 143 new media::VideoCaptureBufferPoolImpl( |
| 142 base::MakeUnique<media::VideoCaptureBufferTrackerFactoryImpl>(), | 144 base::MakeUnique<media::VideoCaptureBufferTrackerFactoryImpl>(), |
| 143 buffer_pool_max_buffer_count); | 145 buffer_pool_max_buffer_count); |
| 144 | 146 |
| 145 return base::MakeUnique<media::VideoCaptureDeviceClient>( | 147 return base::MakeUnique<media::VideoCaptureDeviceClient>( |
| 146 base::MakeUnique<media::VideoFrameReceiverOnTaskRunner>( | 148 base::MakeUnique<media::VideoFrameReceiverOnTaskRunner>( |
| 147 receiver, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)), | 149 receiver, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)), |
| 148 std::move(buffer_pool), | 150 std::move(buffer_pool), |
| 149 base::Bind(&CreateGpuJpegDecoder, | 151 base::Bind(&CreateGpuJpegDecoder, |
| 150 base::Bind(&media::VideoFrameReceiver::OnFrameReadyInBuffer, | 152 base::Bind(&media::VideoFrameReceiver::OnFrameReadyInBuffer, |
| 151 receiver))); | 153 receiver), |
| 154 base::Bind(&media::VideoFrameReceiver::OnLog, receiver))); |
| 152 } | 155 } |
| 153 | 156 |
| 154 void InProcessVideoCaptureDeviceLauncher::OnDeviceStarted( | 157 void InProcessVideoCaptureDeviceLauncher::OnDeviceStarted( |
| 155 Callbacks* callbacks, | 158 Callbacks* callbacks, |
| 156 base::OnceClosure done_cb, | 159 base::OnceClosure done_cb, |
| 157 std::unique_ptr<media::VideoCaptureDevice> device) { | 160 std::unique_ptr<media::VideoCaptureDevice> device) { |
| 158 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 161 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 159 State state_copy = state_; | 162 State state_copy = state_; |
| 160 state_ = State::READY_TO_LAUNCH; | 163 state_ = State::READY_TO_LAUNCH; |
| 161 if (!device) { | 164 if (!device) { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 if (!video_capture_device) { | 280 if (!video_capture_device) { |
| 278 result_callback.Run(nullptr); | 281 result_callback.Run(nullptr); |
| 279 return; | 282 return; |
| 280 } | 283 } |
| 281 | 284 |
| 282 video_capture_device->AllocateAndStart(params, std::move(device_client)); | 285 video_capture_device->AllocateAndStart(params, std::move(device_client)); |
| 283 result_callback.Run(std::move(video_capture_device)); | 286 result_callback.Run(std::move(video_capture_device)); |
| 284 } | 287 } |
| 285 | 288 |
| 286 } // namespace content | 289 } // namespace content |
| OLD | NEW |