Index: third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp |
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp |
index eb3cf8122c8b651414ad6b409b242c2ccb98b701..84770a91e58d52e0f509daf4f346d3eea53d3db0 100644 |
--- a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp |
+++ b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp |
@@ -12,6 +12,7 @@ |
#include "core/dom/ExceptionCode.h" |
#include "core/frame/OriginsUsingFeatures.h" |
#include "core/frame/UseCounter.h" |
+#include "core/inspector/ConsoleMessage.h" |
#include "modules/encryptedmedia/EncryptedMediaUtils.h" |
#include "modules/encryptedmedia/MediaKeySession.h" |
#include "modules/encryptedmedia/MediaKeySystemAccess.h" |
@@ -78,6 +79,18 @@ static WebVector<WebEncryptedMediaSessionType> convertSessionTypes(const Vector< |
return result; |
} |
+static bool isWidevine(const String& keySystem) |
+{ |
+ return keySystem == "com.widevine.alpha"; |
ddorwin
2015/10/01 21:23:47
This should be in Chromium, though I don't know ho
xhwang
2015/10/01 22:49:43
Acknowledged.
|
+} |
+ |
+// Returns true if the |config| has only one audio or video capability and the robustness in that capability is empty. |
+static bool hasOneCapabilityAndRobustnessIsEmpty(const WebMediaKeySystemConfiguration& config) |
+{ |
+ return (config.audioCapabilities.size() == 1 && config.audioCapabilities[0].robustness.isEmpty()) |
sandersd (OOO until July 31)
2015/10/01 20:40:24
I'm not certain that we should restrict to the siz
ddorwin
2015/10/01 21:23:47
Good point. My assumption was that the empty one w
ddorwin
2015/10/01 21:23:47
Empty might be legit for audio. For example, it's
sandersd (OOO until July 31)
2015/10/01 21:34:45
The ideal design for compatibility would be to lis
xhwang
2015/10/01 22:49:43
I am going to do "any".
|
+ || (config.videoCapabilities.size() == 1 && config.videoCapabilities[0].robustness.isEmpty()); |
+} |
+ |
// This class allows capabilities to be checked and a MediaKeySystemAccess |
// object to be created asynchronously. |
class MediaKeySystemAccessInitializer final : public EncryptedMediaRequest { |
@@ -144,6 +157,14 @@ MediaKeySystemAccessInitializer::MediaKeySystemAccessInitializer(ScriptState* sc |
void MediaKeySystemAccessInitializer::requestSucceeded(WebContentDecryptionModuleAccess* access) |
{ |
+ // Check the config and generate warnings on empty robustness string. |
+ // TODO(xhwang): Remove after we handle empty robustness correctly. See http://crbug.com/482277 |
+ if (isWidevine(keySystem()) && hasOneCapabilityAndRobustnessIsEmpty(access->getConfiguration())) { |
+ m_resolver->scriptState()->executionContext()->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, |
ddorwin
2015/10/01 21:23:47
Are we guaranteed that the EC will be valid?
xhwang
2015/10/01 22:49:43
Good question. Actually I don't know. But we have
|
+ "It is recommended that a robustness level be specified. In a future version, Chromium will be made " |
sandersd (OOO until July 31)
2015/10/01 20:40:24
While this message is the one recommended by ddorw
ddorwin
2015/10/01 21:23:47
I think we generally use "Chrome" in console messa
ddorwin
2015/10/01 21:23:47
There aren't any plans to change the spec beyond w
sandersd (OOO until July 31)
2015/10/01 21:34:45
Perhaps we should just say that the behavior will
xhwang
2015/10/01 22:49:43
Updated the text...
|
+ "spec compliant such that the empty string is interpreted as the minimum robustness being acceptable.")); |
+ } |
+ |
m_resolver->resolve(new MediaKeySystemAccess(m_keySystem, adoptPtr(access))); |
m_resolver.clear(); |
} |