Index: webkit/media/crypto/ppapi/clear_key_cdm.cc |
diff --git a/webkit/media/crypto/ppapi/clear_key_cdm.cc b/webkit/media/crypto/ppapi/clear_key_cdm.cc |
index af526c962543540304045897c5e19f981f98fe2f..5c6595f01739408b8c42211cc69bff0b6ea3bbe2 100644 |
--- a/webkit/media/crypto/ppapi/clear_key_cdm.cc |
+++ b/webkit/media/crypto/ppapi/clear_key_cdm.cc |
@@ -10,6 +10,7 @@ |
#include "base/logging.h" |
#include "base/time.h" |
#include "media/base/decoder_buffer.h" |
+#include "webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h" |
static const char kClearKeyCdmVersion[] = "0.1.0.0"; |
@@ -237,27 +238,32 @@ cdm::Status ClearKeyCdm::Decrypt( |
cdm::Status ClearKeyCdm::InitializeVideoDecoder( |
const cdm::VideoDecoderConfig& video_decoder_config) { |
#if !defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) |
- NOTIMPLEMENTED(); |
- return cdm::kSessionError; |
+ if (!video_decoder_) |
+ video_decoder_.reset(new webkit_media::FFmpegCdmVideoDecoder(allocator_)); |
+ |
+ if (!video_decoder_->Initialize(video_decoder_config)) |
+ return cdm::kSessionError; |
#else |
video_size_ = video_decoder_config.coded_size; |
- return cdm::kSuccess; |
#endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER |
+ return cdm::kSuccess; |
} |
-void ClearKeyCdm::ResetDecoder(cdm::StreamType) { |
- NOTIMPLEMENTED(); |
+void ClearKeyCdm::ResetDecoder(cdm::StreamType decoder_type) { |
+ DCHECK(decoder_type == cdm::kStreamTypeVideo); |
+ video_decoder_->Reset(); |
} |
-void ClearKeyCdm::DeinitializeDecoder(cdm::StreamType) { |
- NOTIMPLEMENTED(); |
+void ClearKeyCdm::DeinitializeDecoder(cdm::StreamType decoder_type) { |
+ DCHECK(decoder_type == cdm::kStreamTypeVideo); |
+ video_decoder_->Deinitialize(); |
} |
cdm::Status ClearKeyCdm::DecryptAndDecodeFrame( |
const cdm::InputBuffer& encrypted_buffer, |
- cdm::VideoFrame* video_frame) { |
+ cdm::VideoFrame* decoded_frame) { |
if (!encrypted_buffer.data) { |
- video_frame->set_format(cdm::kEmptyVideoFrame); |
+ decoded_frame->set_format(cdm::kEmptyVideoFrame); |
return cdm::kSuccess; |
} |
@@ -277,8 +283,12 @@ cdm::Status ClearKeyCdm::DecryptAndDecodeFrame( |
return cdm::kNoKey; |
#if !defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) |
- NOTIMPLEMENTED(); |
- return cdm::kDecodeError; |
+ DCHECK(status == media::Decryptor::kSuccess); |
+ DCHECK(buffer); |
+ return video_decoder_->DecodeFrame(buffer.get()->GetData(), |
+ buffer->GetDataSize(), |
+ encrypted_buffer.timestamp, |
+ decoded_frame); |
#else |
GenerateFakeVideoFrame(decoder_buffer->GetTimestamp(), video_frame); |
return cdm::kSuccess; |