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

Side by Side Diff: content/browser/device_monitor_mac.mm

Issue 189443010: Mac AVFoundation/QTKit: delay DeviceMonitorMac startup to first GetUserMedia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rsesek@ comments Created 6 years, 9 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) 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 "content/browser/device_monitor_mac.h" 5 #include "content/browser/device_monitor_mac.h"
6 6
7 #import <QTKit/QTKit.h> 7 #import <QTKit/QTKit.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 receiver_->OnDeviceChanged(); 330 receiver_->OnDeviceChanged();
331 if ([keyPath isEqual:@"connected"]) 331 if ([keyPath isEqual:@"connected"])
332 [self stopObserving:static_cast<CrAVCaptureDevice*>(context)]; 332 [self stopObserving:static_cast<CrAVCaptureDevice*>(context)];
333 } 333 }
334 334
335 @end // @implementation CrAVFoundationDeviceObserver 335 @end // @implementation CrAVFoundationDeviceObserver
336 336
337 namespace content { 337 namespace content {
338 338
339 DeviceMonitorMac::DeviceMonitorMac() { 339 DeviceMonitorMac::DeviceMonitorMac() {
340 // Both QTKit and AVFoundation do not need to be fired up until the user
341 // exercises a GetUserMedia. Bringing up either library and enumerating the
342 // devices in the system is an operation taking in the range of hundred of ms,
343 // so it is triggered explicitly from MediaStreamManager::StartMonitoring().
344 }
345
346 DeviceMonitorMac::~DeviceMonitorMac() {}
347
348 void DeviceMonitorMac::StartMonitoring() {
tommi (sloooow) - chröme 2014/03/10 18:38:26 Can you add a DCHECK that when we get here we're o
mcasas 2014/03/11 07:57:32 Done.
340 if (AVFoundationGlue::IsAVFoundationSupported()) { 349 if (AVFoundationGlue::IsAVFoundationSupported()) {
341 DVLOG(1) << "Monitoring via AVFoundation"; 350 DVLOG(1) << "Monitoring via AVFoundation";
342 device_monitor_impl_.reset(new AVFoundationMonitorImpl(this)); 351 device_monitor_impl_.reset(new AVFoundationMonitorImpl(this));
343 // For the AVFoundation to start sending connect/disconnect notifications,
344 // the AVFoundation NSBundle has to be loaded and the devices enumerated.
345 // This operation seems to take in the range of hundred of ms. so should be
346 // moved to the point when is needed, and that is during
347 // DeviceVideoCaptureMac +getDeviceNames.
348 } else { 352 } else {
349 DVLOG(1) << "Monitoring via QTKit"; 353 DVLOG(1) << "Monitoring via QTKit";
350 device_monitor_impl_.reset(new QTKitMonitorImpl(this)); 354 device_monitor_impl_.reset(new QTKitMonitorImpl(this));
351 } 355 }
352 } 356 }
353 357
354 DeviceMonitorMac::~DeviceMonitorMac() {}
355
356 void DeviceMonitorMac::NotifyDeviceChanged( 358 void DeviceMonitorMac::NotifyDeviceChanged(
357 base::SystemMonitor::DeviceType type) { 359 base::SystemMonitor::DeviceType type) {
358 // TODO(xians): Remove the global variable for SystemMonitor. 360 // TODO(xians): Remove the global variable for SystemMonitor.
359 base::SystemMonitor::Get()->ProcessDevicesChanged(type); 361 base::SystemMonitor::Get()->ProcessDevicesChanged(type);
360 } 362 }
361 363
362 } // namespace content 364 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698