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

Unified Diff: media/filters/decoder_selector.cc

Issue 1666653002: media: Remove SetCdmReadyCB and CdmReadyCB (part 1). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and fix compile errors Created 4 years, 10 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
« no previous file with comments | « media/filters/decoder_selector.h ('k') | media/filters/decoder_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/decoder_selector.cc
diff --git a/media/filters/decoder_selector.cc b/media/filters/decoder_selector.cc
index 87e58a695f14598c79d8d61a8495471eb62a3b35..6df22dc218f6d764a0513e26d45c2e9714dc2229 100644
--- a/media/filters/decoder_selector.cc
+++ b/media/filters/decoder_selector.cc
@@ -13,6 +13,7 @@
#include "build/build_config.h"
#include "media/base/audio_decoder.h"
#include "media/base/bind_to_current_loop.h"
+#include "media/base/cdm_context.h"
#include "media/base/demuxer_stream.h"
#include "media/base/media_log.h"
#include "media/base/pipeline.h"
@@ -81,7 +82,7 @@ DecoderSelector<StreamType>::~DecoderSelector() {
template <DemuxerStream::Type StreamType>
void DecoderSelector<StreamType>::SelectDecoder(
DemuxerStream* stream,
- const SetCdmReadyCB& set_cdm_ready_cb,
+ CdmContext* cdm_context,
const SelectDecoderCB& select_decoder_cb,
const typename Decoder::OutputCB& output_cb,
const base::Closure& waiting_for_decryption_key_cb) {
@@ -90,7 +91,7 @@ void DecoderSelector<StreamType>::SelectDecoder(
DCHECK(stream);
DCHECK(select_decoder_cb_.is_null());
- set_cdm_ready_cb_ = set_cdm_ready_cb;
+ cdm_context_ = cdm_context;
waiting_for_decryption_key_cb_ = waiting_for_decryption_key_cb;
// Make sure |select_decoder_cb| runs on a different execution stack.
@@ -112,7 +113,7 @@ void DecoderSelector<StreamType>::SelectDecoder(
// This could be null during fallback after decoder reinitialization failure.
// See DecoderStream<StreamType>::OnDecoderReinitialized().
- if (set_cdm_ready_cb_.is_null()) {
+ if (!cdm_context_) {
ReturnNullDecoder();
return;
}
@@ -127,11 +128,12 @@ void DecoderSelector<StreamType>::SelectDecoder(
#if !defined(OS_ANDROID)
template <DemuxerStream::Type StreamType>
void DecoderSelector<StreamType>::InitializeDecryptingDecoder() {
+ DVLOG(2) << __FUNCTION__;
decoder_.reset(new typename StreamTraits::DecryptingDecoderType(
task_runner_, media_log_, waiting_for_decryption_key_cb_));
DecoderStreamTraits<StreamType>::InitializeDecoder(
- decoder_.get(), input_stream_, set_cdm_ready_cb_,
+ decoder_.get(), input_stream_, cdm_context_,
base::Bind(&DecoderSelector<StreamType>::DecryptingDecoderInitDone,
weak_ptr_factory_.GetWeakPtr()),
output_cb_);
@@ -157,12 +159,23 @@ void DecoderSelector<StreamType>::DecryptingDecoderInitDone(bool success) {
#endif // !defined(OS_ANDROID)
template <DemuxerStream::Type StreamType>
+void DecoderSelector<StreamType>::SetCdmReadyCallback(
+ const CdmReadyCB& cdm_ready_cb) {
+ DCHECK(cdm_context_);
+ cdm_ready_cb.Run(cdm_context_, base::Bind(IgnoreCdmAttached));
+}
+
+template <DemuxerStream::Type StreamType>
void DecoderSelector<StreamType>::InitializeDecryptingDemuxerStream() {
decrypted_stream_.reset(new DecryptingDemuxerStream(
task_runner_, media_log_, waiting_for_decryption_key_cb_));
+ // TODO(xhwang): Fix DecryptingDemuxerStream::Initialize() to take
+ // |cdm_context_| directly.
decrypted_stream_->Initialize(
- input_stream_, set_cdm_ready_cb_,
+ input_stream_,
+ base::Bind(&DecoderSelector<StreamType>::SetCdmReadyCallback,
+ weak_ptr_factory_.GetWeakPtr()),
base::Bind(&DecoderSelector<StreamType>::DecryptingDemuxerStreamInitDone,
weak_ptr_factory_.GetWeakPtr()));
}
@@ -204,7 +217,7 @@ void DecoderSelector<StreamType>::InitializeDecoder() {
decoders_.weak_erase(decoders_.begin());
DecoderStreamTraits<StreamType>::InitializeDecoder(
- decoder_.get(), input_stream_, set_cdm_ready_cb_,
+ decoder_.get(), input_stream_, cdm_context_,
base::Bind(&DecoderSelector<StreamType>::DecoderInitDone,
weak_ptr_factory_.GetWeakPtr()),
output_cb_);
« no previous file with comments | « media/filters/decoder_selector.h ('k') | media/filters/decoder_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698