Commit 1ef99e7d authored by mcasas@chromium.org's avatar mcasas@chromium.org

Mac: Add flag to force QTKit in otherwise AVFoundation-enabled builds/configs.

History: AVFoundation and QTKit are the two options for audio/video 
monitoring and video capture in Mac. AVFoundation is currently enabled
in Mac OS X >= 10.7, and only via command line flag, which is currently
enabled in developer and Canary builds. 

This CL adds a --force-qtkit flag that suppresses AVFoundation usage
for those versions and channels that otherwise would use it.

Please note the naming: --force-qtkit vs. --enable-avfoundation

BUG=288562, 369024, 357250

Review URL: https://codereview.chromium.org/260873011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268065 0039d316-1c4b-4281-b951-d872f2087c98
parent cb9319bb
...@@ -40,6 +40,11 @@ const char kAlsaOutputDevice[] = "alsa-output-device"; ...@@ -40,6 +40,11 @@ const char kAlsaOutputDevice[] = "alsa-output-device";
// for experimentation purposes, in particular library load time issue, the // for experimentation purposes, in particular library load time issue, the
// usage of this library can be enabled by using this flag. // usage of this library can be enabled by using this flag.
const char kEnableAVFoundation[] = "enable-avfoundation"; const char kEnableAVFoundation[] = "enable-avfoundation";
// QTKit is the media capture API predecessor to AVFoundation, available up and
// until Mac OS X 10.9 (despite being deprecated in this last one). This flag
// is used for troubleshooting and testing, and forces QTKit in builds and
// configurations where AVFoundation would be used otherwise.
const char kForceQTKit[] = "force-qtkit";
#endif #endif
#if defined(OS_WIN) #if defined(OS_WIN)
......
...@@ -30,6 +30,7 @@ MEDIA_EXPORT extern const char kAlsaOutputDevice[]; ...@@ -30,6 +30,7 @@ MEDIA_EXPORT extern const char kAlsaOutputDevice[];
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
MEDIA_EXPORT extern const char kEnableAVFoundation[]; MEDIA_EXPORT extern const char kEnableAVFoundation[];
MEDIA_EXPORT extern const char kForceQTKit[];
#endif #endif
#if defined(OS_WIN) #if defined(OS_WIN)
......
...@@ -108,11 +108,13 @@ static base::LazyInstance<AVFoundationInternal> g_avfoundation_handle = ...@@ -108,11 +108,13 @@ static base::LazyInstance<AVFoundationInternal> g_avfoundation_handle =
bool AVFoundationGlue::IsAVFoundationSupported() { bool AVFoundationGlue::IsAVFoundationSupported() {
// DeviceMonitorMac will initialize this static bool from the main UI thread // DeviceMonitorMac will initialize this static bool from the main UI thread
// once, during Chrome startup so this construction is thread safe. // once, during Chrome startup so this construction is thread safe.
// Use AVFoundation if possible, enabled, and QTKit is not explicitly forced.
static CommandLine* command_line = CommandLine::ForCurrentProcess();
static bool is_av_foundation_supported = base::mac::IsOSLionOrLater() && static bool is_av_foundation_supported = base::mac::IsOSLionOrLater() &&
(CommandLine::ForCurrentProcess()->HasSwitch( ((command_line->HasSwitch(switches::kEnableAVFoundation) &&
switches::kEnableAVFoundation) || !command_line->HasSwitch(switches::kForceQTKit)) ||
base::FieldTrialList::FindFullName("AVFoundationMacVideoCapture") base::FieldTrialList::FindFullName("AVFoundationMacVideoCapture")
== "Enabled") && [AVFoundationBundle() load]; == "Enabled") && [AVFoundationBundle() load];
return is_av_foundation_supported; return is_av_foundation_supported;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment