Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: webkit/media/crypto/ppapi/cdm_wrapper.cc

Issue 10899021: Add CDM video decoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Maybe sorta could work... Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..7917863eed28d8c2064911297dbb5d9f92e0549e 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,14 @@ cdm::VideoFormat PpDecryptedFrameFormatToCdmVideoFormat(
return cdm::kUnknownVideoFormat;
}
+cdm::StreamType PpDecryptorStreamTypeToCdmStreamType(
+ PP_DecryptorStreamType stream_type) {
+ if (stream_type == PP_DECRYPTORSTREAMTYPE_AUDIO)
ddorwin 2012/10/13 03:54:42 Use switch. Depending on settings, can ensure you
Tom Finegan 2012/10/13 23:47:26 Done.
+ return cdm::kStreamTypeAudio;
+
+ return cdm::kStreamTypeVideo;
+}
+
} // namespace
namespace webkit_media {
@@ -602,13 +610,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,
@@ -617,8 +623,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 +636,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,
« no previous file with comments | « no previous file | webkit/media/crypto/ppapi/clear_key_cdm.h » ('j') | webkit/media/crypto/ppapi/clear_key_cdm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698