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

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: Change included file device_monitor_mac.h with the forward declaration of the class & necessary met… 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() {
349 DCHECK(thread_checker_.CalledOnValidThread());
340 if (AVFoundationGlue::IsAVFoundationSupported()) { 350 if (AVFoundationGlue::IsAVFoundationSupported()) {
341 DVLOG(1) << "Monitoring via AVFoundation"; 351 DVLOG(1) << "Monitoring via AVFoundation";
342 device_monitor_impl_.reset(new AVFoundationMonitorImpl(this)); 352 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 { 353 } else {
349 DVLOG(1) << "Monitoring via QTKit"; 354 DVLOG(1) << "Monitoring via QTKit";
350 device_monitor_impl_.reset(new QTKitMonitorImpl(this)); 355 device_monitor_impl_.reset(new QTKitMonitorImpl(this));
351 } 356 }
352 } 357 }
353 358
354 DeviceMonitorMac::~DeviceMonitorMac() {}
355
356 void DeviceMonitorMac::NotifyDeviceChanged( 359 void DeviceMonitorMac::NotifyDeviceChanged(
357 base::SystemMonitor::DeviceType type) { 360 base::SystemMonitor::DeviceType type) {
358 // TODO(xians): Remove the global variable for SystemMonitor. 361 // TODO(xians): Remove the global variable for SystemMonitor.
359 base::SystemMonitor::Get()->ProcessDevicesChanged(type); 362 base::SystemMonitor::Get()->ProcessDevicesChanged(type);
360 } 363 }
361 364
362 } // namespace content 365 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/device_monitor_mac.h ('k') | content/browser/renderer_host/media/media_stream_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698