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

Unified Diff: chromecast/browser/media/cast_media_client_android.cc

Issue 962793005: Adds MediaClientAndroid to support embedder/MediaDrmBridge interaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: overhaul: creates MediaClientAndroid (browser-side client), eliminates Java-based MediaDrmBridge ke… Created 5 years, 8 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: chromecast/browser/media/cast_media_client_android.cc
diff --git a/chromecast/browser/media/cast_media_client_android.cc b/chromecast/browser/media/cast_media_client_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..11b8934a325c96685f04bf6488cbcd6f5d3b8c06
--- /dev/null
+++ b/chromecast/browser/media/cast_media_client_android.cc
@@ -0,0 +1,57 @@
+// Copyright 2015 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 "chromecast/browser/media/cast_media_client_android.h"
+
+#include <utility>
+
+#include "base/stl_util.h"
+#include "chromecast/media/base/key_systems_common.h"
+#include "chromecast/media/cdm/playready_drm_delegate_android.h"
+#include "components/cdm/browser/widevine_drm_delegate_android.h"
+
+namespace chromecast {
+namespace media {
+
+CastMediaClientAndroid::CastMediaClientAndroid() {
+#if defined(PLAYREADY_CDM_AVAILABLE)
+ ::media::MediaDrmBridgeDelegate* playready_delegate =
+ new PlayreadyDrmDelegateAndroid;
+ mappings_.push_back(std::make_pair(kChromecastPlayreadyKeySystem,
+ playready_delegate->GetUUID()));
+ delegates_[playready_delegate->GetUUID()] = playready_delegate;
+#endif
+
+#if defined(WIDEVINE_CDM_AVAILABLE)
+ // Note: MediaDrmBridge adds the Widevine UUID mapping automatically.
+ delegates_[widevine_delegate->GetUUID()] =
+ new cdm::WidevineDrmDelegateAndroid;
xhwang 2015/04/24 04:52:23 ditto about new Foo().
gunsch 2015/04/27 23:44:11 Done.
+#endif
+
+ auto platform_mappings = GetPlatformKeySystemUUIDMappings();
+ mappings_.insert(mappings_.end(),
+ platform_mappings.begin(),
+ platform_mappings.end());
+}
+
+CastMediaClientAndroid::~CastMediaClientAndroid() {
+ STLDeleteContainerPairSecondPointers(delegates_.begin(), delegates_.end());
xhwang 2015/04/24 04:52:23 If you use ScopedPtrHashMap, then you don't need t
gunsch 2015/04/27 23:44:12 Unfortunately there's no hash function for std::ve
xhwang 2015/04/28 05:25:11 Acknowledged.
+}
+
+std::vector<std::pair<std::string, std::vector<uint8_t>>>
+CastMediaClientAndroid::GetKeySystemUUIDMappings() const {
+ return mappings_;
+}
+
+::media::MediaDrmBridgeDelegate*
+CastMediaClientAndroid::GetMediaDrmBridgeDelegate(
+ const std::vector<uint8_t>& scheme_uuid) const {
+ DelegateMap::const_iterator it = delegates_.find(scheme_uuid);
+ if (it == delegates_.end())
+ return nullptr;
+ return it->second;
+}
+
+} // namespace media
+} // namespace chromecast

Powered by Google App Engine
This is Rietveld 408576698