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> | 8 #include <stdint.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Get capturing formats supported by this device. | 80 // Get capturing formats supported by this device. |
81 // |callback| will be invoked with the results. | 81 // |callback| will be invoked with the results. |
82 void GetDeviceSupportedFormats(const VideoCaptureDeviceFormatsCB& callback); | 82 void GetDeviceSupportedFormats(const VideoCaptureDeviceFormatsCB& callback); |
83 | 83 |
84 // Get capturing formats currently in use by this device. | 84 // Get capturing formats currently in use by this device. |
85 // |callback| will be invoked with the results. | 85 // |callback| will be invoked with the results. |
86 void GetDeviceFormatsInUse(const VideoCaptureDeviceFormatsCB& callback); | 86 void GetDeviceFormatsInUse(const VideoCaptureDeviceFormatsCB& callback); |
87 | 87 |
88 media::VideoCaptureSessionId session_id() const { return session_id_; } | 88 media::VideoCaptureSessionId session_id() const { return session_id_; } |
89 | 89 |
| 90 protected: |
| 91 // Note: Overridden only by unit test subclasses. |
| 92 virtual void Send(IPC::Message* message); |
| 93 |
90 private: | 94 private: |
91 friend class VideoCaptureImplTest; | 95 friend class VideoCaptureImplTest; |
92 friend class MockVideoCaptureImpl; | 96 friend class MockVideoCaptureImpl; |
93 | 97 |
94 // Carries a shared memory for transferring video frames from browser to | 98 // Carries a shared memory for transferring video frames from browser to |
95 // renderer. | 99 // renderer. |
96 class ClientBuffer; | 100 class ClientBuffer; |
97 class ClientBuffer2; | 101 class ClientBuffer2; |
98 | 102 |
99 // Contains information for a video capture client. Including parameters | 103 // Contains information for a video capture client. Including parameters |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 double consumer_resource_utilization); | 146 double consumer_resource_utilization); |
143 void OnClientBufferFinished2(int buffer_id, | 147 void OnClientBufferFinished2(int buffer_id, |
144 const scoped_refptr<ClientBuffer2>& buffer, | 148 const scoped_refptr<ClientBuffer2>& buffer, |
145 const gpu::SyncToken& release_sync_token, | 149 const gpu::SyncToken& release_sync_token, |
146 double consumer_resource_utilization); | 150 double consumer_resource_utilization); |
147 | 151 |
148 void StopDevice(); | 152 void StopDevice(); |
149 void RestartCapture(); | 153 void RestartCapture(); |
150 void StartCaptureInternal(); | 154 void StartCaptureInternal(); |
151 | 155 |
152 virtual void Send(IPC::Message* message); | |
153 | |
154 // Helpers. | 156 // Helpers. |
155 bool RemoveClient(int client_id, ClientInfoMap* clients); | 157 bool RemoveClient(int client_id, ClientInfoMap* clients); |
156 | 158 |
157 // Called (by an unknown thread) when all consumers are done with a VideoFrame | 159 // Called (by an unknown thread) when all consumers are done with a VideoFrame |
158 // and its ref-count has gone to zero. This helper function grabs the | 160 // and its ref-count has gone to zero. This helper function grabs the |
159 // RESOURCE_UTILIZATION value from the |metadata| and then runs the given | 161 // RESOURCE_UTILIZATION value from the |metadata| and then runs the given |
160 // callback, to trampoline back to the IO thread with the values. | 162 // callback, to trampoline back to the IO thread with the values. |
161 static void DidFinishConsumingFrame( | 163 static void DidFinishConsumingFrame( |
162 const media::VideoFrameMetadata* metadata, | 164 const media::VideoFrameMetadata* metadata, |
163 std::unique_ptr<gpu::SyncToken> release_sync_token, | 165 std::unique_ptr<gpu::SyncToken> release_sync_token, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // in |client_buffers_|. | 205 // in |client_buffers_|. |
204 // NOTE: Weak pointers must be invalidated before all other member variables. | 206 // NOTE: Weak pointers must be invalidated before all other member variables. |
205 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_; | 207 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_; |
206 | 208 |
207 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); | 209 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); |
208 }; | 210 }; |
209 | 211 |
210 } // namespace content | 212 } // namespace content |
211 | 213 |
212 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 214 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
OLD | NEW |