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

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

Issue 10899021: Add CDM video decoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error. 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/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;

Powered by Google App Engine
This is Rietveld 408576698