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

Unified Diff: media/remoting/remoting_cdm.cc

Issue 2457563002: Media Remoting: Add remoting control logic for encrypted contents. (Closed)
Patch Set: Addressed comments. Created 4 years, 1 month 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: media/remoting/remoting_cdm.cc
diff --git a/media/remoting/remoting_cdm.cc b/media/remoting/remoting_cdm.cc
new file mode 100644
index 0000000000000000000000000000000000000000..61d8a1a7c571b8eedd74c5999dc278b60601d420
--- /dev/null
+++ b/media/remoting/remoting_cdm.cc
@@ -0,0 +1,105 @@
+// Copyright 2016 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 "media/remoting/remoting_cdm.h"
+
+#include "media/base/cdm_promise.h"
+
+namespace media {
+
+namespace {
+// Used as an identifier for RemotingCdm::From().
+void* const kClassIdentifier = const_cast<void**>(&kClassIdentifier);
xhwang 2016/11/01 08:21:28 This will work, but I wonder how is this better th
xjz 2016/11/01 21:55:52 I used the same way as here: https://cs.chromium.o
xhwang 2016/11/02 06:47:05 +miu yeah, I did code search and found this patte
+} // namespace
+
+// TODO(xjz): Merge this with Eric's implementation.
+RemotingCdm::RemotingCdm(
+ const std::string& key_system,
+ const GURL& security_origin,
+ const CdmConfig& cdm_config,
+ const SessionMessageCB& session_message_cb,
+ const SessionClosedCB& session_closed_cb,
+ const SessionKeysChangeCB& session_keys_change_cb,
+ const SessionExpirationUpdateCB& session_expiration_update_cb,
+ const CdmCreatedCB& cdm_created_cb,
+ std::unique_ptr<RemotingCdmController> remoting_controller)
+ : remoting_controller_(std::move(remoting_controller)) {
+ DCHECK(remoting_controller_);
+
+ // TODO(xjz): Not implemented. Need to merge with Eric's implementation.
+}
+
+RemotingCdm::~RemotingCdm() {}
+
+RemotingCdm* RemotingCdm::From(CdmContext* cdm) {
+ if (cdm && cdm->GetClassIdentifier() == kClassIdentifier)
+ return static_cast<RemotingCdm*>(cdm);
+ return nullptr;
+}
+
+void RemotingCdm::SetServerCertificate(
+ const std::vector<uint8_t>& certificate,
+ std::unique_ptr<SimpleCdmPromise> promise) {
+ // TODO(xjz): Merge with Eric's implementation.
+ NOTIMPLEMENTED();
+}
+
+void RemotingCdm::CreateSessionAndGenerateRequest(
+ SessionType session_type,
+ EmeInitDataType init_data_type,
+ const std::vector<uint8_t>& init_data,
+ std::unique_ptr<NewSessionCdmPromise> promise) {
+ // TODO(xjz): Merge with Eric's implementation.
+ NOTIMPLEMENTED();
+}
+
+void RemotingCdm::LoadSession(SessionType session_type,
+ const std::string& session_id,
+ std::unique_ptr<NewSessionCdmPromise> promise) {
+ // TODO(xjz): Merge with Eric's implementation.
+ NOTIMPLEMENTED();
+}
+
+void RemotingCdm::UpdateSession(const std::string& session_id,
+ const std::vector<uint8_t>& response,
+ std::unique_ptr<SimpleCdmPromise> promise) {
+ // TODO(xjz): Merge with Eric's implementation.
+ NOTIMPLEMENTED();
+}
+
+void RemotingCdm::CloseSession(const std::string& session_id,
+ std::unique_ptr<SimpleCdmPromise> promise) {
+ // TODO(xjz): Merge with Eric's implementation.
+ NOTIMPLEMENTED();
+}
+
+void RemotingCdm::RemoveSession(const std::string& session_id,
+ std::unique_ptr<SimpleCdmPromise> promise) {
+ // TODO(xjz): Merge with Eric's implementation.
+ NOTIMPLEMENTED();
+}
+
+CdmContext* RemotingCdm::GetCdmContext() {
+ return this;
+}
+
+Decryptor* RemotingCdm::GetDecryptor() {
+ // TODO(xjz): Merge with Eric's implementation.
+ return nullptr;
+}
+
+int RemotingCdm::GetCdmId() const {
+ // TODO(xjz): Merge with Eric's implementation.
+ return CdmContext::kInvalidCdmId;
+}
+
+void* RemotingCdm::GetClassIdentifier() const {
+ return kClassIdentifier;
+}
+
+RemotingSourceImpl* RemotingCdm::GetRemotingSource() {
+ return remoting_controller_->remoting_source();
+}
+
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698