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

Side by Side Diff: media/video/capture/mac/avfoundation_glue.mm

Issue 460113006: Mac Video Capture: expose --enable-avfoundation as tristate in chrome://flags (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: #ifdef using AVfoundation switches Created 6 years, 4 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
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #import "media/video/capture/mac/avfoundation_glue.h" 5 #import "media/video/capture/mac/avfoundation_glue.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 // AVFoundation is only available on OS Lion and above. 114 // AVFoundation is only available on OS Lion and above.
115 if (!base::mac::IsOSLionOrLater()) 115 if (!base::mac::IsOSLionOrLater())
116 return false; 116 return false;
117 117
118 // The force-qtkit flag takes precedence over enable-avfoundation. 118 // The force-qtkit flag takes precedence over enable-avfoundation.
119 if (command_line->HasSwitch(switches::kForceQTKit)) 119 if (command_line->HasSwitch(switches::kForceQTKit))
120 return false; 120 return false;
121 121
122 // Next in precedence is the enable-avfoundation flag. 122 // Next in precedence is the enable-avfoundation flag.
123 // TODO(mcasas,vrk): There should be 3 states of AVFoundation: user forced on,
124 // user forced off (i.e. force QTKit), and default (respect field trial).
125 // crbug.com/396764
126 // TODO(vrk): Does this really need to be static? 123 // TODO(vrk): Does this really need to be static?
127 static bool should_enable_avfoundation = 124 static bool should_enable_avfoundation =
128 command_line->HasSwitch(switches::kEnableAVFoundation) || 125 command_line->HasSwitch(switches::kEnableAVFoundation) ||
129 base::FieldTrialList::FindFullName("AVFoundationMacVideoCapture") 126 base::FieldTrialList::FindFullName("AVFoundationMacVideoCapture")
130 == "Enabled"; 127 == "Enabled";
131 // Try to load AVFoundation. Save result in static bool to avoid loading 128 // Try to load AVFoundation. Save result in static bool to avoid loading
132 // AVFoundationBundle every call. 129 // AVFoundationBundle every call.
133 static bool loaded_successfully = [AVFoundationBundle() load]; 130 static bool loaded_successfully = [AVFoundationBundle() load];
134 return should_enable_avfoundation && loaded_successfully; 131 return should_enable_avfoundation && loaded_successfully;
135 } 132 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 @implementation AVCaptureDeviceInputGlue 212 @implementation AVCaptureDeviceInputGlue
216 213
217 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device 214 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device
218 error:(NSError**)outError { 215 error:(NSError**)outError {
219 return [[AVFoundationGlue::AVFoundationBundle() 216 return [[AVFoundationGlue::AVFoundationBundle()
220 classNamed:@"AVCaptureDeviceInput"] deviceInputWithDevice:device 217 classNamed:@"AVCaptureDeviceInput"] deviceInputWithDevice:device
221 error:outError]; 218 error:outError];
222 } 219 }
223 220
224 @end // @implementation AVCaptureDeviceInputGlue 221 @end // @implementation AVCaptureDeviceInputGlue
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698