diff options
author | jrummell@chromium.org <jrummell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-09 00:01:22 +0000 |
---|---|---|
committer | jrummell@chromium.org <jrummell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-09 00:01:22 +0000 |
commit | 7bce1836489c874cfc08669fae3f07d565909402 (patch) | |
tree | da9e2c90daa403f2392c657ec39c9ebed0c37456 | |
parent | c051d5a56b838d1a1ac552dffa93f52e24ab1fd3 (diff) | |
download | chromium_src-7bce1836489c874cfc08669fae3f07d565909402.zip chromium_src-7bce1836489c874cfc08669fae3f07d565909402.tar.gz chromium_src-7bce1836489c874cfc08669fae3f07d565909402.tar.bz2 |
Connect WebMediaPlayerImpl to WebContentDecryptionModuleImpl for EME WD (Chromium side).
WebMediaPlayerImpl needs to access the Decryptor object when a MediaKeys object is associated with a MediaElement (HTMLMediaElement.setMediaKeys()). These are the changes required on the Chromium side to WebMediaPlayerImpl to get a pointer to the Decryptor. Use of the Decryptor will come later.
BUG=329582
TEST=new layout test in the Blink side CL
Review URL: https://codereview.chromium.org/105143010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243701 0039d316-1c4b-4281-b951-d872f2087c98
4 files changed, 37 insertions, 1 deletions
diff --git a/content/renderer/media/webcontentdecryptionmodule_impl.cc b/content/renderer/media/webcontentdecryptionmodule_impl.cc index 14bbc8d..f98bf14 100644 --- a/content/renderer/media/webcontentdecryptionmodule_impl.cc +++ b/content/renderer/media/webcontentdecryptionmodule_impl.cc @@ -210,6 +210,10 @@ WebContentDecryptionModuleImpl::createSession( return session; } +media::Decryptor* WebContentDecryptionModuleImpl::GetDecryptor() { + return media_keys_->GetDecryptor(); +} + void WebContentDecryptionModuleImpl::OnSessionClosed(uint32 session_id) { adapter_->RemoveSession(session_id); } diff --git a/content/renderer/media/webcontentdecryptionmodule_impl.h b/content/renderer/media/webcontentdecryptionmodule_impl.h index ecd5198..50cf6d1 100644 --- a/content/renderer/media/webcontentdecryptionmodule_impl.h +++ b/content/renderer/media/webcontentdecryptionmodule_impl.h @@ -12,6 +12,7 @@ #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" namespace media { +class Decryptor; class MediaKeys; } @@ -28,6 +29,12 @@ class WebContentDecryptionModuleImpl virtual ~WebContentDecryptionModuleImpl(); + // Returns the Decryptor associated with this CDM. May be NULL if no + // Decryptor associated with the MediaKeys object. + // TODO(jrummell): Figure out lifetimes, as WMPI may still use the decryptor + // after WebContentDecryptionModule is freed. http://crbug.com/330324 + media::Decryptor* GetDecryptor(); + // blink::WebContentDecryptionModule implementation. virtual blink::WebContentDecryptionModuleSession* createSession( blink::WebContentDecryptionModuleSession::Client* client); @@ -46,6 +53,12 @@ class WebContentDecryptionModuleImpl DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl); }; +// Allow typecasting from blink type as this is the only implementation. +inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl( + blink::WebContentDecryptionModule* cdm) { + return static_cast<WebContentDecryptionModuleImpl*>(cdm); +} + } // namespace content #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ diff --git a/content/renderer/media/webmediaplayer_impl.cc b/content/renderer/media/webmediaplayer_impl.cc index 68eafa1..106a5c8 100644 --- a/content/renderer/media/webmediaplayer_impl.cc +++ b/content/renderer/media/webmediaplayer_impl.cc @@ -25,6 +25,7 @@ #include "content/renderer/media/render_media_log.h" #include "content/renderer/media/texttrack_impl.h" #include "content/renderer/media/webaudiosourceprovider_impl.h" +#include "content/renderer/media/webcontentdecryptionmodule_impl.h" #include "content/renderer/media/webinbandtexttrack_impl.h" #include "content/renderer/media/webmediaplayer_delegate.h" #include "content/renderer/media/webmediaplayer_params.h" @@ -52,6 +53,7 @@ #include "media/filters/opus_audio_decoder.h" #include "media/filters/video_renderer_impl.h" #include "media/filters/vpx_video_decoder.h" +#include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" #include "third_party/WebKit/public/platform/WebMediaSource.h" #include "third_party/WebKit/public/platform/WebRect.h" #include "third_party/WebKit/public/platform/WebSize.h" @@ -165,7 +167,8 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( pending_repaint_(false), pending_size_change_(false), video_frame_provider_client_(NULL), - text_track_index_(0) { + text_track_index_(0), + web_cdm_(NULL) { media_log_->AddEvent( media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); @@ -856,6 +859,13 @@ WebMediaPlayerImpl::CancelKeyRequestInternal( return WebMediaPlayer::MediaKeyExceptionNoError; } +void WebMediaPlayerImpl::setContentDecryptionModule( + blink::WebContentDecryptionModule* cdm) { + web_cdm_ = ToWebContentDecryptionModuleImpl(cdm); + // TODO(jrummell): use web_cdm_->getDecryptor() instead of creating + // ProxyDecryptor(). +} + void WebMediaPlayerImpl::OnDestruct() { Destroy(); } diff --git a/content/renderer/media/webmediaplayer_impl.h b/content/renderer/media/webmediaplayer_impl.h index fc221ec..ac2924e 100644 --- a/content/renderer/media/webmediaplayer_impl.h +++ b/content/renderer/media/webmediaplayer_impl.h @@ -47,6 +47,7 @@ class RenderAudioSourceProvider; namespace blink { +class WebContentDecryptionModule; class WebFrame; } @@ -67,6 +68,7 @@ class WebLayerImpl; namespace content { class BufferedDataSource; class WebAudioSourceProviderImpl; +class WebContentDecryptionModuleImpl; class WebMediaPlayerDelegate; class WebMediaPlayerParams; class WebTextTrackImpl; @@ -175,6 +177,9 @@ class WebMediaPlayerImpl const blink::WebString& key_system, const blink::WebString& session_id); + virtual void setContentDecryptionModule( + blink::WebContentDecryptionModule* cdm); + // content::RenderViewObserver implementation. virtual void OnDestruct() OVERRIDE; @@ -370,6 +375,10 @@ class WebMediaPlayerImpl // Text track objects get a unique index value when they're created. int text_track_index_; + // Non-owned pointer to the CDM. Updated via calls to + // setContentDecryptionModule(). + WebContentDecryptionModuleImpl* web_cdm_; + DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); }; |