| 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_controller.h" | 5 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 17 #include "base/metrics/sparse_histogram.h" | 17 #include "base/metrics/sparse_histogram.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "components/display_compositor/gl_helper.h" | 19 #include "components/display_compositor/gl_helper.h" |
| 20 #include "content/browser/renderer_host/media/media_stream_manager.h" | 20 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 21 #include "content/browser/renderer_host/media/video_capture_buffer_tracker_facto
ry_impl.h" | |
| 22 #include "content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h" | 21 #include "content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h" |
| 23 #include "content/browser/renderer_host/media/video_capture_manager.h" | 22 #include "content/browser/renderer_host/media/video_capture_manager.h" |
| 24 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 25 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
| 26 #include "media/base/video_frame.h" | 25 #include "media/base/video_frame.h" |
| 27 #include "media/capture/video/video_capture_buffer_pool_impl.h" | 26 #include "media/capture/video/video_capture_buffer_pool_impl.h" |
| 27 #include "media/capture/video/video_capture_buffer_tracker_factory_impl.h" |
| 28 #include "media/capture/video/video_capture_device_client.h" | 28 #include "media/capture/video/video_capture_device_client.h" |
| 29 | 29 |
| 30 #if !defined(OS_ANDROID) | 30 #if !defined(OS_ANDROID) |
| 31 #include "content/browser/compositor/image_transport_factory.h" | 31 #include "content/browser/compositor/image_transport_factory.h" |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 using media::VideoCaptureFormat; | 34 using media::VideoCaptureFormat; |
| 35 using media::VideoFrame; | 35 using media::VideoFrame; |
| 36 using media::VideoFrameMetadata; | 36 using media::VideoFrameMetadata; |
| 37 | 37 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // simplify the code in both places. | 167 // simplify the code in both places. |
| 168 bool session_closed; | 168 bool session_closed; |
| 169 | 169 |
| 170 // Indicates whether the client is paused, if true, VideoCaptureController | 170 // Indicates whether the client is paused, if true, VideoCaptureController |
| 171 // stops updating its buffer. | 171 // stops updating its buffer. |
| 172 bool paused; | 172 bool paused; |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 VideoCaptureController::VideoCaptureController(int max_buffers) | 175 VideoCaptureController::VideoCaptureController(int max_buffers) |
| 176 : buffer_pool_(new media::VideoCaptureBufferPoolImpl( | 176 : buffer_pool_(new media::VideoCaptureBufferPoolImpl( |
| 177 base::MakeUnique<VideoCaptureBufferTrackerFactoryImpl>(), | 177 base::MakeUnique<media::VideoCaptureBufferTrackerFactoryImpl>(), |
| 178 max_buffers)), | 178 max_buffers)), |
| 179 state_(VIDEO_CAPTURE_STATE_STARTED), | 179 state_(VIDEO_CAPTURE_STATE_STARTED), |
| 180 has_received_frames_(false), | 180 has_received_frames_(false), |
| 181 weak_ptr_factory_(this) { | 181 weak_ptr_factory_(this) { |
| 182 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 182 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 183 } | 183 } |
| 184 | 184 |
| 185 base::WeakPtr<VideoCaptureController> | 185 base::WeakPtr<VideoCaptureController> |
| 186 VideoCaptureController::GetWeakPtrForIOThread() { | 186 VideoCaptureController::GetWeakPtrForIOThread() { |
| 187 return weak_ptr_factory_.GetWeakPtr(); | 187 return weak_ptr_factory_.GetWeakPtr(); |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 int session_id, | 530 int session_id, |
| 531 const ControllerClients& clients) { | 531 const ControllerClients& clients) { |
| 532 for (const auto& client : clients) { | 532 for (const auto& client : clients) { |
| 533 if (client->session_id == session_id) | 533 if (client->session_id == session_id) |
| 534 return client.get(); | 534 return client.get(); |
| 535 } | 535 } |
| 536 return nullptr; | 536 return nullptr; |
| 537 } | 537 } |
| 538 | 538 |
| 539 } // namespace content | 539 } // namespace content |
| OLD | NEW |