summaryrefslogtreecommitdiffstats
path: root/media/base
diff options
context:
space:
mode:
authorxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-03 22:39:29 +0000
committerxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-03 22:39:29 +0000
commitcf3b4f7d6b8b369ed973b160294f9ca29e58698c (patch)
tree7b89ec692b17de3760342022db2cddef29b084c3 /media/base
parenta3fff4cdedbfde076b28897a65926490db95ff82 (diff)
downloadchromium_src-cf3b4f7d6b8b369ed973b160294f9ca29e58698c.zip
chromium_src-cf3b4f7d6b8b369ed973b160294f9ca29e58698c.tar.gz
chromium_src-cf3b4f7d6b8b369ed973b160294f9ca29e58698c.tar.bz2
Implement "Key Presence" step in "Encrypted Block Encounted" algorithm in EME.
See related spec here: http://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html#algorithms-enrypted-block If the AesDecryptor cannot find the decryption for the encrypted buffer, it returns a kNoKey. In ProxyDecryptor, if the input cannot be decrypted due to kNoKey, the ProxyDecryptor will cache the encrypted buffers and callbacks and fire a needkey event. When some key is added (AddKey called) later, it will try to decrypt these buffers again. The callbacks will be fired on the same thread where Decrypt() was called originally. BUG=125401, 125753 TEST=media_unittest, media layout_tests Review URL: https://chromiumcodereview.appspot.com/10822026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149952 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r--media/base/decryptor.h11
-rw-r--r--media/base/mock_filters.h1
2 files changed, 10 insertions, 2 deletions
diff --git a/media/base/decryptor.h b/media/base/decryptor.h
index 442c3c6..29c4617 100644
--- a/media/base/decryptor.h
+++ b/media/base/decryptor.h
@@ -20,7 +20,7 @@ class DecoderBuffer;
// All public methods other than Decrypt() will be called on the renderer
// thread. Therefore, these calls should be fast and nonblocking, with key
// events fired asynchronously. Decrypt() will be called on the (video/audio)
-// decoder thread synchronously.
+// decoder thread.
class MEDIA_EXPORT Decryptor {
public:
enum KeyError {
@@ -34,7 +34,8 @@ class MEDIA_EXPORT Decryptor {
enum DecryptStatus {
kSuccess, // Decryption successfully completed. Decrypted buffer ready.
- kError // Error occurred during decryption.
+ kNoKey, // No key is available to decrypt.
+ kError // Key is available but an error occurred during decryption.
};
Decryptor() {}
@@ -68,6 +69,8 @@ class MEDIA_EXPORT Decryptor {
//
// If the returned status is kSuccess, the |encrypted| buffer is successfully
// decrypted and the decrypted buffer is ready to be read.
+ // If the returned status is kNoKey, no decryption key is available to decrypt
+ // |encrypted| buffer. In this case the decrypted buffer must be NULL.
// If the returned status is kError, unexpected error has occurred. In this
// case the decrypted buffer must be NULL.
typedef base::Callback<void(DecryptStatus,
@@ -75,6 +78,10 @@ class MEDIA_EXPORT Decryptor {
virtual void Decrypt(const scoped_refptr<DecoderBuffer>& encrypted,
const DecryptCB& decrypt_cb) = 0;
+ // Stops the decryptor and fires any pending DecryptCB immediately with kError
+ // and NULL buffer.
+ virtual void Stop() = 0;
+
private:
DISALLOW_COPY_AND_ASSIGN(Decryptor);
};
diff --git a/media/base/mock_filters.h b/media/base/mock_filters.h
index 3688a95..e6b153d 100644
--- a/media/base/mock_filters.h
+++ b/media/base/mock_filters.h
@@ -212,6 +212,7 @@ class MockDecryptor : public Decryptor {
const std::string& session_id));
MOCK_METHOD2(Decrypt, void(const scoped_refptr<DecoderBuffer>& encrypted,
const DecryptCB& decrypt_cb));
+ MOCK_METHOD0(Stop, void());
private:
DISALLOW_COPY_AND_ASSIGN(MockDecryptor);