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

Side by Side Diff: media/remoting/remoting_cdm_controller.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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/remoting/remoting_cdm_controller.h"
6
7 #include "base/bind.h"
8 #include "base/callback_helpers.h"
9 #include "base/logging.h"
10 #include "base/threading/thread_checker.h"
11
12 namespace media {
13
14 RemotingCdmController::RemotingCdmController(
15 scoped_refptr<RemotingSourceImpl> remoting_source)
16 : remoting_source_(std::move(remoting_source)) {
17 remoting_source_->AddClient(this);
18 }
19
20 RemotingCdmController::~RemotingCdmController() {
21 DCHECK(thread_checker_.CalledOnValidThread());
22
23 remoting_source_->RemoveClient(this);
24 }
25
26 void RemotingCdmController::OnStarted(bool success) {
27 DCHECK(thread_checker_.CalledOnValidThread());
28
29 DCHECK(!cdm_check_cb_.is_null());
30 is_remoting_ = success;
31 base::ResetAndReturn(&cdm_check_cb_).Run(success);
xhwang 2016/11/01 08:21:28 Is it possible that |cdm_check_cb_| is null, e.g.
xjz 2016/11/01 21:55:53 No. The RemotingCdmController will only call Start
32 }
33
34 void RemotingCdmController::OnSessionStateChanged() {
35 DCHECK(thread_checker_.CalledOnValidThread());
36
37 if (is_remoting_ &&
38 remoting_source_->state() == RemotingSessionState::SESSION_STOPPING) {
39 remoting_source_->Shutdown();
xhwang 2016/11/01 08:21:28 It's a bit confusing to me on the ownership of |re
xjz 2016/11/01 21:55:52 After SetCdm() is called, |remoting_source_| is ow
40 is_remoting_ = false;
41 }
42 }
43
44 void RemotingCdmController::ShouldCreateRemotingCdm(
45 const CdmCheckCallback& cb) {
46 DCHECK(thread_checker_.CalledOnValidThread());
47 DCHECK(!cb.is_null());
48
49 if (is_remoting_) {
50 cb.Run(true);
51 return;
52 }
53
54 DCHECK(cdm_check_cb_.is_null());
55 cdm_check_cb_ = cb;
56 remoting_source_->StartRemoting(this);
xhwang 2016/11/01 16:52:37 For the majority (say >99%) of playback sessions w
xjz 2016/11/01 21:55:52 IIUC, this StartRemoting() call does not always en
xhwang 2016/11/02 06:47:05 I see. Thanks for pointing this out. So now it se
xjz 2016/11/02 17:38:11 +miu We currently only create the RemotingSourceI
miu 2016/11/03 00:03:08 xhwang brings up a good point. What if we created
xjz 2016/11/03 00:30:15 Yes, we can do that. So there will be always a spa
57 }
58
59 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698