summaryrefslogtreecommitdiffstats
path: root/media/cdm
diff options
context:
space:
mode:
authorjrummell <jrummell@chromium.org>2015-05-07 12:07:51 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-07 19:08:24 +0000
commitbb47c91f4bf41c61f122b9aa0567678fed2f4e73 (patch)
tree9bce4307d9640a3d250380057f052fb6193ab8a1 /media/cdm
parent8a6989b532d692f319d617745de0651d67c6c990 (diff)
downloadchromium_src-bb47c91f4bf41c61f122b9aa0567678fed2f4e73.zip
chromium_src-bb47c91f4bf41c61f122b9aa0567678fed2f4e73.tar.gz
chromium_src-bb47c91f4bf41c61f122b9aa0567678fed2f4e73.tar.bz2
Provide error message if creating the CDM fails
Rather than using a generic error message when initialization of a CDM fails, provide a specific error message. BUG=407435 TEST=EME tests pass Review URL: https://codereview.chromium.org/1128113004 Cr-Commit-Position: refs/heads/master@{#328809}
Diffstat (limited to 'media/cdm')
-rw-r--r--media/cdm/default_cdm_factory.cc12
-rw-r--r--media/cdm/proxy_decryptor.cc3
-rw-r--r--media/cdm/proxy_decryptor.h3
3 files changed, 13 insertions, 5 deletions
diff --git a/media/cdm/default_cdm_factory.cc b/media/cdm/default_cdm_factory.cc
index 4132a24..6b9714a 100644
--- a/media/cdm/default_cdm_factory.cc
+++ b/media/cdm/default_cdm_factory.cc
@@ -32,9 +32,15 @@ void DefaultCdmFactory::Create(
const SessionKeysChangeCB& session_keys_change_cb,
const SessionExpirationUpdateCB& session_expiration_update_cb,
const CdmCreatedCB& cdm_created_cb) {
- if (!security_origin.is_valid() || !CanUseAesDecryptor(key_system)) {
+ if (!security_origin.is_valid()) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(cdm_created_cb, nullptr));
+ FROM_HERE, base::Bind(cdm_created_cb, nullptr, "Invalid origin."));
+ return;
+ }
+ if (!CanUseAesDecryptor(key_system)) {
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE,
+ base::Bind(cdm_created_cb, nullptr, "Unsupported key system."));
return;
}
@@ -42,7 +48,7 @@ void DefaultCdmFactory::Create(
new AesDecryptor(security_origin, session_message_cb, session_closed_cb,
session_keys_change_cb));
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(cdm_created_cb, base::Passed(&cdm)));
+ FROM_HERE, base::Bind(cdm_created_cb, base::Passed(&cdm), ""));
}
} // namespace media
diff --git a/media/cdm/proxy_decryptor.cc b/media/cdm/proxy_decryptor.cc
index b8ba19c..d8dcd5a 100644
--- a/media/cdm/proxy_decryptor.cc
+++ b/media/cdm/proxy_decryptor.cc
@@ -89,7 +89,8 @@ void ProxyDecryptor::CreateCdm(CdmFactory* cdm_factory,
void ProxyDecryptor::OnCdmCreated(const std::string& key_system,
const GURL& security_origin,
const CdmContextReadyCB& cdm_context_ready_cb,
- scoped_ptr<MediaKeys> cdm) {
+ scoped_ptr<MediaKeys> cdm,
+ const std::string& /* error_message */) {
is_creating_cdm_ = false;
if (!cdm) {
diff --git a/media/cdm/proxy_decryptor.h b/media/cdm/proxy_decryptor.h
index 9a17a98..09a94e3 100644
--- a/media/cdm/proxy_decryptor.h
+++ b/media/cdm/proxy_decryptor.h
@@ -76,7 +76,8 @@ class MEDIA_EXPORT ProxyDecryptor {
void OnCdmCreated(const std::string& key_system,
const GURL& security_origin,
const CdmContextReadyCB& cdm_context_ready_cb,
- scoped_ptr<MediaKeys> cdm);
+ scoped_ptr<MediaKeys> cdm,
+ const std::string& error_message);
void GenerateKeyRequestInternal(EmeInitDataType init_data_type,
const std::vector<uint8>& init_data);