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

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

Issue 443783003: Turn off AVFoundation field trial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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"
11 #include "base/mac/mac_util.h" 11 #include "base/mac/mac_util.h"
12 #include "base/metrics/field_trial.h"
13 #include "media/base/media_switches.h" 12 #include "media/base/media_switches.h"
14 13
15 namespace { 14 namespace {
16 15
17 // This class is used to retrieve AVFoundation NSBundle and library handle. It 16 // This class is used to retrieve AVFoundation NSBundle and library handle. It
18 // must be used as a LazyInstance so that it is initialised once and in a 17 // must be used as a LazyInstance so that it is initialised once and in a
19 // thread-safe way. Normally no work is done in constructors: LazyInstance is 18 // thread-safe way. Normally no work is done in constructors: LazyInstance is
20 // an exception. 19 // an exception.
21 class AVFoundationInternal { 20 class AVFoundationInternal {
22 public: 21 public:
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // The force-qtkit flag takes precedence over enable-avfoundation. 117 // The force-qtkit flag takes precedence over enable-avfoundation.
119 if (command_line->HasSwitch(switches::kForceQTKit)) 118 if (command_line->HasSwitch(switches::kForceQTKit))
120 return false; 119 return false;
121 120
122 // Next in precedence is the enable-avfoundation flag. 121 // Next in precedence is the enable-avfoundation flag.
123 // TODO(mcasas,vrk): There should be 3 states of AVFoundation: user forced on, 122 // 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). 123 // user forced off (i.e. force QTKit), and default (respect field trial).
125 // crbug.com/396764 124 // crbug.com/396764
126 // TODO(vrk): Does this really need to be static? 125 // TODO(vrk): Does this really need to be static?
127 static bool should_enable_avfoundation = 126 static bool should_enable_avfoundation =
128 command_line->HasSwitch(switches::kEnableAVFoundation) || 127 command_line->HasSwitch(switches::kEnableAVFoundation);
andresp-chromium 2014/08/06 06:50:33 Why remove the finch experiment here?
vrk (LEFT CHROMIUM) 2014/08/07 01:25:00 My thinking was that if we never wanted to turn on
129 base::FieldTrialList::FindFullName("AVFoundationMacVideoCapture")
130 == "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 }
136 133
137 NSBundle const* AVFoundationGlue::AVFoundationBundle() { 134 NSBundle const* AVFoundationGlue::AVFoundationBundle() {
138 return g_avfoundation_handle.Get().bundle(); 135 return g_avfoundation_handle.Get().bundle();
139 } 136 }
140 137
(...skipping 74 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

Powered by Google App Engine
This is Rietveld 408576698