Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(680)

Unified Diff: components/cdm/renderer/android_key_systems.cc

Issue 320383005: Add an IPC to return the platform supported key-system names in Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/cdm/renderer/android_key_systems.cc
diff --git a/components/cdm/renderer/android_key_systems.cc b/components/cdm/renderer/android_key_systems.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8fcf54514ab1106cdce7c3ba132d56306d125af2
--- /dev/null
+++ b/components/cdm/renderer/android_key_systems.cc
@@ -0,0 +1,76 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/cdm/renderer/android_key_systems.h"
+
+#include <string>
+#include <vector>
+
+#include "base/logging.h"
+#include "components/cdm/common/cdm_messages_android.h"
+#include "components/cdm/renderer/widevine_key_systems.h"
+#include "content/public/renderer/render_thread.h"
+
+#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
+
+using content::KeySystemInfo;
+using content::SupportedCodecs;
+
+namespace cdm {
+
+static SupportedKeySystemResponse GetSupportedKeySystem(
ddorwin 2014/06/10 18:48:04 ditto on naming
ycheo (away) 2014/06/11 00:08:22 Done.
+ const std::string& key_system) {
+ SupportedKeySystemRequest request;
+ SupportedKeySystemResponse response;
+
+ request.key_system = key_system;
+ request.codecs = content::EME_CODEC_WEBM_ALL | content::EME_CODEC_MP4_ALL;
+ content::RenderThread::Get()->Send(
+ new CdmHostMsg_GetSupportedKeySystem(request, &response));
+ DCHECK(response.compositing_codecs & content::EME_CODEC_ALL)
ddorwin 2014/06/10 18:48:04 This only checks that there is at least one suppor
ycheo (away) 2014/06/11 00:08:22 Good catch!.
+ << "unrecognized codec";
+ DCHECK(response.non_compositing_codecs & content::EME_CODEC_ALL)
+ << "unrecognized codec";
+ return response;
+}
+
+void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems) {
+ SupportedKeySystemResponse response;
+ response = GetSupportedKeySystem(kWidevineKeySystem);
ddorwin 2014/06/10 18:48:04 merge with the line above.
ycheo (away) 2014/06/11 00:08:22 Done.
+ if (response.compositing_codecs != content::EME_CODEC_NONE) {
+ AddWidevineWithCodecs(
+ WIDEVINE,
+ static_cast<SupportedCodecs>(response.compositing_codecs),
+ concrete_key_systems);
+ }
+
+ if (response.non_compositing_codecs != content::EME_CODEC_NONE) {
+ AddWidevineWithCodecs(
+ WIDEVINE_HR_NON_COMPOSITING,
+ static_cast<SupportedCodecs>(response.non_compositing_codecs),
+ concrete_key_systems);
+ }
+}
+
+void AddOtherAndroidSupportedKeySystems(
+ std::vector<KeySystemInfo>* concrete_key_systems) {
+ std::vector<std::string> key_system_names;
+ content::RenderThread::Get()->Send(
+ new CdmHostMsg_GetAllSupportedKeySystemNames(&key_system_names));
+
+ for (std::vector<std::string>::const_iterator it = key_system_names.begin();
+ it != key_system_names.end(); ++it) {
+ if (it->compare(kWidevineKeySystem) == 0) // Skip Widevine.
+ continue;
+
+ SupportedKeySystemResponse response = GetSupportedKeySystem(*it);
+ if (response.compositing_codecs != content::EME_CODEC_NONE) {
ddorwin 2014/06/10 18:48:04 Don't you want to support non-compositing?
ycheo (away) 2014/06/11 00:08:22 no, but the keysyste name suffix '.noncompositing'
ddorwin 2014/06/11 01:54:01 Right. I don't know what the use case is or even
+ KeySystemInfo info(*it);
+ info.supported_codecs = response.compositing_codecs;
+ concrete_key_systems->push_back(info);
+ }
+ }
+}
+
+} // namespace cdm

Powered by Google App Engine
This is Rietveld 408576698