OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/mojo/services/mojo_renderer_impl.h" | 5 #include "media/mojo/services/mojo_renderer_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 audio_stream.Pass(), | 77 audio_stream.Pass(), |
78 video_stream.Pass(), | 78 video_stream.Pass(), |
79 BindToCurrentLoop(base::Bind(&MojoRendererImpl::OnInitialized, | 79 BindToCurrentLoop(base::Bind(&MojoRendererImpl::OnInitialized, |
80 weak_factory_.GetWeakPtr()))); | 80 weak_factory_.GetWeakPtr()))); |
81 } | 81 } |
82 | 82 |
83 void MojoRendererImpl::SetCdm(CdmContext* cdm_context, | 83 void MojoRendererImpl::SetCdm(CdmContext* cdm_context, |
84 const CdmAttachedCB& cdm_attached_cb) { | 84 const CdmAttachedCB& cdm_attached_cb) { |
85 DVLOG(1) << __FUNCTION__; | 85 DVLOG(1) << __FUNCTION__; |
86 DCHECK(task_runner_->BelongsToCurrentThread()); | 86 DCHECK(task_runner_->BelongsToCurrentThread()); |
87 NOTIMPLEMENTED(); | 87 |
88 cdm_attached_cb.Run(false); | 88 int32_t cdm_id = cdm_context->GetCdmId(); |
| 89 if (cdm_id == CdmContext::kInvalidCdmId) { |
| 90 cdm_attached_cb.Run(false); |
| 91 return; |
| 92 } |
| 93 |
| 94 remote_media_renderer_->SetCdm(cdm_id, cdm_attached_cb); |
89 } | 95 } |
90 | 96 |
91 void MojoRendererImpl::Flush(const base::Closure& flush_cb) { | 97 void MojoRendererImpl::Flush(const base::Closure& flush_cb) { |
92 DVLOG(2) << __FUNCTION__; | 98 DVLOG(2) << __FUNCTION__; |
93 DCHECK(task_runner_->BelongsToCurrentThread()); | 99 DCHECK(task_runner_->BelongsToCurrentThread()); |
94 remote_media_renderer_->Flush(flush_cb); | 100 remote_media_renderer_->Flush(flush_cb); |
95 } | 101 } |
96 | 102 |
97 void MojoRendererImpl::StartPlayingFrom(base::TimeDelta time) { | 103 void MojoRendererImpl::StartPlayingFrom(base::TimeDelta time) { |
98 DVLOG(2) << __FUNCTION__; | 104 DVLOG(2) << __FUNCTION__; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 207 |
202 void MojoRendererImpl::OnInitialized() { | 208 void MojoRendererImpl::OnInitialized() { |
203 DVLOG(1) << __FUNCTION__; | 209 DVLOG(1) << __FUNCTION__; |
204 DCHECK(task_runner_->BelongsToCurrentThread()); | 210 DCHECK(task_runner_->BelongsToCurrentThread()); |
205 DCHECK(!init_cb_.is_null()); | 211 DCHECK(!init_cb_.is_null()); |
206 | 212 |
207 base::ResetAndReturn(&init_cb_).Run(); | 213 base::ResetAndReturn(&init_cb_).Run(); |
208 } | 214 } |
209 | 215 |
210 } // namespace media | 216 } // namespace media |
OLD | NEW |