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

Unified Diff: media/remoting/remoting_cdm_controller.cc

Issue 2406483002: WIP - Add EME (Closed)
Patch Set: Rebase. Split RemotingSourceImpl. Addressed comments. Created 4 years, 2 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: media/remoting/remoting_cdm_controller.cc
diff --git a/media/remoting/remoting_cdm_controller.cc b/media/remoting/remoting_cdm_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..223e734e0066ecdab6a5d30391bb8ad63b68590c
--- /dev/null
+++ b/media/remoting/remoting_cdm_controller.cc
@@ -0,0 +1,55 @@
+// 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_controller.h"
+
+#include "base/bind.h"
+#include "base/callback_helpers.h"
+#include "base/logging.h"
+#include "base/threading/thread_checker.h"
+
+namespace media {
+
+RemotingCdmController::RemotingCdmController(
+ scoped_refptr<RemotingSourceImpl> remoting_source)
+ : remoting_source_(remoting_source) {
miu 2016/10/25 04:21:25 nit: Use std::move() here to avoid an unnecessary
xjz 2016/10/26 22:00:25 Done.
+ remoting_source_->AddClient(this);
+}
+
+RemotingCdmController::~RemotingCdmController() {
+ remoting_source_->RemoveClient(this);
miu 2016/10/25 04:21:25 DCHECK(thread_checker_...);
xjz 2016/10/26 22:00:25 Done.
+}
+
+void RemotingCdmController::OnStarted(bool success) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ base::ResetAndReturn(&cdm_check_cb_).Run(success);
miu 2016/10/25 04:21:25 DCHECK(!cdm_check_cb_.is_null()) before this line
xjz 2016/10/26 22:00:25 Done.
+ is_remoting_ = success;
+}
+
+void RemotingCdmController::OnSessionStateChanged() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ if (is_remoting_ &&
+ remoting_source_->state() == RemotingSessionState::SESSION_STOPPING) {
+ remoting_source_->ShutDown();
+ is_remoting_ = false;
+ }
+}
+
+void RemotingCdmController::ShouldCreateRemotingCdm(
+ const CdmCheckCallback& cb) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(!cb.is_null());
+
+ if (is_remoting_) {
+ cb.Run(true);
+ return;
+ }
+
+ cdm_check_cb_ = cb;
miu 2016/10/25 04:21:25 DCHECK(cdm_check_cb_.is_null()) before this line t
xjz 2016/10/26 22:00:25 Done with DCHECK. There should be no other queries
+ remoting_source_->StartRemoting(this);
+}
+
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698