| 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 "media/base/media_switches.h" |
| 6 #include "base/command_line.h" |
| 5 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 6 #include "media/base/media_switches.h" | |
| 7 #include "ppapi/features/features.h" | 8 #include "ppapi/features/features.h" |
| 8 | 9 |
| 9 namespace switches { | 10 namespace switches { |
| 10 | 11 |
| 11 // Allow users to specify a custom buffer size for debugging purpose. | 12 // Allow users to specify a custom buffer size for debugging purpose. |
| 12 const char kAudioBufferSize[] = "audio-buffer-size"; | 13 const char kAudioBufferSize[] = "audio-buffer-size"; |
| 13 | 14 |
| 14 // Command line flag name to set the autoplay policy. | 15 // Command line flag name to set the autoplay policy. |
| 15 const char kAutoplayPolicy[] = "autoplay-policy"; | 16 const char kAutoplayPolicy[] = "autoplay-policy"; |
| 16 | 17 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 const char kMSEVideoBufferSizeLimit[] = "mse-video-buffer-size-limit"; | 140 const char kMSEVideoBufferSizeLimit[] = "mse-video-buffer-size-limit"; |
| 140 | 141 |
| 141 // Ignores all autoplay restrictions. It will ignore the current autoplay policy | 142 // Ignores all autoplay restrictions. It will ignore the current autoplay policy |
| 142 // and all restrictions such as playback in a background tab. It should only be | 143 // and all restrictions such as playback in a background tab. It should only be |
| 143 // enabled for testing. | 144 // enabled for testing. |
| 144 const char kIgnoreAutoplayRestrictionsForTests[] = | 145 const char kIgnoreAutoplayRestrictionsForTests[] = |
| 145 "ignore-autoplay-restrictions"; | 146 "ignore-autoplay-restrictions"; |
| 146 | 147 |
| 147 namespace autoplay { | 148 namespace autoplay { |
| 148 | 149 |
| 149 // Autoplay policy to require a user gesture in ordor to play for cross origin | |
| 150 // iframes. | |
| 151 const char kCrossOriginUserGestureRequiredPolicy[] = | |
| 152 "cross-origin-user-gesture-required"; | |
| 153 | |
| 154 // Autoplay policy that does not require any user gesture. | 150 // Autoplay policy that does not require any user gesture. |
| 155 const char kNoUserGestureRequiredPolicy[] = "no-user-gesture-required"; | 151 const char kNoUserGestureRequiredPolicy[] = "no-user-gesture-required"; |
| 156 | 152 |
| 157 // Autoplay policy to require a user gesture in order to play. | 153 // Autoplay policy to require a user gesture in order to play. |
| 158 const char kUserGestureRequiredPolicy[] = "user-gesture-required"; | 154 const char kUserGestureRequiredPolicy[] = "user-gesture-required"; |
| 159 | 155 |
| 156 // Autoplay policy to require a user gesture in ordor to play for cross origin |
| 157 // iframes. |
| 158 const char kUserGestureRequiredForCrossOriginPolicy[] = |
| 159 "user-gesture-required-for-cross-origin"; |
| 160 |
| 160 } // namespace autoplay | 161 } // namespace autoplay |
| 161 | 162 |
| 162 } // namespace switches | 163 } // namespace switches |
| 163 | 164 |
| 164 namespace media { | 165 namespace media { |
| 165 | 166 |
| 166 // Use new audio rendering mixer. | 167 // Use new audio rendering mixer. |
| 167 const base::Feature kNewAudioRenderingMixingStrategy{ | 168 const base::Feature kNewAudioRenderingMixingStrategy{ |
| 168 "NewAudioRenderingMixingStrategy", base::FEATURE_DISABLED_BY_DEFAULT}; | 169 "NewAudioRenderingMixingStrategy", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 169 | 170 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // Enables video decode acceleration using the D3D11 video decoder api. | 244 // Enables video decode acceleration using the D3D11 video decoder api. |
| 244 // This is completely insecure - DO NOT USE except for testing. | 245 // This is completely insecure - DO NOT USE except for testing. |
| 245 const base::Feature kD3D11VideoDecoding{"D3D11VideoDecoding", | 246 const base::Feature kD3D11VideoDecoding{"D3D11VideoDecoding", |
| 246 base::FEATURE_DISABLED_BY_DEFAULT}; | 247 base::FEATURE_DISABLED_BY_DEFAULT}; |
| 247 | 248 |
| 248 // Enables H264 HW encode acceleration using Media Foundation for Windows. | 249 // Enables H264 HW encode acceleration using Media Foundation for Windows. |
| 249 const base::Feature kMediaFoundationH264Encoding{ | 250 const base::Feature kMediaFoundationH264Encoding{ |
| 250 "MediaFoundationH264Encoding", base::FEATURE_ENABLED_BY_DEFAULT}; | 251 "MediaFoundationH264Encoding", base::FEATURE_ENABLED_BY_DEFAULT}; |
| 251 #endif // defined(OS_WIN) | 252 #endif // defined(OS_WIN) |
| 252 | 253 |
| 254 std::string GetEffectiveAutoplayPolicy(const base::CommandLine& command_line) { |
| 255 // |kIgnoreAutoplayRestrictionsForTests| overrides all other settings. |
| 256 if (command_line.HasSwitch(switches::kIgnoreAutoplayRestrictionsForTests)) |
| 257 return switches::autoplay::kNoUserGestureRequiredPolicy; |
| 258 |
| 259 // Return the autoplay policy set in teh command line, if any. |
| 260 if (command_line.HasSwitch(switches::kAutoplayPolicy)) |
| 261 return command_line.GetSwitchValueASCII(switches::kAutoplayPolicy); |
| 262 |
| 263 // The default value is platform dependant. |
| 264 #if defined(OS_ANDROID) |
| 265 return switches::autoplay::kUserGestureRequiredPolicy; |
| 266 #else |
| 267 return switches::autoplay::kNoUserGestureRequiredPolicy; |
| 268 #endif |
| 269 } |
| 270 |
| 253 } // namespace media | 271 } // namespace media |
| OLD | NEW |