Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: content/browser/renderer_host/media/video_capture_manager.cc

Issue 7192007: Adding error signalling from device to VideocaptureManager to relay up to MediaStream and WebKit. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "content/browser/renderer_host/media/video_capture_manager.h" 5 #include "content/browser/renderer_host/media/video_capture_manager.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "content/browser/browser_thread.h" 8 #include "content/browser/browser_thread.h"
9 #include "media/video/capture/fake_video_capture_device.h" 9 #include "media/video/capture/fake_video_capture_device.h"
10 #include "media/video/capture/video_capture_device.h" 10 #include "media/video/capture/video_capture_device.h"
11 11
12 namespace media_stream { 12 namespace media_stream {
13 13
14 // Starting id for the first capture session. 14 // Starting id for the first capture session.
15 // VideoCaptureManager::kStartOpenSessionId is used as default id without 15 // VideoCaptureManager::kStartOpenSessionId is used as default id without
16 // explicitly calling open device. 16 // explicitly calling open device.
17 enum { kFirstSessionId = VideoCaptureManager::kStartOpenSessionId + 1 }; 17 enum { kFirstSessionId = VideoCaptureManager::kStartOpenSessionId + 1 };
18 18
19 static ::base::LazyInstance<VideoCaptureManager> g_video_capture_manager( 19 static ::base::LazyInstance<VideoCaptureManager> g_video_capture_manager(
20 base::LINKER_INITIALIZED); 20 base::LINKER_INITIALIZED);
21 21
22 VideoCaptureManager* VideoCaptureManager::Get() { 22 VideoCaptureManager* VideoCaptureManager::Get() {
23 return g_video_capture_manager.Pointer(); 23 return g_video_capture_manager.Pointer();
24 } 24 }
25 25
26 VideoCaptureManager::VideoCaptureManager() 26 VideoCaptureManager::VideoCaptureManager()
27 : vc_device_thread_("VideoCaptureManagerThread"), 27 : vc_device_thread_("VideoCaptureManagerThread"),
28 listener_(NULL), 28 listener_(NULL),
29 new_capture_session_id_(kFirstSessionId), 29 new_capture_session_id_(kFirstSessionId),
30 devices_(), 30 devices_(),
Leandro Graciá Gil 2011/06/16 17:39:53 The default constructor will be automatically call
mflodman1 2011/06/20 19:48:03 Done. This was mainly to point out it's initialize
31 use_fake_device_(false) { 31 use_fake_device_(false) {
32 vc_device_thread_.Start(); 32 vc_device_thread_.Start();
33 } 33 }
34 34
35 VideoCaptureManager::~VideoCaptureManager() { 35 VideoCaptureManager::~VideoCaptureManager() {
Leandro Graciá Gil 2011/06/16 17:39:53 You should delete the entries of your devices_ map
mflodman1 2011/06/20 19:48:03 This should never happen, classes "above" should t
36 vc_device_thread_.Stop(); 36 vc_device_thread_.Stop();
37 } 37 }
38 38
39 bool VideoCaptureManager::Register(MediaStreamProviderListener* listener) { 39 void VideoCaptureManager::Register(MediaStreamProviderListener* listener) {
40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
41 DCHECK(!listener_);
John Knottenbelt 2011/06/16 15:20:43 Why is this check is no longer appropriate? If it
mflodman1 2011/06/20 19:48:03 Added DCHECK in both places to track possible user
42 listener_ = listener; 41 listener_ = listener;
43 return true;
44 } 42 }
45 43
46 void VideoCaptureManager::Unregister() { 44 void VideoCaptureManager::Unregister() {
47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
48 listener_ = NULL; 46 listener_ = NULL;
49 } 47 }
50 48
51 void VideoCaptureManager::EnumerateDevices() { 49 void VideoCaptureManager::EnumerateDevices() {
52 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
53 DCHECK(listener_); 51 DCHECK(listener_);
54 52
55 vc_device_thread_.message_loop()->PostTask( 53 vc_device_thread_.message_loop()->PostTask(
56 FROM_HERE, 54 FROM_HERE,
57 NewRunnableMethod(this, 55 NewRunnableMethod(this,
58 &VideoCaptureManager::OnEnumerateDevices)); 56 &VideoCaptureManager::OnEnumerateDevices));
59 } 57 }
60 58
61 MediaCaptureSessionId VideoCaptureManager::Open( 59 int VideoCaptureManager::Open(const StreamDeviceInfo& device) {
62 const MediaCaptureDeviceInfo& device) {
63 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
64 DCHECK(listener_); 61 DCHECK(listener_);
65 62
66 // Generate a new id for this device 63 // Generate a new id for this device
67 MediaCaptureSessionId video_capture_session_id = new_capture_session_id_++; 64 int video_capture_session_id = new_capture_session_id_++;
68 65
69 vc_device_thread_.message_loop()->PostTask( 66 vc_device_thread_.message_loop()->PostTask(
70 FROM_HERE, 67 FROM_HERE,
71 NewRunnableMethod(this, 68 NewRunnableMethod(this,
72 &VideoCaptureManager::OnOpen, 69 &VideoCaptureManager::OnOpen,
73 video_capture_session_id, 70 video_capture_session_id,
74 device)); 71 device));
75 72
76 return video_capture_session_id; 73 return video_capture_session_id;
77 } 74 }
78 75
79 void VideoCaptureManager::Close(MediaCaptureSessionId capture_session_id) { 76 void VideoCaptureManager::Close(int capture_session_id) {
80 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 77 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
81 DCHECK(listener_); 78 DCHECK(listener_);
82 79
83 vc_device_thread_.message_loop()->PostTask( 80 vc_device_thread_.message_loop()->PostTask(
84 FROM_HERE, 81 FROM_HERE,
85 NewRunnableMethod(this, 82 NewRunnableMethod(this,
86 &VideoCaptureManager::OnClose, 83 &VideoCaptureManager::OnClose,
87 capture_session_id)); 84 capture_session_id));
88 } 85 }
89 86
(...skipping 15 matching lines...) Expand all
105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
106 103
107 vc_device_thread_.message_loop()->PostTask( 104 vc_device_thread_.message_loop()->PostTask(
108 FROM_HERE, 105 FROM_HERE,
109 NewRunnableMethod(this, 106 NewRunnableMethod(this,
110 &VideoCaptureManager::OnStop, 107 &VideoCaptureManager::OnStop,
111 capture_session_id, 108 capture_session_id,
112 stopped_task)); 109 stopped_task));
113 } 110 }
114 111
112 void VideoCaptureManager::Error(
113 const media::VideoCaptureSessionId capture_session_id) {
114 PostOnError(capture_session_id, kDeviceNotAvailable);
115 }
116
115 void VideoCaptureManager::UseFakeDevice() { 117 void VideoCaptureManager::UseFakeDevice() {
116 use_fake_device_ = true; 118 use_fake_device_ = true;
117 } 119 }
118 120
119 MessageLoop* VideoCaptureManager::GetMessageLoop() { 121 MessageLoop* VideoCaptureManager::GetMessageLoop() {
120 return vc_device_thread_.message_loop(); 122 return vc_device_thread_.message_loop();
121 } 123 }
122 124
123 void VideoCaptureManager::OnEnumerateDevices() { 125 void VideoCaptureManager::OnEnumerateDevices() {
124 DCHECK(IsOnCaptureDeviceThread()); 126 DCHECK(IsOnCaptureDeviceThread());
125 127
126 scoped_ptr<media::VideoCaptureDevice::Names> device_names( 128 scoped_ptr<media::VideoCaptureDevice::Names> device_names(
Leandro Graciá Gil 2011/06/16 17:39:53 If I'm not wrong this is a scoped_ptr to a pointer
mflodman1 2011/06/20 19:48:03 Changed to not using scoped_ptr. This was left aft
127 new media::VideoCaptureDevice::Names()); 129 new media::VideoCaptureDevice::Names());
128 GetAvailableDevices(device_names.get()); 130 GetAvailableDevices(device_names.get());
129 131
130 MediaCaptureDevices devices; 132 StreamDeviceInfoArray devices;
131 for (media::VideoCaptureDevice::Names::iterator it = 133 for (media::VideoCaptureDevice::Names::iterator it =
132 device_names.get()->begin(); it != device_names.get()->end(); ++it) { 134 device_names.get()->begin(); it != device_names.get()->end(); ++it) {
133 bool opened = DeviceOpened(*it); 135 bool opened = DeviceOpened(*it);
134 devices.push_back(MediaCaptureDeviceInfo(kVideoCapture, it->device_name, 136 devices.push_back(StreamDeviceInfo(kVideoCapture, it->device_name,
135 it->unique_id, opened)); 137 it->unique_id, opened));
136 } 138 }
137 139
138 PostOnDevicesEnumerated(devices); 140 PostOnDevicesEnumerated(devices);
139 141
140 // Clean-up 142 // Clean-up
141 devices.clear(); 143 devices.clear();
Leandro Graciá Gil 2011/06/16 17:39:53 I think this happens automatically with the destru
mflodman1 2011/06/20 19:48:03 Done. You're of course right about elements being
142 device_names.get()->clear(); 144 device_names.get()->clear();
Leandro Graciá Gil 2011/06/16 17:39:53 Independently of the comment about the type, if yo
mflodman1 2011/06/20 19:48:03 Removed.
143 } 145 }
144 146
145 void VideoCaptureManager::OnOpen(MediaCaptureSessionId capture_session_id, 147 void VideoCaptureManager::OnOpen(int capture_session_id,
146 const MediaCaptureDeviceInfo device) { 148 const StreamDeviceInfo device) {
147 DCHECK(IsOnCaptureDeviceThread()); 149 DCHECK(IsOnCaptureDeviceThread());
148 DCHECK(devices_.find(capture_session_id) == devices_.end()); 150 DCHECK(devices_.find(capture_session_id) == devices_.end());
149 151
150 // Check if another session has already opened this device, only one user per 152 // Check if another session has already opened this device, only one user per
151 // device is supported. 153 // device is supported.
152 if (DeviceOpened(device)) { 154 if (DeviceOpened(device)) {
153 PostOnError(capture_session_id, kDeviceAlreadyInUse); 155 PostOnError(capture_session_id, kDeviceAlreadyInUse);
154 return; 156 return;
155 } 157 }
156 158
(...skipping 11 matching lines...) Expand all
168 } 170 }
169 if (video_capture_device == NULL) { 171 if (video_capture_device == NULL) {
170 PostOnError(capture_session_id, kDeviceNotAvailable); 172 PostOnError(capture_session_id, kDeviceNotAvailable);
171 return; 173 return;
172 } 174 }
173 175
174 devices_[capture_session_id] = video_capture_device; 176 devices_[capture_session_id] = video_capture_device;
175 PostOnOpened(capture_session_id); 177 PostOnOpened(capture_session_id);
176 } 178 }
177 179
178 void VideoCaptureManager::OnClose( 180 void VideoCaptureManager::OnClose(int capture_session_id) {
179 MediaCaptureSessionId capture_session_id) {
180 DCHECK(IsOnCaptureDeviceThread()); 181 DCHECK(IsOnCaptureDeviceThread());
181 182
182 VideoCaptureDevices::iterator it = devices_.find(capture_session_id); 183 VideoCaptureDevices::iterator it = devices_.find(capture_session_id);
183 if (it != devices_.end()) { 184 if (it != devices_.end()) {
184 // Deallocate (if not done already) and delete the device 185 // Deallocate (if not done already) and delete the device
185 media::VideoCaptureDevice* video_capture_device = it->second; 186 media::VideoCaptureDevice* video_capture_device = it->second;
186 video_capture_device->DeAllocate(); 187 video_capture_device->DeAllocate();
187 delete video_capture_device; 188 delete video_capture_device;
188 devices_.erase(it); 189 devices_.erase(it);
189 } 190 }
190 191
191 PostOnClosed(capture_session_id); 192 PostOnClosed(capture_session_id);
192 } 193 }
193 194
194 void VideoCaptureManager::OnStart( 195 void VideoCaptureManager::OnStart(
195 const media::VideoCaptureParams capture_params, 196 const media::VideoCaptureParams capture_params,
196 media::VideoCaptureDevice::EventHandler* video_capture_receiver) { 197 media::VideoCaptureDevice::EventHandler* video_capture_receiver) {
197 DCHECK(IsOnCaptureDeviceThread()); 198 DCHECK(IsOnCaptureDeviceThread());
198 199
199 // Solution for not using MediaStreamManager 200 // Solution for not using MediaStreamManager
200 // This session id won't be returned by Open() 201 // This session id won't be returned by Open()
201 if (capture_params.session_id == kStartOpenSessionId) { 202 if (capture_params.session_id == kStartOpenSessionId) {
202 // Start() is called without using Open(), we need to open a device 203 // Start() is called without using Open(), we need to open a device
203 scoped_ptr<media::VideoCaptureDevice::Names> device_names( 204 scoped_ptr<media::VideoCaptureDevice::Names> device_names(
204 new media::VideoCaptureDevice::Names()); 205 new media::VideoCaptureDevice::Names());
205 GetAvailableDevices(device_names.get()); 206 GetAvailableDevices(device_names.get());
John Knottenbelt 2011/06/16 15:20:43 Is it possible for device_names to be empty after
mflodman1 2011/06/20 19:48:03 Good point. Rewritten based on feedback above and
206 207
207 MediaCaptureDeviceInfo device(kVideoCapture, 208 StreamDeviceInfo device(kVideoCapture,
208 device_names.get()->front().device_name, 209 device_names.get()->front().device_name,
209 device_names.get()->front().unique_id, false); 210 device_names.get()->front().unique_id, false);
210 211
211 // Call OnOpen to open using the first device in the list 212 // Call OnOpen to open using the first device in the list
212 OnOpen(capture_params.session_id, device); 213 OnOpen(capture_params.session_id, device);
213 } 214 }
214 215
215 VideoCaptureDevices::iterator it = devices_.find(capture_params.session_id); 216 VideoCaptureDevices::iterator it = devices_.find(capture_params.session_id);
216 if (it == devices_.end()) { 217 if (it == devices_.end()) {
217 // Invalid session id 218 // Invalid session id
218 video_capture_receiver->OnError(); 219 video_capture_receiver->OnError();
Leandro Graciá Gil 2011/06/16 17:39:53 Since you're using pointers for this a DCHECK woul
mflodman1 2011/06/20 19:48:03 Done, but at top of functions since the pointer is
219 return; 220 return;
220 } 221 }
221 media::VideoCaptureDevice* video_capture_device = it->second; 222 media::VideoCaptureDevice* video_capture_device = it->second;
222 223
223 // Possible errors are signaled to video_capture_receiver by 224 // Possible errors are signaled to video_capture_receiver by
224 // video_capture_device. video_capture_receiver to perform actions. 225 // video_capture_device. video_capture_receiver to perform actions.
225 video_capture_device->Allocate(capture_params.width, capture_params.height, 226 video_capture_device->Allocate(capture_params.width, capture_params.height,
226 capture_params.frame_per_second, 227 capture_params.frame_per_second,
227 video_capture_receiver); 228 video_capture_receiver);
228 video_capture_device->Start(); 229 video_capture_device->Start();
229 } 230 }
230 231
231 void VideoCaptureManager::OnStop( 232 void VideoCaptureManager::OnStop(
232 const media::VideoCaptureSessionId capture_session_id, 233 const media::VideoCaptureSessionId capture_session_id,
233 Task* stopped_task) { 234 Task* stopped_task) {
234 DCHECK(IsOnCaptureDeviceThread()); 235 DCHECK(IsOnCaptureDeviceThread());
235 236
236 VideoCaptureDevices::iterator it = devices_.find(capture_session_id); 237 VideoCaptureDevices::iterator it = devices_.find(capture_session_id);
237 if (it != devices_.end()) { 238 if (it != devices_.end()) {
238 media::VideoCaptureDevice* video_capture_device = it->second; 239 media::VideoCaptureDevice* video_capture_device = it->second;
239 // Possible errors are signaled to video_capture_receiver by 240 // Possible errors are signaled to video_capture_receiver by
240 // video_capture_device. video_capture_receiver to perform actions. 241 // video_capture_device. video_capture_receiver to perform actions.
241 video_capture_device->Stop(); 242 video_capture_device->Stop();
242 video_capture_device->DeAllocate(); 243 video_capture_device->DeAllocate();
243 } 244 }
244 245
245 if (stopped_task) { 246 if (stopped_task) {
246 stopped_task->Run(); 247 stopped_task->Run();
247 delete stopped_task; 248 delete stopped_task;
Leandro Graciá Gil 2011/06/16 17:39:53 I have no idea of how this works but it looks a bi
mflodman1 2011/06/20 19:48:03 This was introduced when implementing OnChannelClo
248 } 249 }
249 250
250 if (capture_session_id == kStartOpenSessionId) { 251 if (capture_session_id == kStartOpenSessionId) {
251 // This device was opened from Start(), not Open(). Close it! 252 // This device was opened from Start(), not Open(). Close it!
252 OnClose(capture_session_id); 253 OnClose(capture_session_id);
253 } 254 }
254 } 255 }
255 256
256 void VideoCaptureManager::OnOpened( 257 void VideoCaptureManager::OnOpened(int capture_session_id) {
257 MediaCaptureSessionId capture_session_id) {
258 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 258 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
259 if (listener_ == NULL) { 259 if (listener_ == NULL) {
260 // Listener has been removed 260 // Listener has been removed
261 return; 261 return;
262 } 262 }
263 listener_->Opened(kVideoCapture, capture_session_id); 263 listener_->Opened(kVideoCapture, capture_session_id);
264 } 264 }
265 265
266 void VideoCaptureManager::OnClosed( 266 void VideoCaptureManager::OnClosed(int capture_session_id) {
267 MediaCaptureSessionId capture_session_id) {
268 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 267 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
269 if (listener_ == NULL) { 268 if (listener_ == NULL) {
270 // Listener has been removed 269 // Listener has been removed
271 return; 270 return;
272 } 271 }
273 listener_->Closed(kVideoCapture, capture_session_id); 272 listener_->Closed(kVideoCapture, capture_session_id);
274 } 273 }
275 274
276 void VideoCaptureManager::OnDevicesEnumerated( 275 void VideoCaptureManager::OnDevicesEnumerated(
277 const MediaCaptureDevices& devices) { 276 const StreamDeviceInfoArray& devices) {
278 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 277 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
279 if (listener_ == NULL) { 278 if (listener_ == NULL) {
Leandro Graciá Gil 2011/06/16 17:39:53 I think style says we should use if (!listener_) i
mflodman1 2011/06/20 19:48:03 Done.
280 // Listener has been removed 279 // Listener has been removed
281 return; 280 return;
282 } 281 }
283 listener_->DevicesEnumerated(kVideoCapture, devices); 282 listener_->DevicesEnumerated(kVideoCapture, devices);
284 } 283 }
285 284
286 void VideoCaptureManager::OnError(MediaCaptureSessionId capture_session_id, 285 void VideoCaptureManager::OnError(int capture_session_id,
287 MediaStreamProviderError error) { 286 MediaStreamProviderError error) {
288 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 287 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
289 if (listener_ == NULL) { 288 if (listener_ == NULL) {
290 // Listener has been removed 289 // Listener has been removed
291 return; 290 return;
292 } 291 }
293 listener_->Error(kVideoCapture, capture_session_id, error); 292 listener_->Error(kVideoCapture, capture_session_id, error);
294 } 293 }
295 294
296 void VideoCaptureManager::PostOnOpened( 295 void VideoCaptureManager::PostOnOpened(int capture_session_id) {
297 MediaCaptureSessionId capture_session_id) {
298 DCHECK(IsOnCaptureDeviceThread()); 296 DCHECK(IsOnCaptureDeviceThread());
299 BrowserThread::PostTask(BrowserThread::IO, 297 BrowserThread::PostTask(BrowserThread::IO,
300 FROM_HERE, 298 FROM_HERE,
301 NewRunnableMethod(this, 299 NewRunnableMethod(this,
302 &VideoCaptureManager::OnOpened, 300 &VideoCaptureManager::OnOpened,
303 capture_session_id)); 301 capture_session_id));
304 } 302 }
305 303
306 void VideoCaptureManager::PostOnClosed( 304 void VideoCaptureManager::PostOnClosed(int capture_session_id) {
307 MediaCaptureSessionId capture_session_id) {
308 DCHECK(IsOnCaptureDeviceThread()); 305 DCHECK(IsOnCaptureDeviceThread());
309 BrowserThread::PostTask(BrowserThread::IO, 306 BrowserThread::PostTask(BrowserThread::IO,
310 FROM_HERE, 307 FROM_HERE,
311 NewRunnableMethod(this, 308 NewRunnableMethod(this,
312 &VideoCaptureManager::OnClosed, 309 &VideoCaptureManager::OnClosed,
313 capture_session_id)); 310 capture_session_id));
314 } 311 }
315 312
316 void VideoCaptureManager::PostOnDevicesEnumerated(MediaCaptureDevices devices) { 313 void VideoCaptureManager::PostOnDevicesEnumerated(
314 StreamDeviceInfoArray devices) {
Leandro Graciá Gil 2011/06/16 17:39:53 Looks like this could be a const reference to me.
mflodman1 2011/06/20 19:48:03 Done.
317 DCHECK(IsOnCaptureDeviceThread()); 315 DCHECK(IsOnCaptureDeviceThread());
318
319 BrowserThread::PostTask(BrowserThread::IO, 316 BrowserThread::PostTask(BrowserThread::IO,
320 FROM_HERE, 317 FROM_HERE,
321 NewRunnableMethod( 318 NewRunnableMethod(
322 this, 319 this,
323 &VideoCaptureManager::OnDevicesEnumerated, 320 &VideoCaptureManager::OnDevicesEnumerated,
324 devices)); 321 devices));
325 } 322 }
326 323
327 void VideoCaptureManager::PostOnError(MediaCaptureSessionId capture_session_id, 324 void VideoCaptureManager::PostOnError(int capture_session_id,
328 MediaStreamProviderError error) { 325 MediaStreamProviderError error) {
329 // Don't check thread here, can be called from both IO thread and device 326 // Don't check thread here, can be called from both IO thread and device
330 // thread. 327 // thread.
331 BrowserThread::PostTask(BrowserThread::IO, 328 BrowserThread::PostTask(BrowserThread::IO,
332 FROM_HERE, 329 FROM_HERE,
333 NewRunnableMethod(this, 330 NewRunnableMethod(this,
334 &VideoCaptureManager::OnError, 331 &VideoCaptureManager::OnError,
335 capture_session_id, 332 capture_session_id,
336 error)); 333 error));
337 } 334 }
(...skipping 21 matching lines...) Expand all
359 it != devices_.end(); 356 it != devices_.end();
360 ++it) { 357 ++it) {
361 if (device_name.unique_id == it->second->device_name().unique_id) { 358 if (device_name.unique_id == it->second->device_name().unique_id) {
362 // We've found the device! 359 // We've found the device!
363 return true; 360 return true;
364 } 361 }
365 } 362 }
366 return false; 363 return false;
367 } 364 }
368 365
369 bool VideoCaptureManager::DeviceOpened( 366 bool VideoCaptureManager::DeviceOpened(const StreamDeviceInfo& device_info) {
370 const MediaCaptureDeviceInfo& device_info) {
371 DCHECK(IsOnCaptureDeviceThread()); 367 DCHECK(IsOnCaptureDeviceThread());
372 368
373 for (VideoCaptureDevices::iterator it = devices_.begin(); 369 for (VideoCaptureDevices::iterator it = devices_.begin();
374 it != devices_.end(); 370 it != devices_.end();
375 it++) { 371 it++) {
376 if (device_info.device_id == it->second->device_name().unique_id) { 372 if (device_info.device_id == it->second->device_name().unique_id) {
Leandro Graciá Gil 2011/06/16 17:39:53 Looks like this if doesn't need braces according t
mflodman1 2011/06/20 19:48:03 We've received comments regarding this that either
377 return true; 373 return true;
378 } 374 }
379 } 375 }
380 return false; 376 return false;
381 } 377 }
382 378
383 } // namespace media 379 } // namespace media
380
scherkus (not reviewing) 2011/06/17 03:03:52 nit: get rid of blank line
mflodman1 2011/06/20 19:48:03 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698