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 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 5 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 media_stream_capture_indicator_(new MediaStreamCaptureIndicator()) { | 250 media_stream_capture_indicator_(new MediaStreamCaptureIndicator()) { |
251 // MediaCaptureDevicesDispatcher is a singleton. It should be created on | 251 // MediaCaptureDevicesDispatcher is a singleton. It should be created on |
252 // UI thread. Otherwise, it will not receive | 252 // UI thread. Otherwise, it will not receive |
253 // content::NOTIFICATION_WEB_CONTENTS_DESTROYED, and that will result in | 253 // content::NOTIFICATION_WEB_CONTENTS_DESTROYED, and that will result in |
254 // possible use after free. | 254 // possible use after free. |
255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
256 notifications_registrar_.Add( | 256 notifications_registrar_.Add( |
257 this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 257 this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
258 content::NotificationService::AllSources()); | 258 content::NotificationService::AllSources()); |
259 | 259 |
260 // AVFoundation is used for video/audio device monitoring and video capture in | |
261 // Mac. Experimentally, connect it in Dev, Canary and Unknown (developer | |
262 // builds). | |
263 #if defined(OS_MACOSX) | 260 #if defined(OS_MACOSX) |
264 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 261 // AVFoundation is used for video/audio device monitoring and video capture. |
265 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kForceQTKit)) { | 262 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kForceQTKit)) { |
266 if (channel == chrome::VersionInfo::CHANNEL_DEV || | 263 CommandLine::ForCurrentProcess()->AppendSwitch( |
267 channel == chrome::VersionInfo::CHANNEL_CANARY || | 264 switches::kEnableAVFoundation); |
268 channel == chrome::VersionInfo::CHANNEL_UNKNOWN) { | |
269 CommandLine::ForCurrentProcess()->AppendSwitch( | |
270 switches::kEnableAVFoundation); | |
271 } | |
272 } | 265 } |
273 #endif | 266 #endif |
274 } | 267 } |
275 | 268 |
276 MediaCaptureDevicesDispatcher::~MediaCaptureDevicesDispatcher() {} | 269 MediaCaptureDevicesDispatcher::~MediaCaptureDevicesDispatcher() {} |
277 | 270 |
278 void MediaCaptureDevicesDispatcher::RegisterProfilePrefs( | 271 void MediaCaptureDevicesDispatcher::RegisterProfilePrefs( |
279 user_prefs::PrefRegistrySyncable* registry) { | 272 user_prefs::PrefRegistrySyncable* registry) { |
280 registry->RegisterStringPref( | 273 registry->RegisterStringPref( |
281 prefs::kDefaultAudioCaptureDevice, | 274 prefs::kDefaultAudioCaptureDevice, |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 | 1086 |
1094 void MediaCaptureDevicesDispatcher::SetTestAudioCaptureDevices( | 1087 void MediaCaptureDevicesDispatcher::SetTestAudioCaptureDevices( |
1095 const MediaStreamDevices& devices) { | 1088 const MediaStreamDevices& devices) { |
1096 test_audio_devices_ = devices; | 1089 test_audio_devices_ = devices; |
1097 } | 1090 } |
1098 | 1091 |
1099 void MediaCaptureDevicesDispatcher::SetTestVideoCaptureDevices( | 1092 void MediaCaptureDevicesDispatcher::SetTestVideoCaptureDevices( |
1100 const MediaStreamDevices& devices) { | 1093 const MediaStreamDevices& devices) { |
1101 test_video_devices_ = devices; | 1094 test_video_devices_ = devices; |
1102 } | 1095 } |
OLD | NEW |