OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h" | 5 #include "modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "bindings/core/v8/V8ThrowException.h" | 10 #include "bindings/core/v8/V8ThrowException.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 EncryptedMediaRequest::trace(visitor); | 115 EncryptedMediaRequest::trace(visitor); |
116 } | 116 } |
117 | 117 |
118 private: | 118 private: |
119 // Returns true if the ExecutionContext is valid, false otherwise. | 119 // Returns true if the ExecutionContext is valid, false otherwise. |
120 bool isExecutionContextValid() const; | 120 bool isExecutionContextValid() const; |
121 | 121 |
122 // For widevine key system, generate warning and report to UMA if | 122 // For widevine key system, generate warning and report to UMA if |
123 // |m_supportedConfigurations| contains any video capability with empty | 123 // |m_supportedConfigurations| contains any video capability with empty |
124 // robustness string. | 124 // robustness string. |
125 // TODO(xhwang): Remove after we handle empty robustness correctly. | |
126 // See http://crbug.com/482277 | |
127 void checkVideoCapabilityRobustness() const; | 125 void checkVideoCapabilityRobustness() const; |
128 | 126 |
129 // Generate deprecation warning and log UseCounter if configuration | 127 // Generate deprecation warning and log UseCounter if configuration |
130 // contains only container-only contentType strings. | 128 // contains only container-only contentType strings. |
131 // TODO(jrummell): Remove once this is no longer allowed. | 129 // TODO(jrummell): Remove once this is no longer allowed. |
132 // See http://crbug.com/605661. | 130 // See http://crbug.com/605661. |
133 void checkEmptyCodecs(const WebMediaKeySystemConfiguration&); | 131 void checkEmptyCodecs(const WebMediaKeySystemConfiguration&); |
134 | 132 |
135 // Log UseCounter if selected configuration does not have at least one of | 133 // Log UseCounter if selected configuration does not have at least one of |
136 // 'audioCapabilities' and 'videoCapabilities' non-empty. | 134 // 'audioCapabilities' and 'videoCapabilities' non-empty. |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 EnumerationHistogram, emptyRobustnessHistogram, | 255 EnumerationHistogram, emptyRobustnessHistogram, |
258 new EnumerationHistogram( | 256 new EnumerationHistogram( |
259 "Media.EME.Widevine.VideoCapability.HasEmptyRobustness", 2)); | 257 "Media.EME.Widevine.VideoCapability.HasEmptyRobustness", 2)); |
260 emptyRobustnessHistogram.count(hasEmptyRobustness); | 258 emptyRobustnessHistogram.count(hasEmptyRobustness); |
261 } | 259 } |
262 | 260 |
263 if (hasEmptyRobustness) { | 261 if (hasEmptyRobustness) { |
264 m_resolver->getExecutionContext()->addConsoleMessage(ConsoleMessage::create( | 262 m_resolver->getExecutionContext()->addConsoleMessage(ConsoleMessage::create( |
265 JSMessageSource, WarningMessageLevel, | 263 JSMessageSource, WarningMessageLevel, |
266 "It is recommended that a robustness level be specified. Not " | 264 "It is recommended that a robustness level be specified. Not " |
267 "specifying the robustness level could " | 265 "specifying the robustness level could result in unexpected behavior, " |
268 "result in unexpected behavior in the future, potentially including " | 266 "potentially including failure to play.")); |
269 "failure to play.")); | |
270 } | 267 } |
271 } | 268 } |
272 | 269 |
273 void MediaKeySystemAccessInitializer::checkEmptyCodecs( | 270 void MediaKeySystemAccessInitializer::checkEmptyCodecs( |
274 const WebMediaKeySystemConfiguration& config) { | 271 const WebMediaKeySystemConfiguration& config) { |
275 // This is only checking for empty codecs in the selected configuration, | 272 // This is only checking for empty codecs in the selected configuration, |
276 // as apps may pass container only contentType strings for compatibility | 273 // as apps may pass container only contentType strings for compatibility |
277 // with other implementations. | 274 // with other implementations. |
278 // This will only check that all returned capabilities do not contain | 275 // This will only check that all returned capabilities do not contain |
279 // codecs. This avoids alerting on configurations that will continue | 276 // codecs. This avoids alerting on configurations that will continue |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 WebEncryptedMediaClient* mediaClient = | 390 WebEncryptedMediaClient* mediaClient = |
394 controller->encryptedMediaClient(executionContext); | 391 controller->encryptedMediaClient(executionContext); |
395 mediaClient->requestMediaKeySystemAccess( | 392 mediaClient->requestMediaKeySystemAccess( |
396 WebEncryptedMediaRequest(initializer)); | 393 WebEncryptedMediaRequest(initializer)); |
397 | 394 |
398 // 7. Return promise. | 395 // 7. Return promise. |
399 return promise; | 396 return promise; |
400 } | 397 } |
401 | 398 |
402 } // namespace blink | 399 } // namespace blink |
OLD | NEW |