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

Unified Diff: media/filters/gpu_video_decoder.cc

Issue 1666653002: media: Remove SetCdmReadyCB and CdmReadyCB (part 1). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: media/filters/gpu_video_decoder.cc
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc
index f5ef4b805ea6d4c00f5462a0565ac9f768bbcce6..6bf047c1bc2e8ee05beed8f0e6211a1b32a4e613 100644
--- a/media/filters/gpu_video_decoder.cc
+++ b/media/filters/gpu_video_decoder.cc
@@ -128,7 +128,7 @@ std::string GpuVideoDecoder::GetDisplayName() const {
void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config,
bool /* low_delay */,
- const SetCdmReadyCB& set_cdm_ready_cb,
+ CdmContext* cdm_context,
const InitCB& init_cb,
const OutputCB& output_cb) {
DVLOG(3) << "Initialize()";
@@ -197,10 +197,16 @@ void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config,
}
if (config.is_encrypted()) {
+ DCHECK(cdm_context);
+ if (cdm_context->GetCdmId() == CdmContext::kInvalidCdmId) {
+ DVLOG(1) << "CDM ID not available.";
+ bound_init_cb.Run(false);
+ return;
+ }
+
+ // |init_cb_| will be fired when CDM is attached.
init_cb_ = bound_init_cb;
- set_cdm_ready_cb_ = set_cdm_ready_cb;
- set_cdm_ready_cb_.Run(BindToCurrentLoop(
- base::Bind(&GpuVideoDecoder::SetCdm, weak_factory_.GetWeakPtr())));
+ vda_->SetCdm(cdm_context->GetCdmId());
return;
}
@@ -208,32 +214,10 @@ void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config,
bound_init_cb.Run(true);
}
-void GpuVideoDecoder::SetCdm(CdmContext* cdm_context,
- const CdmAttachedCB& cdm_attached_cb) {
- DVLOG(2) << __FUNCTION__;
- DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
-
- DCHECK(!init_cb_.is_null());
- DCHECK(!set_cdm_ready_cb_.is_null());
- set_cdm_ready_cb_.Reset();
-
- if (!cdm_context || cdm_context->GetCdmId() == CdmContext::kInvalidCdmId) {
- DVLOG(1) << "CDM ID not available.";
- cdm_attached_cb.Run(false);
- base::ResetAndReturn(&init_cb_).Run(false);
- return;
- }
-
- cdm_attached_cb_ = cdm_attached_cb;
- vda_->SetCdm(cdm_context->GetCdmId());
-}
-
void GpuVideoDecoder::NotifyCdmAttached(bool success) {
DVLOG_IF(2, !success) << __FUNCTION__ << ": CDM not attached.";
DCHECK(!init_cb_.is_null());
- DCHECK(!cdm_attached_cb_.is_null());
- base::ResetAndReturn(&cdm_attached_cb_).Run(success);
base::ResetAndReturn(&init_cb_).Run(success);
}
@@ -606,10 +590,6 @@ GpuVideoDecoder::~GpuVideoDecoder() {
DestroyVDA();
DCHECK(assigned_picture_buffers_.empty());
- if (!set_cdm_ready_cb_.is_null())
- base::ResetAndReturn(&set_cdm_ready_cb_).Run(CdmReadyCB());
- if (!cdm_attached_cb_.is_null())
- base::ResetAndReturn(&cdm_attached_cb_).Run(false);
if (!init_cb_.is_null())
base::ResetAndReturn(&init_cb_).Run(false);

Powered by Google App Engine
This is Rietveld 408576698