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

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

Issue 411983002: Fix force-qtkit flag on dev channel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « chrome/browser/media/media_capture_devices_dispatcher.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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } // namespace 103 } // namespace
104 104
105 static base::LazyInstance<AVFoundationInternal> g_avfoundation_handle = 105 static base::LazyInstance<AVFoundationInternal> g_avfoundation_handle =
106 LAZY_INSTANCE_INITIALIZER; 106 LAZY_INSTANCE_INITIALIZER;
107 107
108 bool AVFoundationGlue::IsAVFoundationSupported() { 108 bool AVFoundationGlue::IsAVFoundationSupported() {
109 // DeviceMonitorMac will initialize this static bool from the main UI thread 109 // DeviceMonitorMac will initialize this static bool from the main UI thread
110 // once, during Chrome startup so this construction is thread safe. 110 // once, during Chrome startup so this construction is thread safe.
111 // Use AVFoundation if possible, enabled, and QTKit is not explicitly forced. 111 // Use AVFoundation if possible, enabled, and QTKit is not explicitly forced.
112 static CommandLine* command_line = CommandLine::ForCurrentProcess(); 112 static CommandLine* command_line = CommandLine::ForCurrentProcess();
113 static bool is_av_foundation_supported = base::mac::IsOSLionOrLater() && 113
114 ((command_line->HasSwitch(switches::kEnableAVFoundation) && 114 // AVFoundation is only available on OS Lion and above.
115 !command_line->HasSwitch(switches::kForceQTKit)) || 115 if (!base::mac::IsOSLionOrLater())
DaleCurtis 2014/07/23 20:54:38 I think you want to merge these into the static in
vrk (LEFT CHROMIUM) 2014/07/25 00:01:15 Ah, thanks for the catch! Didn't pay attention to
116 base::FieldTrialList::FindFullName("AVFoundationMacVideoCapture") 116 return false;
117 == "Enabled") && [AVFoundationBundle() load]; 117
118 return is_av_foundation_supported; 118 // The force-qtkit flag takes precedence over enable-avfoundation.
119 if (command_line->HasSwitch(switches::kForceQTKit))
120 return false;
121
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 static bool avfoundation_requested =
127 command_line->HasSwitch(switches::kEnableAVFoundation) ||
128 (base::FieldTrialList::FindFullName("AVFoundationMacVideoCapture")
129 == "Enabled");
130 return avfoundation_requested && [AVFoundationBundle() load];
119 } 131 }
120 132
121 NSBundle const* AVFoundationGlue::AVFoundationBundle() { 133 NSBundle const* AVFoundationGlue::AVFoundationBundle() {
122 return g_avfoundation_handle.Get().bundle(); 134 return g_avfoundation_handle.Get().bundle();
123 } 135 }
124 136
125 void* AVFoundationGlue::AVFoundationLibraryHandle() { 137 void* AVFoundationGlue::AVFoundationLibraryHandle() {
126 return g_avfoundation_handle.Get().library_handle(); 138 return g_avfoundation_handle.Get().library_handle();
127 } 139 }
128 140
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 @implementation AVCaptureDeviceInputGlue 211 @implementation AVCaptureDeviceInputGlue
200 212
201 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device 213 + (CrAVCaptureDeviceInput*)deviceInputWithDevice:(CrAVCaptureDevice*)device
202 error:(NSError**)outError { 214 error:(NSError**)outError {
203 return [[AVFoundationGlue::AVFoundationBundle() 215 return [[AVFoundationGlue::AVFoundationBundle()
204 classNamed:@"AVCaptureDeviceInput"] deviceInputWithDevice:device 216 classNamed:@"AVCaptureDeviceInput"] deviceInputWithDevice:device
205 error:outError]; 217 error:outError];
206 } 218 }
207 219
208 @end // @implementation AVCaptureDeviceInputGlue 220 @end // @implementation AVCaptureDeviceInputGlue
OLDNEW
« no previous file with comments | « chrome/browser/media/media_capture_devices_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698