Index: webkit/media/crypto/ppapi/cdm_wrapper.cc |
diff --git a/webkit/media/crypto/ppapi/cdm_wrapper.cc b/webkit/media/crypto/ppapi/cdm_wrapper.cc |
index b082c490b25a5da13be05be1de11c84aaf8530d0..a5b22731c060af7d514311a71d6268ef6bab106c 100644 |
--- a/webkit/media/crypto/ppapi/cdm_wrapper.cc |
+++ b/webkit/media/crypto/ppapi/cdm_wrapper.cc |
@@ -23,8 +23,8 @@ |
#include "ppapi/cpp/dev/buffer_dev.h" |
#include "ppapi/cpp/private/content_decryptor_private.h" |
#include "ppapi/utility/completion_callback_factory.h" |
-#include "webkit/media/crypto/ppapi/linked_ptr.h" |
#include "webkit/media/crypto/ppapi/content_decryption_module.h" |
+#include "webkit/media/crypto/ppapi/linked_ptr.h" |
namespace { |
@@ -126,6 +126,19 @@ cdm::VideoFormat PpDecryptedFrameFormatToCdmVideoFormat( |
return cdm::kUnknownVideoFormat; |
} |
+cdm::StreamType PpDecryptorStreamTypeToCdmStreamType( |
+ PP_DecryptorStreamType stream_type) { |
+ switch (stream_type) { |
+ case PP_DECRYPTORSTREAMTYPE_AUDIO: |
+ return cdm::kStreamTypeAudio; |
+ case PP_DECRYPTORSTREAMTYPE_VIDEO: |
+ return cdm::kStreamTypeVideo; |
+ } |
+ |
+ PP_NOTREACHED(); |
+ return cdm::kStreamTypeVideo; |
+} |
+ |
} // namespace |
namespace webkit_media { |
@@ -467,6 +480,7 @@ PpbBufferAllocator::~PpbBufferAllocator() { |
cdm::Buffer* PpbBufferAllocator::Allocate(int32_t size) { |
PP_DCHECK(size > 0); |
+ PP_DCHECK(IsMainThread()); |
pp::Buffer_Dev buffer(instance_, size); |
if (buffer.is_null()) |
@@ -602,13 +616,11 @@ void CdmWrapper::InitializeVideoDecoder( |
&CdmWrapper::DecoderInitialized, |
status == cdm::kSuccess, |
decoder_config.request_id)); |
- |
} |
void CdmWrapper::DeinitializeDecoder(PP_DecryptorStreamType decoder_type, |
xhwang
2012/10/16 21:59:53
s/decoder_type/stream_type ?
Tom Finegan
2012/10/17 02:39:10
I prefer decoder_type here. I think it fits better
xhwang
2012/10/17 18:43:00
SG :)
|
uint32_t request_id) { |
- // TODO(tomfinegan): Implement DeinitializeDecoder in clear key CDM, and call |
- // it here. |
+ cdm_->DeinitializeDecoder(PpDecryptorStreamTypeToCdmStreamType(decoder_type)); |
CallOnMain(callback_factory_.NewCallback( |
&CdmWrapper::DecoderDeinitializeDone, |
decoder_type, |
@@ -617,8 +629,7 @@ void CdmWrapper::DeinitializeDecoder(PP_DecryptorStreamType decoder_type, |
void CdmWrapper::ResetDecoder(PP_DecryptorStreamType decoder_type, |
uint32_t request_id) { |
- // TODO(tomfinegan): Implement ResetDecoder in clear key CDM, and call it |
- // here. |
+ cdm_->ResetDecoder(PpDecryptorStreamTypeToCdmStreamType(decoder_type)); |
CallOnMain(callback_factory_.NewCallback(&CdmWrapper::DecoderResetDone, |
decoder_type, |
request_id)); |
@@ -631,15 +642,16 @@ void CdmWrapper::DecryptAndDecode( |
// TODO(tomfinegan): Remove this check when audio decoding is added. |
PP_DCHECK(decoder_type == PP_DECRYPTORSTREAMTYPE_VIDEO); |
- PP_DCHECK(!encrypted_buffer.is_null()); |
PP_DCHECK(cdm_); |
cdm::InputBuffer input_buffer; |
std::vector<cdm::SubsampleEntry> subsamples; |
- ConfigureInputBuffer(encrypted_buffer, |
- encrypted_block_info, |
- &subsamples, |
- &input_buffer); |
+ if (!encrypted_buffer.is_null()) { |
+ ConfigureInputBuffer(encrypted_buffer, |
+ encrypted_block_info, |
+ &subsamples, |
+ &input_buffer); |
+ } |
LinkedVideoFrame video_frame(new VideoFrameImpl()); |
cdm::Status status = cdm_->DecryptAndDecodeFrame(input_buffer, |