| 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 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <list> | 10 #include <list> |
| 9 #include <map> | 11 #include <map> |
| 10 | 12 |
| 13 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 12 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
| 13 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 14 #include "content/common/media/video_capture.h" | 17 #include "content/common/media/video_capture.h" |
| 15 #include "content/public/renderer/media_stream_video_sink.h" | 18 #include "content/public/renderer/media_stream_video_sink.h" |
| 16 #include "content/renderer/media/video_capture_message_filter.h" | 19 #include "content/renderer/media/video_capture_message_filter.h" |
| 17 #include "media/base/video_capture_types.h" | 20 #include "media/base/video_capture_types.h" |
| 18 | 21 |
| 19 namespace base { | 22 namespace base { |
| 20 class SingleThreadTaskRunner; | 23 class SingleThreadTaskRunner; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 const base::DictionaryValue& metadata, | 121 const base::DictionaryValue& metadata, |
| 119 media::VideoPixelFormat pixel_format, | 122 media::VideoPixelFormat pixel_format, |
| 120 media::VideoFrame::StorageType storage_type, | 123 media::VideoFrame::StorageType storage_type, |
| 121 const gfx::Size& coded_size, | 124 const gfx::Size& coded_size, |
| 122 const gfx::Rect& visible_rect) override; | 125 const gfx::Rect& visible_rect) override; |
| 123 void OnStateChanged(VideoCaptureState state) override; | 126 void OnStateChanged(VideoCaptureState state) override; |
| 124 void OnDeviceSupportedFormatsEnumerated( | 127 void OnDeviceSupportedFormatsEnumerated( |
| 125 const media::VideoCaptureFormats& supported_formats) override; | 128 const media::VideoCaptureFormats& supported_formats) override; |
| 126 void OnDeviceFormatsInUseReceived( | 129 void OnDeviceFormatsInUseReceived( |
| 127 const media::VideoCaptureFormats& formats_in_use) override; | 130 const media::VideoCaptureFormats& formats_in_use) override; |
| 128 void OnDelegateAdded(int32 device_id) override; | 131 void OnDelegateAdded(int32_t device_id) override; |
| 129 | 132 |
| 130 // Sends an IPC message to browser process when all clients are done with the | 133 // Sends an IPC message to browser process when all clients are done with the |
| 131 // buffer. | 134 // buffer. |
| 132 void OnClientBufferFinished(int buffer_id, | 135 void OnClientBufferFinished(int buffer_id, |
| 133 const scoped_refptr<ClientBuffer>& buffer, | 136 const scoped_refptr<ClientBuffer>& buffer, |
| 134 const gpu::SyncToken& release_sync_token, | 137 const gpu::SyncToken& release_sync_token, |
| 135 double consumer_resource_utilization); | 138 double consumer_resource_utilization); |
| 136 void OnClientBufferFinished2(int buffer_id, | 139 void OnClientBufferFinished2(int buffer_id, |
| 137 const scoped_refptr<ClientBuffer2>& buffer, | 140 const scoped_refptr<ClientBuffer2>& buffer, |
| 138 const gpu::SyncToken& release_sync_token, | 141 const gpu::SyncToken& release_sync_token, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 161 const int session_id_; | 164 const int session_id_; |
| 162 | 165 |
| 163 // Vector of callbacks to be notified of device format enumerations, used only | 166 // Vector of callbacks to be notified of device format enumerations, used only |
| 164 // on IO Thread. | 167 // on IO Thread. |
| 165 std::vector<VideoCaptureDeviceFormatsCB> device_formats_cb_queue_; | 168 std::vector<VideoCaptureDeviceFormatsCB> device_formats_cb_queue_; |
| 166 // Vector of callbacks to be notified of a device's in use capture format(s), | 169 // Vector of callbacks to be notified of a device's in use capture format(s), |
| 167 // used only on IO Thread. | 170 // used only on IO Thread. |
| 168 std::vector<VideoCaptureDeviceFormatsCB> device_formats_in_use_cb_queue_; | 171 std::vector<VideoCaptureDeviceFormatsCB> device_formats_in_use_cb_queue_; |
| 169 | 172 |
| 170 // Buffers available for sending to the client. | 173 // Buffers available for sending to the client. |
| 171 typedef std::map<int32, scoped_refptr<ClientBuffer>> ClientBufferMap; | 174 typedef std::map<int32_t, scoped_refptr<ClientBuffer>> ClientBufferMap; |
| 172 ClientBufferMap client_buffers_; | 175 ClientBufferMap client_buffers_; |
| 173 typedef std::map<int32, scoped_refptr<ClientBuffer2>> ClientBuffer2Map; | 176 typedef std::map<int32_t, scoped_refptr<ClientBuffer2>> ClientBuffer2Map; |
| 174 ClientBuffer2Map client_buffer2s_; | 177 ClientBuffer2Map client_buffer2s_; |
| 175 | 178 |
| 176 ClientInfoMap clients_; | 179 ClientInfoMap clients_; |
| 177 ClientInfoMap clients_pending_on_filter_; | 180 ClientInfoMap clients_pending_on_filter_; |
| 178 ClientInfoMap clients_pending_on_restart_; | 181 ClientInfoMap clients_pending_on_restart_; |
| 179 | 182 |
| 180 // Member params_ represents the video format requested by the | 183 // Member params_ represents the video format requested by the |
| 181 // client to this class via StartCapture(). | 184 // client to this class via StartCapture(). |
| 182 media::VideoCaptureParams params_; | 185 media::VideoCaptureParams params_; |
| 183 | 186 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 195 // in |client_buffers_|. | 198 // in |client_buffers_|. |
| 196 // NOTE: Weak pointers must be invalidated before all other member variables. | 199 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 197 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_; | 200 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_; |
| 198 | 201 |
| 199 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); | 202 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); |
| 200 }; | 203 }; |
| 201 | 204 |
| 202 } // namespace content | 205 } // namespace content |
| 203 | 206 |
| 204 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 207 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
| OLD | NEW |