Index: media/base/audio_decoder_config.h |
diff --git a/media/base/audio_decoder_config.h b/media/base/audio_decoder_config.h |
index 266de82d605277543a3fec40b2c5a8faec165266..4e5298bed8e92daeeee13ad5484db6b638f9a356 100644 |
--- a/media/base/audio_decoder_config.h |
+++ b/media/base/audio_decoder_config.h |
@@ -10,12 +10,14 @@ |
#include <string> |
#include <vector> |
+#include "base/logging.h" |
#include "base/macros.h" |
#include "base/time/time.h" |
#include "media/base/audio_codecs.h" |
#include "media/base/channel_layout.h" |
#include "media/base/encryption_scheme.h" |
#include "media/base/media_export.h" |
+#include "media/base/media_util.h" |
#include "media/base/sample_format.h" |
namespace media { |
@@ -87,6 +89,25 @@ class MEDIA_EXPORT AudioDecoderConfig { |
return encryption_scheme_; |
} |
+ // Sets the config to be encrypted or not encrypted manually. This can be |
DaleCurtis
2017/02/24 18:03:50
Can't use hacker_style() for such a big method; mo
xhwang
2017/02/24 18:18:15
Done.
|
+ // useful for decryptors that decrypts an encrypted stream to a clear stream, |
+ // or for decoder selectors that wants to select decrypting decoders instead |
+ // of clear decoders. |
+ void set_is_encrypted(bool is_encrypted) { |
+ if (!is_encrypted) { |
+ DCHECK(encryption_scheme_.is_encrypted()) << "Config is already clear."; |
+ encryption_scheme_ = Unencrypted(); |
+ } else { |
+ DCHECK(!encryption_scheme_.is_encrypted()) |
+ << "Config is already encrypted."; |
+ // TODO(xhwang): This is only used to guide decoder selection, so set |
+ // a common encryption scheme that should be supported by all decrypting |
+ // decoders. We should be able to remove this when we support switching |
+ // decoders at run time. See http://crbug.com/695595 |
+ encryption_scheme_ = AesCtrEncryptionScheme(); |
+ } |
+ } |
+ |
private: |
AudioCodec codec_; |
SampleFormat sample_format_; |