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(
return session;
}
media::Decryptor* WebContentDecryptionModuleImpl::GetDecryptor() {
return media_keys_->GetDecryptor();
}
void WebContentDecryptionModuleImpl::OnSessionClosed(uint32 session_id) {
adapter_->RemoveSession(session_id);
}
......
......@@ -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_
......@@ -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();
}
......
......@@ -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);
};
......
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