Commit 7bce1836 authored by jrummell@chromium.org's avatar jrummell@chromium.org

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
parent c051d5a5
...@@ -210,6 +210,10 @@ WebContentDecryptionModuleImpl::createSession( ...@@ -210,6 +210,10 @@ WebContentDecryptionModuleImpl::createSession(
return session; return session;
} }
media::Decryptor* WebContentDecryptionModuleImpl::GetDecryptor() {
return media_keys_->GetDecryptor();
}
void WebContentDecryptionModuleImpl::OnSessionClosed(uint32 session_id) { void WebContentDecryptionModuleImpl::OnSessionClosed(uint32 session_id) {
adapter_->RemoveSession(session_id); adapter_->RemoveSession(session_id);
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h"
namespace media { namespace media {
class Decryptor;
class MediaKeys; class MediaKeys;
} }
...@@ -28,6 +29,12 @@ class WebContentDecryptionModuleImpl ...@@ -28,6 +29,12 @@ class WebContentDecryptionModuleImpl
virtual ~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. // blink::WebContentDecryptionModule implementation.
virtual blink::WebContentDecryptionModuleSession* createSession( virtual blink::WebContentDecryptionModuleSession* createSession(
blink::WebContentDecryptionModuleSession::Client* client); blink::WebContentDecryptionModuleSession::Client* client);
...@@ -46,6 +53,12 @@ class WebContentDecryptionModuleImpl ...@@ -46,6 +53,12 @@ class WebContentDecryptionModuleImpl
DISALLOW_COPY_AND_ASSIGN(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 } // namespace content
#endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_ #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "content/renderer/media/render_media_log.h" #include "content/renderer/media/render_media_log.h"
#include "content/renderer/media/texttrack_impl.h" #include "content/renderer/media/texttrack_impl.h"
#include "content/renderer/media/webaudiosourceprovider_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/webinbandtexttrack_impl.h"
#include "content/renderer/media/webmediaplayer_delegate.h" #include "content/renderer/media/webmediaplayer_delegate.h"
#include "content/renderer/media/webmediaplayer_params.h" #include "content/renderer/media/webmediaplayer_params.h"
...@@ -52,6 +53,7 @@ ...@@ -52,6 +53,7 @@
#include "media/filters/opus_audio_decoder.h" #include "media/filters/opus_audio_decoder.h"
#include "media/filters/video_renderer_impl.h" #include "media/filters/video_renderer_impl.h"
#include "media/filters/vpx_video_decoder.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/WebMediaSource.h"
#include "third_party/WebKit/public/platform/WebRect.h" #include "third_party/WebKit/public/platform/WebRect.h"
#include "third_party/WebKit/public/platform/WebSize.h" #include "third_party/WebKit/public/platform/WebSize.h"
...@@ -165,7 +167,8 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( ...@@ -165,7 +167,8 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
pending_repaint_(false), pending_repaint_(false),
pending_size_change_(false), pending_size_change_(false),
video_frame_provider_client_(NULL), video_frame_provider_client_(NULL),
text_track_index_(0) { text_track_index_(0),
web_cdm_(NULL) {
media_log_->AddEvent( media_log_->AddEvent(
media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED));
...@@ -856,6 +859,13 @@ WebMediaPlayerImpl::CancelKeyRequestInternal( ...@@ -856,6 +859,13 @@ WebMediaPlayerImpl::CancelKeyRequestInternal(
return WebMediaPlayer::MediaKeyExceptionNoError; 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() { void WebMediaPlayerImpl::OnDestruct() {
Destroy(); Destroy();
} }
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
class RenderAudioSourceProvider; class RenderAudioSourceProvider;
namespace blink { namespace blink {
class WebContentDecryptionModule;
class WebFrame; class WebFrame;
} }
...@@ -67,6 +68,7 @@ class WebLayerImpl; ...@@ -67,6 +68,7 @@ class WebLayerImpl;
namespace content { namespace content {
class BufferedDataSource; class BufferedDataSource;
class WebAudioSourceProviderImpl; class WebAudioSourceProviderImpl;
class WebContentDecryptionModuleImpl;
class WebMediaPlayerDelegate; class WebMediaPlayerDelegate;
class WebMediaPlayerParams; class WebMediaPlayerParams;
class WebTextTrackImpl; class WebTextTrackImpl;
...@@ -175,6 +177,9 @@ class WebMediaPlayerImpl ...@@ -175,6 +177,9 @@ class WebMediaPlayerImpl
const blink::WebString& key_system, const blink::WebString& key_system,
const blink::WebString& session_id); const blink::WebString& session_id);
virtual void setContentDecryptionModule(
blink::WebContentDecryptionModule* cdm);
// content::RenderViewObserver implementation. // content::RenderViewObserver implementation.
virtual void OnDestruct() OVERRIDE; virtual void OnDestruct() OVERRIDE;
...@@ -370,6 +375,10 @@ class WebMediaPlayerImpl ...@@ -370,6 +375,10 @@ class WebMediaPlayerImpl
// Text track objects get a unique index value when they're created. // Text track objects get a unique index value when they're created.
int text_track_index_; int text_track_index_;
// Non-owned pointer to the CDM. Updated via calls to
// setContentDecryptionModule().
WebContentDecryptionModuleImpl* web_cdm_;
DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment