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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // Get capturing formats currently in use by this device. | 59 // Get capturing formats currently in use by this device. |
60 // |callback| will be invoked with the results. | 60 // |callback| will be invoked with the results. |
61 void GetDeviceFormatsInUse(const VideoCaptureDeviceFormatsCB& callback); | 61 void GetDeviceFormatsInUse(const VideoCaptureDeviceFormatsCB& callback); |
62 | 62 |
63 media::VideoCaptureSessionId session_id() const { return session_id_; } | 63 media::VideoCaptureSessionId session_id() const { return session_id_; } |
64 | 64 |
65 void SetVideoCaptureHostForTesting(mojom::VideoCaptureHost* service) { | 65 void SetVideoCaptureHostForTesting(mojom::VideoCaptureHost* service) { |
66 video_capture_host_for_testing_ = service; | 66 video_capture_host_for_testing_ = service; |
67 } | 67 } |
68 | 68 |
| 69 // mojom::VideoCaptureObserver implementation. |
| 70 void OnStateChanged(mojom::VideoCaptureState state) override; |
| 71 void OnBufferCreated(int32_t buffer_id, |
| 72 mojo::ScopedSharedBufferHandle handle) override; |
| 73 void OnBufferReady(int32_t buffer_id, |
| 74 media::mojom::VideoFrameInfoPtr info) override; |
| 75 void OnBufferDestroyed(int32_t buffer_id) override; |
| 76 |
69 private: | 77 private: |
70 friend class VideoCaptureImplTest; | 78 friend class VideoCaptureImplTest; |
71 friend class MockVideoCaptureImpl; | 79 friend class MockVideoCaptureImpl; |
72 | 80 |
73 // Carries a shared memory for transferring video frames from browser to | 81 // Carries a shared memory for transferring video frames from browser to |
74 // renderer. | 82 // renderer. |
75 class ClientBuffer; | 83 class ClientBuffer; |
76 | 84 |
77 // Contains information about a video capture client, including capture | 85 // Contains information about a video capture client, including capture |
78 // parameters callbacks to the client. | 86 // parameters callbacks to the client. |
79 struct ClientInfo; | 87 struct ClientInfo; |
80 using ClientInfoMap = std::map<int, ClientInfo>; | 88 using ClientInfoMap = std::map<int, ClientInfo>; |
81 | 89 |
82 using BufferFinishedCallback = | 90 using BufferFinishedCallback = |
83 base::Callback<void(double consumer_resource_utilization)>; | 91 base::Callback<void(double consumer_resource_utilization)>; |
84 | 92 |
85 // mojom::VideoCaptureObserver implementation. | |
86 void OnStateChanged(mojom::VideoCaptureState state) override; | |
87 void OnBufferCreated(int32_t buffer_id, | |
88 mojo::ScopedSharedBufferHandle handle) override; | |
89 void OnBufferReady(int32_t buffer_id, | |
90 media::mojom::VideoFrameInfoPtr info) override; | |
91 void OnBufferDestroyed(int32_t buffer_id) override; | |
92 | |
93 // Sends an IPC message to browser process when all clients are done with the | 93 // Sends an IPC message to browser process when all clients are done with the |
94 // buffer. | 94 // buffer. |
95 void OnClientBufferFinished(int buffer_id, | 95 void OnClientBufferFinished(int buffer_id, |
96 const scoped_refptr<ClientBuffer>& buffer, | 96 const scoped_refptr<ClientBuffer>& buffer, |
97 double consumer_resource_utilization); | 97 double consumer_resource_utilization); |
98 | 98 |
99 void StopDevice(); | 99 void StopDevice(); |
100 void RestartCapture(); | 100 void RestartCapture(); |
101 void StartCaptureInternal(); | 101 void StartCaptureInternal(); |
102 | 102 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // media::VideoFrames constructed in OnBufferReceived() from buffers cached | 155 // media::VideoFrames constructed in OnBufferReceived() from buffers cached |
156 // in |client_buffers_|. | 156 // in |client_buffers_|. |
157 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_; | 157 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_; |
158 | 158 |
159 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); | 159 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); |
160 }; | 160 }; |
161 | 161 |
162 } // namespace content | 162 } // namespace content |
163 | 163 |
164 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 164 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
OLD | NEW |