summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorxhwang@google.com <xhwang@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-12 04:46:11 +0000
committerxhwang@google.com <xhwang@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-12 04:46:11 +0000
commitb68e144d5b89be56d8581dd7bb5d6fb8a83ddb8e (patch)
treea32bb395d2950bfca8cfd6e7799e1a1f77421b16 /webkit
parent4b3e1928facf6e98d4a386601c6a568bcab69372 (diff)
downloadchromium_src-b68e144d5b89be56d8581dd7bb5d6fb8a83ddb8e.zip
chromium_src-b68e144d5b89be56d8581dd7bb5d6fb8a83ddb8e.tar.gz
chromium_src-b68e144d5b89be56d8581dd7bb5d6fb8a83ddb8e.tar.bz2
Update Cdm Wrapper and ClearKeyCdm to work with CDM interface version 4.
Also roll CDM DEPS to r181763. TEST=Test page plays; content_browsertests pass. Review URL: https://codereview.chromium.org/12212079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181850 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/media/crypto/ppapi/cdm_video_decoder.cc9
-rw-r--r--webkit/media/crypto/ppapi/cdm_video_decoder.h3
-rw-r--r--webkit/media/crypto/ppapi/cdm_wrapper.cc58
-rw-r--r--webkit/media/crypto/ppapi/clear_key_cdm.cc41
-rw-r--r--webkit/media/crypto/ppapi/clear_key_cdm.h4
-rw-r--r--webkit/media/crypto/ppapi/fake_cdm_video_decoder.cc6
-rw-r--r--webkit/media/crypto/ppapi/fake_cdm_video_decoder.h2
-rw-r--r--webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc8
-rw-r--r--webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h4
-rw-r--r--webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.cc8
-rw-r--r--webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h4
-rw-r--r--webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.cc12
-rw-r--r--webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.h4
13 files changed, 102 insertions, 61 deletions
diff --git a/webkit/media/crypto/ppapi/cdm_video_decoder.cc b/webkit/media/crypto/ppapi/cdm_video_decoder.cc
index af9fb8d..935921f 100644
--- a/webkit/media/crypto/ppapi/cdm_video_decoder.cc
+++ b/webkit/media/crypto/ppapi/cdm_video_decoder.cc
@@ -22,11 +22,10 @@
namespace webkit_media {
scoped_ptr<CdmVideoDecoder> CreateVideoDecoder(
- cdm::Allocator* allocator,
- const cdm::VideoDecoderConfig& config) {
+ cdm::Host* host, const cdm::VideoDecoderConfig& config) {
scoped_ptr<CdmVideoDecoder> video_decoder;
#if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER)
- video_decoder.reset(new FakeCdmVideoDecoder(allocator));
+ video_decoder.reset(new FakeCdmVideoDecoder(host));
if (!video_decoder->Initialize(config))
video_decoder.reset();
@@ -34,7 +33,7 @@ scoped_ptr<CdmVideoDecoder> CreateVideoDecoder(
#if defined(CLEAR_KEY_CDM_USE_LIBVPX_DECODER)
if (config.codec == cdm::VideoDecoderConfig::kCodecVp8) {
- video_decoder.reset(new LibvpxCdmVideoDecoder(allocator));
+ video_decoder.reset(new LibvpxCdmVideoDecoder(host));
if (!video_decoder->Initialize(config))
video_decoder.reset();
@@ -44,7 +43,7 @@ scoped_ptr<CdmVideoDecoder> CreateVideoDecoder(
#endif
#if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER)
- video_decoder.reset(new FFmpegCdmVideoDecoder(allocator));
+ video_decoder.reset(new FFmpegCdmVideoDecoder(host));
if (!video_decoder->Initialize(config))
video_decoder.reset();
diff --git a/webkit/media/crypto/ppapi/cdm_video_decoder.h b/webkit/media/crypto/ppapi/cdm_video_decoder.h
index e46f8c3..7b29eff 100644
--- a/webkit/media/crypto/ppapi/cdm_video_decoder.h
+++ b/webkit/media/crypto/ppapi/cdm_video_decoder.h
@@ -36,8 +36,7 @@ class CdmVideoDecoder {
// |config.codec|. Returns a scoped_ptr containing a non-null initialized
// CdmVideoDecoder* upon success.
scoped_ptr<CdmVideoDecoder> CreateVideoDecoder(
- cdm::Allocator* allocator,
- const cdm::VideoDecoderConfig& config);
+ cdm::Host* host, const cdm::VideoDecoderConfig& config);
} // namespace webkit_media
diff --git a/webkit/media/crypto/ppapi/cdm_wrapper.cc b/webkit/media/crypto/ppapi/cdm_wrapper.cc
index 9c7fa56..7dfcee1 100644
--- a/webkit/media/crypto/ppapi/cdm_wrapper.cc
+++ b/webkit/media/crypto/ppapi/cdm_wrapper.cc
@@ -255,15 +255,14 @@ class PpbBuffer : public cdm::Buffer {
DISALLOW_COPY_AND_ASSIGN(PpbBuffer);
};
-class PpbBufferAllocator : public cdm::Allocator {
+class PpbBufferAllocator {
public:
explicit PpbBufferAllocator(pp::Instance* instance)
: instance_(instance),
next_buffer_id_(1) {}
- virtual ~PpbBufferAllocator() {}
+ ~PpbBufferAllocator() {}
- // cdm::Allocator implementation.
- virtual cdm::Buffer* Allocate(int32_t capacity) OVERRIDE;
+ cdm::Buffer* Allocate(int32_t capacity);
// Releases the buffer with |buffer_id|. A buffer can be recycled after
// it is released.
@@ -474,6 +473,9 @@ class AudioFramesImpl : public cdm::AudioFrames {
DISALLOW_COPY_AND_ASSIGN(AudioFramesImpl);
};
+// GetCdmHostFunc implementation.
+void* GetCdmHost(int host_interface_version, void* user_data);
+
// A wrapper class for abstracting away PPAPI interaction and threading for a
// Content Decryption Module (CDM).
class CdmWrapper : public pp::Instance,
@@ -517,6 +519,7 @@ class CdmWrapper : public pp::Instance,
const PP_EncryptedBlockInfo& encrypted_block_info) OVERRIDE;
// cdm::Host implementation.
+ virtual cdm::Buffer* Allocate(int32_t capacity) OVERRIDE;
virtual void SetTimer(int64_t delay_ms, void* context) OVERRIDE;
virtual double GetCurrentWallTimeInSeconds() OVERRIDE;
virtual void SendKeyMessage(
@@ -527,6 +530,8 @@ class CdmWrapper : public pp::Instance,
int32_t session_id_length,
cdm::MediaKeyError error_code,
uint32_t system_code) OVERRIDE;
+ virtual void GetPrivateData(int32_t* instance,
+ GetPrivateInterface* get_interface) OVERRIDE;
private:
struct SessionInfo {
@@ -542,6 +547,8 @@ class CdmWrapper : public pp::Instance,
typedef linked_ptr<VideoFrameImpl> LinkedVideoFrame;
typedef linked_ptr<AudioFramesImpl> LinkedAudioFrames;
+ bool CreateCdmInstance(const std::string& key_system);
+
void SendUnknownKeyError(const std::string& key_system,
const std::string& session_id);
@@ -611,7 +618,17 @@ CdmWrapper::CdmWrapper(PP_Instance instance, pp::Module* module)
CdmWrapper::~CdmWrapper() {
if (cdm_)
- DestroyCdmInstance(cdm_);
+ cdm_->Destroy();
+}
+
+bool CdmWrapper::CreateCdmInstance(const std::string& key_system) {
+ PP_DCHECK(!cdm_);
+ cdm_ = static_cast<cdm::ContentDecryptionModule*>(
+ ::CreateCdmInstance(cdm::kCdmInterfaceVersion,
+ key_system.data(), key_system.size(),
+ GetCdmHost, this));
+
+ return (cdm_ != NULL);
}
void CdmWrapper::GenerateKeyRequest(const std::string& key_system,
@@ -621,18 +638,17 @@ void CdmWrapper::GenerateKeyRequest(const std::string& key_system,
PP_DCHECK(key_system_.empty() || key_system_ == key_system);
if (!cdm_) {
- cdm_ = CreateCdmInstance(key_system.data(), key_system.size(),
- &allocator_, this);
- PP_DCHECK(cdm_);
- if (!cdm_) {
+ if (!CreateCdmInstance(key_system)) {
SendUnknownKeyError(key_system, "");
return;
}
}
+ PP_DCHECK(cdm_);
// Must be set here in case the CDM synchronously calls a cdm::Host method.
// Clear below on error.
- // TODO(ddorwin): Remove this when key_system is added to cdm::Host methods.
+ // TODO(ddorwin): Set/clear key_system_ & cdm_ at same time; clear both on
+ // error below.
key_system_ = key_system;
cdm::Status status = cdm_->GenerateKeyRequest(
type.data(), type.size(),
@@ -860,6 +876,10 @@ void CdmWrapper::DecryptAndDecode(
}
}
+cdm::Buffer* CdmWrapper::Allocate(int32_t capacity) {
+ return allocator_.Allocate(capacity);
+}
+
void CdmWrapper::SetTimer(int64_t delay_ms, void* context) {
// NOTE: doesn't really need to run on the main thread; could just as well run
// on a helper thread if |cdm_| were thread-friendly and care was taken. We
@@ -902,12 +922,17 @@ void CdmWrapper::SendKeyError(const char* session_id,
system_code);
}
+void CdmWrapper::GetPrivateData(int32_t* instance,
+ cdm::Host::GetPrivateInterface* get_interface) {
+ *instance = pp_instance();
+ *get_interface = pp::Module::Get()->get_browser_interface();
+}
+
void CdmWrapper::SendUnknownKeyError(const std::string& key_system,
const std::string& session_id) {
SendKeyErrorInternal(key_system, session_id, cdm::kUnknownError, 0);
}
-
void CdmWrapper::SendKeyAdded(const std::string& key_system,
const std::string& session_id) {
PostOnMain(callback_factory_.NewCallback(
@@ -1117,6 +1142,17 @@ bool CdmWrapper::IsValidVideoFrame(const LinkedVideoFrame& video_frame) {
return true;
}
+void* GetCdmHost(int host_interface_version, void* user_data) {
+ if (!host_interface_version || !user_data)
+ return NULL;
+
+ if (host_interface_version != cdm::kHostInterfaceVersion)
+ return NULL;
+
+ CdmWrapper* cdm_wrapper = static_cast<CdmWrapper*>(user_data);
+ return static_cast<cdm::Host*>(cdm_wrapper);
+}
+
// This object is the global object representing this plugin library as long
// as it is loaded.
class CdmWrapperModule : public pp::Module {
diff --git a/webkit/media/crypto/ppapi/clear_key_cdm.cc b/webkit/media/crypto/ppapi/clear_key_cdm.cc
index 5192041..1665588e 100644
--- a/webkit/media/crypto/ppapi/clear_key_cdm.cc
+++ b/webkit/media/crypto/ppapi/clear_key_cdm.cc
@@ -125,18 +125,22 @@ void INITIALIZE_CDM_MODULE() {
void DeinitializeCdmModule() {
}
-cdm::ContentDecryptionModule* CreateCdmInstance(const char* key_system_arg,
- int key_system_size,
- cdm::Allocator* allocator,
- cdm::Host* host) {
+void* CreateCdmInstance(
+ int cdm_interface_version,
+ const char* key_system, int key_system_size,
+ GetCdmHostFunc get_cdm_host_func, void* user_data) {
DVLOG(1) << "CreateCdmInstance()";
- DCHECK_EQ(std::string(key_system_arg, key_system_size), kExternalClearKey);
- return new webkit_media::ClearKeyCdm(allocator, host);
-}
-void DestroyCdmInstance(cdm::ContentDecryptionModule* instance) {
- DVLOG(1) << "DestroyCdmInstance()";
- delete instance;
+ if (cdm_interface_version != cdm::kCdmInterfaceVersion)
+ return NULL;
+
+ cdm::Host* host = static_cast<cdm::Host*>(
+ get_cdm_host_func(cdm::kHostInterfaceVersion, user_data));
+ if (!host)
+ return NULL;
+
+ return static_cast<cdm::ContentDecryptionModule*>(
+ new webkit_media::ClearKeyCdm(host));
}
const char* GetCdmVersion() {
@@ -191,16 +195,14 @@ void ClearKeyCdm::Client::NeedKey(const std::string& key_system,
NOTREACHED();
}
-ClearKeyCdm::ClearKeyCdm(cdm::Allocator* allocator, cdm::Host* host)
+ClearKeyCdm::ClearKeyCdm(cdm::Host* host)
: decryptor_(base::Bind(&Client::KeyAdded, base::Unretained(&client_)),
base::Bind(&Client::KeyError, base::Unretained(&client_)),
base::Bind(&Client::KeyMessage, base::Unretained(&client_)),
base::Bind(&Client::NeedKey, base::Unretained(&client_))),
- allocator_(allocator),
host_(host),
timer_delay_ms_(kInitialTimerDelayMs),
timer_set_(false) {
- DCHECK(allocator_);
#if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER)
channel_count_ = 0;
bits_per_channel_ = 0;
@@ -314,7 +316,7 @@ cdm::Status ClearKeyCdm::Decrypt(
DCHECK(buffer->GetData());
decrypted_block->SetDecryptedBuffer(
- allocator_->Allocate(buffer->GetDataSize()));
+ host_->Allocate(buffer->GetDataSize()));
memcpy(reinterpret_cast<void*>(decrypted_block->DecryptedBuffer()->Data()),
buffer->GetData(),
buffer->GetDataSize());
@@ -328,7 +330,7 @@ cdm::Status ClearKeyCdm::InitializeAudioDecoder(
const cdm::AudioDecoderConfig& audio_decoder_config) {
#if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER)
if (!audio_decoder_)
- audio_decoder_.reset(new webkit_media::FFmpegCdmAudioDecoder(allocator_));
+ audio_decoder_.reset(new webkit_media::FFmpegCdmAudioDecoder(host_));
if (!audio_decoder_->Initialize(audio_decoder_config))
return cdm::kSessionError;
@@ -353,7 +355,7 @@ cdm::Status ClearKeyCdm::InitializeVideoDecoder(
}
// Any uninitialized decoder will be replaced.
- video_decoder_ = CreateVideoDecoder(allocator_, video_decoder_config);
+ video_decoder_ = CreateVideoDecoder(host_, video_decoder_config);
if (!video_decoder_)
return cdm::kSessionError;
@@ -458,6 +460,11 @@ cdm::Status ClearKeyCdm::DecryptAndDecodeSamples(
#endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER
}
+void ClearKeyCdm::Destroy() {
+ DVLOG(1) << "Destroy()";
+ delete this;
+}
+
void ClearKeyCdm::ScheduleNextHeartBeat() {
// Prepare the next heartbeat message and set timer.
std::ostringstream msg_stream;
@@ -526,7 +533,7 @@ int ClearKeyCdm::GenerateFakeAudioFramesFromDuration(
int64 timestamp = CurrentTimeStampInMicroseconds();
const int kHeaderSize = sizeof(timestamp) + sizeof(frame_size);
- audio_frames->SetFrameBuffer(allocator_->Allocate(kHeaderSize + frame_size));
+ audio_frames->SetFrameBuffer(host_->Allocate(kHeaderSize + frame_size));
uint8_t* data = audio_frames->FrameBuffer()->Data();
memcpy(data, &timestamp, sizeof(timestamp));
diff --git a/webkit/media/crypto/ppapi/clear_key_cdm.h b/webkit/media/crypto/ppapi/clear_key_cdm.h
index af27300..7865b06 100644
--- a/webkit/media/crypto/ppapi/clear_key_cdm.h
+++ b/webkit/media/crypto/ppapi/clear_key_cdm.h
@@ -33,7 +33,7 @@ class FFmpegCdmAudioDecoder;
// Clear key implementation of the cdm::ContentDecryptionModule interface.
class ClearKeyCdm : public cdm::ContentDecryptionModule {
public:
- ClearKeyCdm(cdm::Allocator* allocator, cdm::Host* host);
+ explicit ClearKeyCdm(cdm::Host* host);
virtual ~ClearKeyCdm();
// ContentDecryptionModule implementation.
@@ -60,6 +60,7 @@ class ClearKeyCdm : public cdm::ContentDecryptionModule {
virtual cdm::Status DecryptAndDecodeSamples(
const cdm::InputBuffer& encrypted_buffer,
cdm::AudioFrames* audio_frames) OVERRIDE;
+ virtual void Destroy() OVERRIDE;
private:
// TODO(xhwang): After we removed DecryptorClient. We probably can also remove
@@ -141,7 +142,6 @@ class ClearKeyCdm : public cdm::ContentDecryptionModule {
// simultaneously.
base::Lock client_lock_;
- cdm::Allocator* const allocator_;
cdm::Host* host_;
std::string heartbeat_session_id_;
diff --git a/webkit/media/crypto/ppapi/fake_cdm_video_decoder.cc b/webkit/media/crypto/ppapi/fake_cdm_video_decoder.cc
index 665f9c7..62d3383 100644
--- a/webkit/media/crypto/ppapi/fake_cdm_video_decoder.cc
+++ b/webkit/media/crypto/ppapi/fake_cdm_video_decoder.cc
@@ -9,9 +9,9 @@
namespace webkit_media {
-FakeCdmVideoDecoder::FakeCdmVideoDecoder(cdm::Allocator* allocator)
+FakeCdmVideoDecoder::FakeCdmVideoDecoder(cdm::Host* host)
: is_initialized_(false),
- allocator_(allocator) {
+ host_(host) {
}
FakeCdmVideoDecoder::~FakeCdmVideoDecoder() {
@@ -67,7 +67,7 @@ cdm::Status FakeCdmVideoDecoder::DecodeFrame(const uint8_t* compressed_frame,
int u_offset = v_offset + uv_stride * uv_rows + kPlanePadding;
int frame_size = u_offset + uv_stride * uv_rows + kPlanePadding;
- decoded_frame->SetFrameBuffer(allocator_->Allocate(frame_size));
+ decoded_frame->SetFrameBuffer(host_->Allocate(frame_size));
decoded_frame->FrameBuffer()->SetSize(frame_size);
decoded_frame->SetFormat(cdm::kYv12);
diff --git a/webkit/media/crypto/ppapi/fake_cdm_video_decoder.h b/webkit/media/crypto/ppapi/fake_cdm_video_decoder.h
index b2e77b4..d3cb066 100644
--- a/webkit/media/crypto/ppapi/fake_cdm_video_decoder.h
+++ b/webkit/media/crypto/ppapi/fake_cdm_video_decoder.h
@@ -31,7 +31,7 @@ class FakeCdmVideoDecoder : public CdmVideoDecoder {
bool is_initialized_;
cdm::Size video_size_;
- cdm::Allocator* const allocator_;
+ cdm::Host* const host_;
DISALLOW_COPY_AND_ASSIGN(FakeCdmVideoDecoder);
};
diff --git a/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc b/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc
index e49fa2b..8edbb01 100644
--- a/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc
+++ b/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc
@@ -80,9 +80,9 @@ static void CdmAudioDecoderConfigToAVCodecContext(
}
}
-FFmpegCdmAudioDecoder::FFmpegCdmAudioDecoder(cdm::Allocator* allocator)
+FFmpegCdmAudioDecoder::FFmpegCdmAudioDecoder(cdm::Host* host)
: is_initialized_(false),
- allocator_(allocator),
+ host_(host),
codec_context_(NULL),
av_frame_(NULL),
bits_per_channel_(0),
@@ -351,9 +351,9 @@ cdm::Status FFmpegCdmAudioDecoder::DecodeBuffer(
if (!serialized_audio_frames_.empty()) {
decoded_frames->SetFrameBuffer(
- allocator_->Allocate(serialized_audio_frames_.size()));
+ host_->Allocate(serialized_audio_frames_.size()));
if (!decoded_frames->FrameBuffer()) {
- LOG(ERROR) << "DecodeBuffer() cdm::Allocator::Allocate failed.";
+ LOG(ERROR) << "DecodeBuffer() cdm::Host::Allocate failed.";
return cdm::kDecodeError;
}
memcpy(decoded_frames->FrameBuffer()->Data(),
diff --git a/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h b/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h
index d10ce4c..266b4ad 100644
--- a/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h
+++ b/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h
@@ -29,7 +29,7 @@ namespace webkit_media {
// solution for this. See http://crbug.com/169203
class FFmpegCdmAudioDecoder {
public:
- explicit FFmpegCdmAudioDecoder(cdm::Allocator* allocator);
+ explicit FFmpegCdmAudioDecoder(cdm::Host* host);
~FFmpegCdmAudioDecoder();
bool Initialize(const cdm::AudioDecoderConfig& config);
void Deinitialize();
@@ -60,7 +60,7 @@ class FFmpegCdmAudioDecoder {
bool is_initialized_;
- cdm::Allocator* const allocator_;
+ cdm::Host* const host_;
// FFmpeg structures owned by this object.
AVCodecContext* codec_context_;
diff --git a/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.cc b/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.cc
index aabdf8e..70496a3 100644
--- a/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.cc
+++ b/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.cc
@@ -128,11 +128,11 @@ static void CopyPlane(const uint8_t* source,
}
}
-FFmpegCdmVideoDecoder::FFmpegCdmVideoDecoder(cdm::Allocator* allocator)
+FFmpegCdmVideoDecoder::FFmpegCdmVideoDecoder(cdm::Host* host)
: codec_context_(NULL),
av_frame_(NULL),
is_initialized_(false),
- allocator_(allocator) {
+ host_(host) {
}
FFmpegCdmVideoDecoder::~FFmpegCdmVideoDecoder() {
@@ -275,9 +275,9 @@ bool FFmpegCdmVideoDecoder::CopyAvFrameTo(cdm::VideoFrame* cdm_video_frame) {
const int space_required = y_size + (uv_size * 2);
DCHECK(!cdm_video_frame->FrameBuffer());
- cdm_video_frame->SetFrameBuffer(allocator_->Allocate(space_required));
+ cdm_video_frame->SetFrameBuffer(host_->Allocate(space_required));
if (!cdm_video_frame->FrameBuffer()) {
- LOG(ERROR) << "CopyAvFrameTo() cdm::Allocator::Allocate failed.";
+ LOG(ERROR) << "CopyAvFrameTo() cdm::Host::Allocate failed.";
return false;
}
cdm_video_frame->FrameBuffer()->SetSize(space_required);
diff --git a/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h b/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h
index 6155eed..a551954 100644
--- a/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h
+++ b/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h
@@ -17,7 +17,7 @@ namespace webkit_media {
class FFmpegCdmVideoDecoder : public CdmVideoDecoder {
public:
- explicit FFmpegCdmVideoDecoder(cdm::Allocator* allocator);
+ explicit FFmpegCdmVideoDecoder(cdm::Host* host);
virtual ~FFmpegCdmVideoDecoder();
// CdmVideoDecoder implementation.
@@ -48,7 +48,7 @@ class FFmpegCdmVideoDecoder : public CdmVideoDecoder {
bool is_initialized_;
- cdm::Allocator* const allocator_;
+ cdm::Host* const host_;
DISALLOW_COPY_AND_ASSIGN(FFmpegCdmVideoDecoder);
};
diff --git a/webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.cc b/webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.cc
index f06b729..ef12c22 100644
--- a/webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.cc
+++ b/webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.cc
@@ -50,9 +50,9 @@ static void CopyPlane(const uint8_t* source,
}
#endif // USE_COPYPLANE_WITH_LIBVPX
-LibvpxCdmVideoDecoder::LibvpxCdmVideoDecoder(cdm::Allocator* allocator)
+LibvpxCdmVideoDecoder::LibvpxCdmVideoDecoder(cdm::Host* host)
: is_initialized_(false),
- allocator_(allocator),
+ host_(host),
vpx_codec_(NULL),
vpx_image_(NULL) {
}
@@ -175,9 +175,9 @@ bool LibvpxCdmVideoDecoder::CopyVpxImageTo(cdm::VideoFrame* cdm_video_frame) {
const int space_required = y_size + (uv_size * 2);
DCHECK(!cdm_video_frame->FrameBuffer());
- cdm_video_frame->SetFrameBuffer(allocator_->Allocate(space_required));
+ cdm_video_frame->SetFrameBuffer(host_->Allocate(space_required));
if (!cdm_video_frame->FrameBuffer()) {
- LOG(ERROR) << "CopyVpxImageTo() cdm::Allocator::Allocate failed.";
+ LOG(ERROR) << "CopyVpxImageTo() cdm::Host::Allocate failed.";
return false;
}
cdm_video_frame->FrameBuffer()->SetSize(space_required);
@@ -228,9 +228,9 @@ bool LibvpxCdmVideoDecoder::CopyVpxImageTo(cdm::VideoFrame* cdm_video_frame) {
const int space_required = y_size + u_size + v_size;
DCHECK(!cdm_video_frame->FrameBuffer());
- cdm_video_frame->SetFrameBuffer(allocator_->Allocate(space_required));
+ cdm_video_frame->SetFrameBuffer(host_->Allocate(space_required));
if (!cdm_video_frame->FrameBuffer()) {
- LOG(ERROR) << "CopyVpxImageTo() cdm::Allocator::Allocate failed.";
+ LOG(ERROR) << "CopyVpxImageTo() cdm::Host::Allocate failed.";
return false;
}
cdm_video_frame->FrameBuffer()->SetSize(space_required);
diff --git a/webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.h b/webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.h
index 7a666d5..f9d8470 100644
--- a/webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.h
+++ b/webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.h
@@ -17,7 +17,7 @@ namespace webkit_media {
class LibvpxCdmVideoDecoder : public CdmVideoDecoder {
public:
- explicit LibvpxCdmVideoDecoder(cdm::Allocator* allocator);
+ explicit LibvpxCdmVideoDecoder(cdm::Host* host);
virtual ~LibvpxCdmVideoDecoder();
// CdmVideoDecoder implementation.
@@ -42,7 +42,7 @@ class LibvpxCdmVideoDecoder : public CdmVideoDecoder {
bool is_initialized_;
- cdm::Allocator* const allocator_;
+ cdm::Host* const host_;
vpx_codec_ctx* vpx_codec_;
vpx_image* vpx_image_;