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