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

Side by Side Diff: trunk/src/media/video/capture/mac/video_capture_device_mac.mm

Issue 61213006: Revert 235728 "Removed RunUntilIdle between Stop and Close in UT..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month 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) 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 #include "media/video/capture/mac/video_capture_device_mac.h" 5 #include "media/video/capture/mac/video_capture_device_mac.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 [capture_device_ setFrameReceiver:nil]; 201 [capture_device_ setFrameReceiver:nil];
202 client_.reset(); 202 client_.reset();
203 state_ = kIdle; 203 state_ = kIdle;
204 tried_to_square_pixels_ = false; 204 tried_to_square_pixels_ = false;
205 } 205 }
206 206
207 bool VideoCaptureDeviceMac::Init() { 207 bool VideoCaptureDeviceMac::Init() {
208 DCHECK_EQ(loop_proxy_, base::MessageLoopProxy::current()); 208 DCHECK_EQ(loop_proxy_, base::MessageLoopProxy::current());
209 DCHECK_EQ(state_, kNotInitialized); 209 DCHECK_EQ(state_, kNotInitialized);
210 210
211 // TODO(mcasas): The following check might not be necessary; if the device has
212 // disappeared after enumeration and before coming here, opening would just
213 // fail but not necessarily produce a crash.
214 Names device_names; 211 Names device_names;
215 GetDeviceNames(&device_names); 212 GetDeviceNames(&device_names);
216 Names::iterator it = device_names.begin(); 213 Name* found = device_names.FindById(device_name_.id());
217 for (; it != device_names.end(); ++it) { 214 if (!found)
218 if (it->id() == device_name_.id())
219 break;
220 }
221 if (it == device_names.end())
222 return false; 215 return false;
223 216
224 capture_device_ = 217 capture_device_ =
225 [[VideoCaptureDeviceQTKit alloc] initWithFrameReceiver:this]; 218 [[VideoCaptureDeviceQTKit alloc] initWithFrameReceiver:this];
226 if (!capture_device_) 219 if (!capture_device_)
227 return false; 220 return false;
228 221
229 state_ = kIdle; 222 state_ = kIdle;
230 return true; 223 return true;
231 } 224 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 if (![capture_device_ setCaptureHeight:current_settings_.height 323 if (![capture_device_ setCaptureHeight:current_settings_.height
331 width:current_settings_.width 324 width:current_settings_.width
332 frameRate:current_settings_.frame_rate]) { 325 frameRate:current_settings_.frame_rate]) {
333 ReceiveError("Could not configure capture device."); 326 ReceiveError("Could not configure capture device.");
334 return false; 327 return false;
335 } 328 }
336 return true; 329 return true;
337 } 330 }
338 331
339 } // namespace media 332 } // namespace media
OLDNEW
« no previous file with comments | « trunk/src/media/video/capture/fake_video_capture_device.cc ('k') | trunk/src/media/video/capture/video_capture_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698