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 cede2941da9cc02dd2271621f19b23ea5d098576..7225c846b8863bdd403ae563b8adf4509f806554 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 { |
@@ -128,6 +128,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 { |
@@ -483,6 +496,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()) |
@@ -618,13 +632,11 @@ void CdmWrapper::InitializeVideoDecoder( |
&CdmWrapper::DecoderInitialized, |
status == cdm::kSuccess, |
decoder_config.request_id)); |
- |
} |
void CdmWrapper::DeinitializeDecoder(PP_DecryptorStreamType decoder_type, |
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, |
@@ -633,8 +645,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)); |
@@ -814,6 +825,10 @@ void CdmWrapper::DeliverFrame( |
decrypted_frame_info.strides[PP_DECRYPTEDFRAMEPLANES_V] = |
video_frame->stride(cdm::VideoFrame::kVPlane); |
break; |
+ case cdm::kNeedMoreData: |
+ decrypted_frame_info.result = PP_DECRYPTRESULT_SUCCESS; |
xhwang
2012/10/18 16:30:25
I am surprised to see we don't have NeedMoreData i
Tom Finegan
2012/10/18 19:29:41
sgtm
|
+ decrypted_frame_info.format = PP_DECRYPTEDFRAMEFORMAT_EMPTY; |
+ break; |
case cdm::kNoKey: |
decrypted_frame_info.result = PP_DECRYPTRESULT_DECRYPT_NOKEY; |
break; |