summaryrefslogtreecommitdiff
path: root/chromium/components/cdm
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-13 15:05:36 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-14 10:33:47 +0000
commite684a3455bcc29a6e3e66a004e352dea4e1141e7 (patch)
treed55b4003bde34d7d05f558f02cfd82b2a66a7aac /chromium/components/cdm
parent2b94bfe47ccb6c08047959d1c26e392919550e86 (diff)
downloadqtwebengine-chromium-e684a3455bcc29a6e3e66a004e352dea4e1141e7.tar.gz
BASELINE: Update Chromium to 72.0.3626.110 and Ninja to 1.9.0
Change-Id: Ic57220b00ecc929a893c91f5cc552f5d3e99e922 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/components/cdm')
-rw-r--r--chromium/components/cdm/browser/cdm_message_filter_android.cc6
-rw-r--r--chromium/components/cdm/browser/media_drm_storage_impl.cc53
-rw-r--r--chromium/components/cdm/browser/media_drm_storage_impl_unittest.cc7
-rw-r--r--chromium/components/cdm/common/cdm_message_generator.cc4
-rw-r--r--chromium/components/cdm/renderer/android_key_systems.cc8
-rw-r--r--chromium/components/cdm/renderer/android_key_systems.h3
-rw-r--r--chromium/components/cdm/renderer/widevine_key_system_properties.cc2
7 files changed, 66 insertions, 17 deletions
diff --git a/chromium/components/cdm/browser/cdm_message_filter_android.cc b/chromium/components/cdm/browser/cdm_message_filter_android.cc
index 7a986ed84a6..5785ee4005b 100644
--- a/chromium/components/cdm/browser/cdm_message_filter_android.cc
+++ b/chromium/components/cdm/browser/cdm_message_filter_android.cc
@@ -38,9 +38,9 @@ struct CodecInfo {
const CodecInfo<media::VideoCodec> kVideoCodecsToQuery[] = {
{media::EME_CODEC_VP8, media::kCodecVP8, "video/webm"},
- {media::EME_CODEC_LEGACY_VP9, media::kCodecVP9, "video/webm"},
- {media::EME_CODEC_VP9, media::kCodecVP9, "video/webm"},
- {media::EME_CODEC_VP9, media::kCodecVP9, "video/mp4"},
+ // TODO(crbug.com/707127): Support query for VP9 profile 1/2/3 on Android.
+ {media::EME_CODEC_VP9_PROFILE0, media::kCodecVP9, "video/webm"},
+ {media::EME_CODEC_VP9_PROFILE0, media::kCodecVP9, "video/mp4"},
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
{media::EME_CODEC_AVC1, media::kCodecH264, "video/mp4"},
#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
diff --git a/chromium/components/cdm/browser/media_drm_storage_impl.cc b/chromium/components/cdm/browser/media_drm_storage_impl.cc
index 5a1b221963e..1683694139c 100644
--- a/chromium/components/cdm/browser/media_drm_storage_impl.cc
+++ b/chromium/components/cdm/browser/media_drm_storage_impl.cc
@@ -12,6 +12,7 @@
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "content/public/browser/navigation_handle.h"
+#include "media/base/android/media_drm_key_type.h"
// The storage will be managed by PrefService. All data will be stored in a
// dictionary under the key "media.media_drm_storage". The dictionary is
@@ -25,7 +26,8 @@
// $session_id: {
// "key_set_id": $key_set_id,
// "mime_type": $mime_type,
-// "creation_time": $creation_time
+// "creation_time": $creation_time,
+// "key_type": $key_type (enum of MediaDrmKeyType)
// },
// # more session_id map...
// }
@@ -48,8 +50,30 @@ const char kCreationTime[] = "creation_time";
const char kSessions[] = "sessions";
const char kKeySetId[] = "key_set_id";
const char kMimeType[] = "mime_type";
+const char kKeyType[] = "key_type";
const char kOriginId[] = "origin_id";
+bool GetMediaDrmKeyTypeFromDict(const base::Value& dict,
+ media::MediaDrmKeyType* value_out) {
+ DCHECK(dict.is_dict());
+ DCHECK(value_out);
+
+ const base::Value* value =
+ dict.FindKeyOfType(kKeyType, base::Value::Type::INTEGER);
+ if (!value)
+ return false;
+
+ int key_type = value->GetInt();
+ if (key_type < static_cast<int>(media::MediaDrmKeyType::UNKNOWN) ||
+ key_type > static_cast<int>(media::MediaDrmKeyType::MAX)) {
+ DVLOG(1) << "Corrupted key type.";
+ return false;
+ }
+
+ *value_out = static_cast<media::MediaDrmKeyType>(key_type);
+ return true;
+}
+
bool GetStringFromDict(const base::Value& dict,
const std::string& key,
std::string* value_out) {
@@ -139,8 +163,9 @@ class OriginData {
class SessionData {
public:
SessionData(const std::vector<uint8_t>& key_set_id,
- const std::string& mime_type)
- : SessionData(key_set_id, mime_type, base::Time::Now()) {}
+ const std::string& mime_type,
+ media::MediaDrmKeyType key_type)
+ : SessionData(key_set_id, mime_type, key_type, base::Time::Now()) {}
base::Time creation_time() const { return creation_time_; }
@@ -152,13 +177,14 @@ class SessionData {
reinterpret_cast<const char*>(key_set_id_.data()),
key_set_id_.size())));
dict.SetKey(kMimeType, base::Value(mime_type_));
+ dict.SetKey(kKeyType, base::Value(static_cast<int>(key_type_)));
dict.SetKey(kCreationTime, base::Value(creation_time_.ToDoubleT()));
return dict;
}
media::mojom::SessionDataPtr ToMojo() const {
- return media::mojom::SessionData::New(key_set_id_, mime_type_);
+ return media::mojom::SessionData::New(key_set_id_, mime_type_, key_type_);
}
// Convert |session_dict| to SessionData. |session_dict| contains information
@@ -180,22 +206,31 @@ class SessionData {
if (!GetCreationTimeFromDict(session_dict, &time))
return nullptr;
+ media::MediaDrmKeyType key_type;
+ if (!GetMediaDrmKeyTypeFromDict(session_dict, &key_type)) {
+ DVLOG(1) << "Missing key type.";
+ key_type = media::MediaDrmKeyType::UNKNOWN;
+ }
+
return base::WrapUnique(
new SessionData(std::vector<uint8_t>(key_set_id_string.begin(),
key_set_id_string.end()),
- std::move(mime_type), time));
+ std::move(mime_type), key_type, time));
}
private:
SessionData(std::vector<uint8_t> key_set_id,
std::string mime_type,
+ media::MediaDrmKeyType key_type,
base::Time time)
: key_set_id_(std::move(key_set_id)),
mime_type_(std::move(mime_type)),
+ key_type_(key_type),
creation_time_(time) {}
std::vector<uint8_t> key_set_id_;
std::string mime_type_;
+ media::MediaDrmKeyType key_type_;
base::Time creation_time_;
};
@@ -504,8 +539,14 @@ void MediaDrmStorageImpl::SavePersistentSession(
DVLOG_IF(1, sessions_dict->FindKey(session_id))
<< __func__ << ": Session ID already exists and will be replaced.";
+ // The key type of the session should be valid. MeidaDrmKeyType::MIN/UNKNOWN
+ // is an invalid type and caller should never pass it here.
+ DCHECK_GT(session_data->key_type, media::MediaDrmKeyType::MIN);
+ DCHECK_LE(session_data->key_type, media::MediaDrmKeyType::MAX);
+
sessions_dict->SetKey(
- session_id, SessionData(session_data->key_set_id, session_data->mime_type)
+ session_id, SessionData(session_data->key_set_id, session_data->mime_type,
+ session_data->key_type)
.ToDictValue());
std::move(callback).Run(true);
diff --git a/chromium/components/cdm/browser/media_drm_storage_impl_unittest.cc b/chromium/components/cdm/browser/media_drm_storage_impl_unittest.cc
index 31826f318bf..38e7bbaabec 100644
--- a/chromium/components/cdm/browser/media_drm_storage_impl_unittest.cc
+++ b/chromium/components/cdm/browser/media_drm_storage_impl_unittest.cc
@@ -114,7 +114,9 @@ class MediaDrmStorageImplTest : public content::RenderViewHostTestHarness {
const std::string& mime_type,
bool success = true) {
media_drm_storage_->SavePersistentSession(
- session_id, SessionData(key_set_id, mime_type), ExpectResult(success));
+ session_id,
+ SessionData(key_set_id, mime_type, media::MediaDrmKeyType::OFFLINE),
+ ExpectResult(success));
}
void LoadPersistentSession(const std::string& session_id,
@@ -122,7 +124,8 @@ class MediaDrmStorageImplTest : public content::RenderViewHostTestHarness {
const std::string& expected_mime_type) {
media_drm_storage_->LoadPersistentSession(
session_id, ExpectResult(std::make_unique<SessionData>(
- expected_key_set_id, expected_mime_type)));
+ expected_key_set_id, expected_mime_type,
+ media::MediaDrmKeyType::OFFLINE)));
}
void LoadPersistentSessionAndExpectFailure(const std::string& session_id) {
diff --git a/chromium/components/cdm/common/cdm_message_generator.cc b/chromium/components/cdm/common/cdm_message_generator.cc
index 2aabce727a5..d87ee8c7bb8 100644
--- a/chromium/components/cdm/common/cdm_message_generator.cc
+++ b/chromium/components/cdm/common/cdm_message_generator.cc
@@ -10,10 +10,6 @@
#include "ipc/struct_constructor_macros.h"
#include "components/cdm/common/cdm_message_generator.h"
-// Generate destructors.
-#include "ipc/struct_destructor_macros.h"
-#include "components/cdm/common/cdm_message_generator.h"
-
// Generate param traits write methods.
#include "ipc/param_traits_write_macros.h"
namespace IPC {
diff --git a/chromium/components/cdm/renderer/android_key_systems.cc b/chromium/components/cdm/renderer/android_key_systems.cc
index 280be2879b3..7450b268daa 100644
--- a/chromium/components/cdm/renderer/android_key_systems.cc
+++ b/chromium/components/cdm/renderer/android_key_systems.cc
@@ -9,12 +9,14 @@
#include "base/command_line.h"
#include "base/logging.h"
-#include "components/cdm/renderer/widevine_key_system_properties.h"
#include "content/public/renderer/render_thread.h"
#include "media/base/eme_constants.h"
#include "media/base/media_switches.h"
#include "media/media_buildflags.h"
+#if BUILDFLAG(ENABLE_WIDEVINE)
+#include "components/cdm/renderer/widevine_key_system_properties.h"
#include "third_party/widevine/cdm/widevine_cdm_common.h"
+#endif // BUILDFLAG(ENABLE_WIDEVINE)
using media::EmeConfigRule;
using media::EmeFeatureSupport;
@@ -22,7 +24,9 @@ using media::EmeInitDataType;
using media::EmeSessionTypeSupport;
using media::KeySystemProperties;
using media::SupportedCodecs;
+#if BUILDFLAG(ENABLE_WIDEVINE)
using Robustness = cdm::WidevineKeySystemProperties::Robustness;
+#endif // BUILDFLAG(ENABLE_WIDEVINE)
namespace cdm {
@@ -112,6 +116,7 @@ SupportedKeySystemResponse QueryKeySystemSupport(
return response;
}
+#if BUILDFLAG(ENABLE_WIDEVINE)
void AddAndroidWidevine(
std::vector<std::unique_ptr<KeySystemProperties>>* concrete_key_systems) {
auto response = QueryKeySystemSupport(kWidevineKeySystem);
@@ -155,6 +160,7 @@ void AddAndroidWidevine(
DCHECK(hw_secure_codecs == media::EME_CODEC_NONE);
}
}
+#endif // BUILDFLAG(ENABLE_WIDEVINE)
void AddAndroidPlatformKeySystems(
std::vector<std::unique_ptr<KeySystemProperties>>* concrete_key_systems) {
diff --git a/chromium/components/cdm/renderer/android_key_systems.h b/chromium/components/cdm/renderer/android_key_systems.h
index b92e36750e1..285d4f8fb61 100644
--- a/chromium/components/cdm/renderer/android_key_systems.h
+++ b/chromium/components/cdm/renderer/android_key_systems.h
@@ -10,12 +10,15 @@
#include "components/cdm/common/cdm_messages_android.h"
#include "media/base/key_system_properties.h"
+#include "third_party/widevine/cdm/buildflags.h"
namespace cdm {
+#if BUILDFLAG(ENABLE_WIDEVINE)
void AddAndroidWidevine(
std::vector<std::unique_ptr<media::KeySystemProperties>>*
concrete_key_systems);
+#endif // BUILDFLAG(ENABLE_WIDEVINE)
// Add platform-supported key systems which are not explicitly handled
// by Chrome.
diff --git a/chromium/components/cdm/renderer/widevine_key_system_properties.cc b/chromium/components/cdm/renderer/widevine_key_system_properties.cc
index 89ea042e215..5e2857b7f2e 100644
--- a/chromium/components/cdm/renderer/widevine_key_system_properties.cc
+++ b/chromium/components/cdm/renderer/widevine_key_system_properties.cc
@@ -70,7 +70,7 @@ std::string WidevineKeySystemProperties::GetKeySystemName() const {
bool WidevineKeySystemProperties::IsSupportedInitDataType(
EmeInitDataType init_data_type) const {
- // Here we assume that support for a container imples support for the
+ // Here we assume that support for a container implies support for the
// associated initialization data type. KeySystems handles validating
// |init_data_type| x |container| pairings.
if (init_data_type == EmeInitDataType::WEBM)