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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 audio_stream.Pass(), | 74 audio_stream.Pass(), |
75 video_stream.Pass(), | 75 video_stream.Pass(), |
76 BindToCurrentLoop(base::Bind(&MojoRendererImpl::OnInitialized, | 76 BindToCurrentLoop(base::Bind(&MojoRendererImpl::OnInitialized, |
77 weak_factory_.GetWeakPtr()))); | 77 weak_factory_.GetWeakPtr()))); |
78 } | 78 } |
79 | 79 |
80 void MojoRendererImpl::SetCdm(CdmContext* cdm_context, | 80 void MojoRendererImpl::SetCdm(CdmContext* cdm_context, |
81 const CdmAttachedCB& cdm_attached_cb) { | 81 const CdmAttachedCB& cdm_attached_cb) { |
82 DVLOG(1) << __FUNCTION__; | 82 DVLOG(1) << __FUNCTION__; |
83 DCHECK(task_runner_->BelongsToCurrentThread()); | 83 DCHECK(task_runner_->BelongsToCurrentThread()); |
84 NOTIMPLEMENTED(); | 84 |
85 cdm_attached_cb.Run(false); | 85 int32_t cdm_id = cdm_context->GetCdmId(); |
| 86 if (cdm_id == CdmContext::kInvalidCdmId) { |
| 87 cdm_attached_cb.Run(false); |
| 88 return; |
| 89 } |
| 90 |
| 91 remote_media_renderer_->SetCdm(cdm_id, cdm_attached_cb); |
86 } | 92 } |
87 | 93 |
88 void MojoRendererImpl::Flush(const base::Closure& flush_cb) { | 94 void MojoRendererImpl::Flush(const base::Closure& flush_cb) { |
89 DVLOG(2) << __FUNCTION__; | 95 DVLOG(2) << __FUNCTION__; |
90 DCHECK(task_runner_->BelongsToCurrentThread()); | 96 DCHECK(task_runner_->BelongsToCurrentThread()); |
91 remote_media_renderer_->Flush(flush_cb); | 97 remote_media_renderer_->Flush(flush_cb); |
92 } | 98 } |
93 | 99 |
94 void MojoRendererImpl::StartPlayingFrom(base::TimeDelta time) { | 100 void MojoRendererImpl::StartPlayingFrom(base::TimeDelta time) { |
95 DVLOG(2) << __FUNCTION__; | 101 DVLOG(2) << __FUNCTION__; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 } | 203 } |
198 | 204 |
199 void MojoRendererImpl::OnInitialized() { | 205 void MojoRendererImpl::OnInitialized() { |
200 DVLOG(1) << __FUNCTION__; | 206 DVLOG(1) << __FUNCTION__; |
201 DCHECK(task_runner_->BelongsToCurrentThread()); | 207 DCHECK(task_runner_->BelongsToCurrentThread()); |
202 if (!init_cb_.is_null()) | 208 if (!init_cb_.is_null()) |
203 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); | 209 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); |
204 } | 210 } |
205 | 211 |
206 } // namespace media | 212 } // namespace media |
OLD | NEW |