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

Unified Diff: webkit/media/webmediaplayer_impl.cc

Issue 11414138: Encrypted Media: No NeedKey if --enable-encrypted-media is not set. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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 | « webkit/media/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/media/webmediaplayer_impl.cc
diff --git a/webkit/media/webmediaplayer_impl.cc b/webkit/media/webmediaplayer_impl.cc
index d69547bd2929f9066a001484d16b61feed0d715d..47f656317fb8d85eb026dbd56481d730694f55e0 100644
--- a/webkit/media/webmediaplayer_impl.cc
+++ b/webkit/media/webmediaplayer_impl.cc
@@ -128,6 +128,7 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
media::AudioRendererSink* audio_renderer_sink,
media::MessageLoopFactory* message_loop_factory,
MediaStreamClient* media_stream_client,
+ bool encrypted_media_enabled,
media::MediaLog* media_log)
: frame_(frame),
network_state_(WebMediaPlayer::NetworkStateEmpty),
@@ -151,11 +152,6 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
audio_renderer_sink_(audio_renderer_sink),
is_local_source_(false),
supports_save_(true),
- decryptor_(message_loop_factory_->GetMessageLoop(
- media::MessageLoopFactory::kPipeline),
- proxy_.get(),
- client,
- frame),
starting_(false) {
media_log_->AddEvent(
media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED));
@@ -191,6 +187,11 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
// Create default audio renderer.
filter_collection_->AddAudioRenderer(
new media::AudioRendererImpl(new media::NullAudioSink()));
+
+ if (encrypted_media_enabled) {
scherkus (not reviewing) 2012/11/27 23:17:43 I believe you can simplify a lot of this CL by:
xhwang 2012/11/29 02:24:14 Done.
+ decryptor_.reset(new ProxyDecryptor(message_loop_factory_->GetMessageLoop(
+ media::MessageLoopFactory::kPipeline), proxy_.get(), client, frame));
+ }
}
WebMediaPlayerImpl::~WebMediaPlayerImpl() {
@@ -275,7 +276,7 @@ void WebMediaPlayerImpl::load(const WebKit::WebURL& url, CORSMode cors_mode) {
BuildMediaSourceCollection(chunk_demuxer_,
message_loop_factory_.get(),
filter_collection_.get(),
- &decryptor_);
+ decryptor_.get());
supports_save_ = false;
StartPipeline();
return;
@@ -297,7 +298,7 @@ void WebMediaPlayerImpl::load(const WebKit::WebURL& url, CORSMode cors_mode) {
BuildDefaultCollection(proxy_->data_source(),
message_loop_factory_.get(),
filter_collection_.get(),
- &decryptor_);
+ decryptor_.get());
}
void WebMediaPlayerImpl::cancelLoad() {
@@ -805,7 +806,7 @@ WebMediaPlayerImpl::GenerateKeyRequestInternal(
// TODO(xhwang): We assume all streams are from the same container (thus have
// the same "type") for now. In the future, the "type" should be passed down
// from the application.
- if (!decryptor_.GenerateKeyRequest(key_system.utf8(),
+ if (!decryptor_->GenerateKeyRequest(key_system.utf8(),
init_data_type_,
init_data, init_data_length)) {
current_key_system_.reset();
@@ -852,7 +853,7 @@ WebMediaPlayer::MediaKeyException WebMediaPlayerImpl::AddKeyInternal(
static_cast<size_t>(init_data_length))
<< " [" << session_id.utf8().data() << "]";
- decryptor_.AddKey(key_system.utf8(), key, key_length,
+ decryptor_->AddKey(key_system.utf8(), key, key_length,
init_data, init_data_length, session_id.utf8());
return WebMediaPlayer::MediaKeyExceptionNoError;
}
@@ -876,7 +877,7 @@ WebMediaPlayerImpl::CancelKeyRequestInternal(
if (current_key_system_.isEmpty() || key_system != current_key_system_)
return WebMediaPlayer::MediaKeyExceptionInvalidPlayerState;
- decryptor_.CancelKeyRequest(key_system.utf8(), session_id.utf8());
+ decryptor_->CancelKeyRequest(key_system.utf8(), session_id.utf8());
return WebMediaPlayer::MediaKeyExceptionNoError;
}
@@ -1025,6 +1026,10 @@ void WebMediaPlayerImpl::OnNeedKey(const std::string& key_system,
int init_data_size) {
DCHECK_EQ(main_loop_, MessageLoop::current());
+ // Do not fire NeedKey event if encrypted media is not enabled.
+ if (!decryptor_)
+ return;
+
UMA_HISTOGRAM_COUNTS(kMediaEme + std::string("NeedKey"), 1);
DCHECK(init_data_type_.empty() || type.empty() || type == init_data_type_);
« no previous file with comments | « webkit/media/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698