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 // VideoCaptureController is the glue between a VideoCaptureDevice and all | 5 // VideoCaptureController is the glue between a VideoCaptureDevice and all |
6 // VideoCaptureHosts that have connected to it. A controller exists on behalf of | 6 // VideoCaptureHosts that have connected to it. A controller exists on behalf of |
7 // one (and only one) VideoCaptureDevice; both are owned by the | 7 // one (and only one) VideoCaptureDevice; both are owned by the |
8 // VideoCaptureManager. | 8 // VideoCaptureManager. |
9 // | 9 // |
10 // The VideoCaptureController is responsible for: | 10 // The VideoCaptureController is responsible for: |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // API called directly by VideoCaptureManager in case the device is | 97 // API called directly by VideoCaptureManager in case the device is |
98 // prematurely closed. | 98 // prematurely closed. |
99 void StopSession(int session_id); | 99 void StopSession(int session_id); |
100 | 100 |
101 // Return a buffer previously given in | 101 // Return a buffer previously given in |
102 // VideoCaptureControllerEventHandler::OnBufferReady. | 102 // VideoCaptureControllerEventHandler::OnBufferReady. |
103 void ReturnBuffer(const VideoCaptureControllerID& id, | 103 void ReturnBuffer(const VideoCaptureControllerID& id, |
104 VideoCaptureControllerEventHandler* event_handler, | 104 VideoCaptureControllerEventHandler* event_handler, |
105 int buffer_id); | 105 int buffer_id); |
106 | 106 |
107 const media::VideoCaptureFormat& GetVideoCaptureFormat() const; | |
108 | |
109 private: | 107 private: |
110 class VideoCaptureDeviceClient; | 108 class VideoCaptureDeviceClient; |
111 | 109 |
112 struct ControllerClient; | 110 struct ControllerClient; |
113 typedef std::list<ControllerClient*> ControllerClients; | 111 typedef std::list<ControllerClient*> ControllerClients; |
114 | 112 |
115 // Worker functions on IO thread. Called by the VideoCaptureDeviceClient. | 113 // Worker functions on IO thread. Called by the VideoCaptureDeviceClient. |
116 void DoIncomingCapturedFrameOnIOThread( | 114 void DoIncomingCapturedFrameOnIOThread( |
117 const scoped_refptr<media::VideoFrame>& captured_frame, | 115 const scoped_refptr<media::VideoFrame>& captured_frame, |
118 int frame_rate, | 116 int frame_rate, |
(...skipping 16 matching lines...) Expand all Loading... |
135 // The pool of shared-memory buffers used for capturing. | 133 // The pool of shared-memory buffers used for capturing. |
136 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; | 134 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; |
137 | 135 |
138 // All clients served by this controller. | 136 // All clients served by this controller. |
139 ControllerClients controller_clients_; | 137 ControllerClients controller_clients_; |
140 | 138 |
141 // Takes on only the states 'STARTED' and 'ERROR'. 'ERROR' is an absorbing | 139 // Takes on only the states 'STARTED' and 'ERROR'. 'ERROR' is an absorbing |
142 // state which stops the flow of data to clients. | 140 // state which stops the flow of data to clients. |
143 VideoCaptureState state_; | 141 VideoCaptureState state_; |
144 | 142 |
145 media::VideoCaptureFormat video_capture_format_; | |
146 | |
147 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; | 143 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; |
148 | 144 |
149 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); | 145 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); |
150 }; | 146 }; |
151 | 147 |
152 } // namespace content | 148 } // namespace content |
153 | 149 |
154 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 150 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
OLD | NEW |