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 VideoCaptureHost, | 5 // VideoCaptureController is the glue between VideoCaptureHost, |
6 // VideoCaptureManager and VideoCaptureDevice. | 6 // VideoCaptureManager and VideoCaptureDevice. |
7 // It provides functions for VideoCaptureHost to start a VideoCaptureDevice and | 7 // It provides functions for VideoCaptureHost to start a VideoCaptureDevice and |
8 // is responsible for keeping track of shared DIBs and filling them with I420 | 8 // is responsible for keeping track of shared DIBs and filling them with I420 |
9 // video frames for IPC communication between VideoCaptureHost and | 9 // video frames for IPC communication between VideoCaptureHost and |
10 // VideoCaptureMessageFilter. | 10 // VideoCaptureMessageFilter. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 friend class base::RefCountedThreadSafe<VideoCaptureController>; | 81 friend class base::RefCountedThreadSafe<VideoCaptureController>; |
82 | 82 |
83 struct ControllerClient; | 83 struct ControllerClient; |
84 typedef std::list<ControllerClient*> ControllerClients; | 84 typedef std::list<ControllerClient*> ControllerClients; |
85 | 85 |
86 // Callback when manager has stopped device. | 86 // Callback when manager has stopped device. |
87 void OnDeviceStopped(); | 87 void OnDeviceStopped(); |
88 | 88 |
89 // Worker functions on IO thread. | 89 // Worker functions on IO thread. |
90 void DoIncomingCapturedFrameOnIOThread(int buffer_id, base::Time timestamp); | 90 void DoIncomingCapturedFrameOnIOThread(int buffer_id, base::Time timestamp); |
91 void DoFrameInfoOnIOThread(const media::VideoCaptureCapability& info); | 91 void DoFrameInfoOnIOThread(); |
92 void DoErrorOnIOThread(); | 92 void DoErrorOnIOThread(); |
93 void DoDeviceStoppedOnIOThread(); | 93 void DoDeviceStoppedOnIOThread(); |
94 | 94 |
95 // Send frame info and init buffers to |client|. | 95 // Send frame info and init buffers to |client|. |
96 void SendFrameInfoAndBuffers(ControllerClient* client, int buffer_size); | 96 void SendFrameInfoAndBuffers(ControllerClient* client, int buffer_size); |
97 | 97 |
98 // Helpers. | 98 // Helpers. |
99 // Find a client of |id| and |handler| in |clients|. | 99 // Find a client of |id| and |handler| in |clients|. |
100 ControllerClient* FindClient( | 100 ControllerClient* FindClient( |
101 const VideoCaptureControllerID& id, | 101 const VideoCaptureControllerID& id, |
(...skipping 23 matching lines...) Expand all Loading... |
125 | 125 |
126 // All clients waiting for service. | 126 // All clients waiting for service. |
127 ControllerClients pending_clients_; | 127 ControllerClients pending_clients_; |
128 | 128 |
129 // The parameter that currently used for the capturing. | 129 // The parameter that currently used for the capturing. |
130 media::VideoCaptureParams current_params_; | 130 media::VideoCaptureParams current_params_; |
131 | 131 |
132 // It's modified on caller thread, assuming there is only one OnFrameInfo() | 132 // It's modified on caller thread, assuming there is only one OnFrameInfo() |
133 // call per StartCapture(). | 133 // call per StartCapture(). |
134 media::VideoCaptureCapability frame_info_; | 134 media::VideoCaptureCapability frame_info_; |
| 135 // Chopped pixels in width/height in case video capture device has odd numbers |
| 136 // for width/height. |
| 137 int chopped_width_; |
| 138 int chopped_height_; |
135 | 139 |
136 // It's accessed only on IO thread. | 140 // It's accessed only on IO thread. |
137 bool frame_info_available_; | 141 bool frame_info_available_; |
138 | 142 |
139 media_stream::VideoCaptureManager* video_capture_manager_; | 143 media_stream::VideoCaptureManager* video_capture_manager_; |
140 | 144 |
141 bool device_in_use_; | 145 bool device_in_use_; |
142 video_capture::State state_; | 146 video_capture::State state_; |
143 | 147 |
144 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureController); | 148 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureController); |
145 }; | 149 }; |
146 | 150 |
147 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 151 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
OLD | NEW |