summaryrefslogtreecommitdiffstats
path: root/media/base/pipeline.cc
diff options
context:
space:
mode:
authorxhwang <xhwang@chromium.org>2014-11-25 00:44:01 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-25 08:44:53 +0000
commit97de420c168b0650f90c4a05a6e1614cf6684a51 (patch)
treea9faaf885db1f2da9a1aae1bb8f6247db31610d0 /media/base/pipeline.cc
parent0951457a3ccedffa92ce1030d7edc13a4c3c47df (diff)
downloadchromium_src-97de420c168b0650f90c4a05a6e1614cf6684a51.zip
chromium_src-97de420c168b0650f90c4a05a6e1614cf6684a51.tar.gz
chromium_src-97de420c168b0650f90c4a05a6e1614cf6684a51.tar.bz2
Handle SetCdm() in media::Renderer.
Changes include: - Pass CdmContext in SetCdm(). - Move SetCdm() handling code from EncryptedMediaPlayerSupport to RendererImpl. - Pass in SetDecryptorReadyCB at initialization time instead of construction time for several classes: VRI/ARI/DecoderStream/DecoderSelector. - Prefixed EME uses the same path to SetCdm(). BUG=401264 TEST=All existing tests pass. Review URL: https://codereview.chromium.org/748863002 Cr-Commit-Position: refs/heads/master@{#305605}
Diffstat (limited to 'media/base/pipeline.cc')
-rw-r--r--media/base/pipeline.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/media/base/pipeline.cc b/media/base/pipeline.cc
index 7534688..79a50fd 100644
--- a/media/base/pipeline.cc
+++ b/media/base/pipeline.cc
@@ -44,6 +44,7 @@ Pipeline::Pipeline(
renderer_ended_(false),
text_renderer_ended_(false),
demuxer_(NULL),
+ pending_cdm_context_(nullptr),
weak_factory_(this) {
media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(kCreated));
media_log_->AddEvent(
@@ -191,6 +192,13 @@ PipelineStatistics Pipeline::GetStatistics() const {
return statistics_;
}
+void Pipeline::SetCdm(CdmContext* cdm_context,
+ const CdmAttachedCB& cdm_attached_cb) {
+ task_runner_->PostTask(
+ FROM_HERE, base::Bind(&Pipeline::SetCdmTask, weak_factory_.GetWeakPtr(),
+ cdm_context, cdm_attached_cb));
+}
+
void Pipeline::SetErrorForTesting(PipelineStatus status) {
OnError(status);
}
@@ -496,6 +504,12 @@ void Pipeline::StartTask() {
base::Bind(&Pipeline::OnTextRendererEnded, weak_factory_.GetWeakPtr()));
}
+ // Set CDM early to avoid unnecessary delay in Renderer::Initialize().
+ if (pending_cdm_context_) {
+ renderer_->SetCdm(pending_cdm_context_, base::Bind(&IgnoreCdmAttached));
+ pending_cdm_context_ = nullptr;
+ }
+
StateTransitionTask(PIPELINE_OK);
}
@@ -602,6 +616,17 @@ void Pipeline::SeekTask(TimeDelta time, const PipelineStatusCB& seek_cb) {
base::Bind(&Pipeline::OnStateTransition, weak_factory_.GetWeakPtr()));
}
+void Pipeline::SetCdmTask(CdmContext* cdm_context,
+ const CdmAttachedCB& cdm_attached_cb) {
+ if (!renderer_) {
+ pending_cdm_context_ = cdm_context;
+ cdm_attached_cb.Run(true);
+ return;
+ }
+
+ renderer_->SetCdm(cdm_context, cdm_attached_cb);
+}
+
void Pipeline::OnRendererEnded() {
DCHECK(task_runner_->BelongsToCurrentThread());
media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::ENDED));