summaryrefslogtreecommitdiff
path: root/chromium/media/base/encryption_scheme.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-24 12:15:48 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-28 13:30:04 +0000
commitb014812705fc80bff0a5c120dfcef88f349816dc (patch)
tree25a2e2d9fa285f1add86aa333389a839f81a39ae /chromium/media/base/encryption_scheme.cc
parent9f4560b1027ae06fdb497023cdcaf91b8511fa74 (diff)
downloadqtwebengine-chromium-b014812705fc80bff0a5c120dfcef88f349816dc.tar.gz
BASELINE: Update Chromium to 68.0.3440.125
Change-Id: I23f19369e01f688e496f5bf179abb521ad73874f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/media/base/encryption_scheme.cc')
-rw-r--r--chromium/media/base/encryption_scheme.cc28
1 files changed, 27 insertions, 1 deletions
diff --git a/chromium/media/base/encryption_scheme.cc b/chromium/media/base/encryption_scheme.cc
index b98f9635b52..78349d2499e 100644
--- a/chromium/media/base/encryption_scheme.cc
+++ b/chromium/media/base/encryption_scheme.cc
@@ -4,6 +4,10 @@
#include "media/base/encryption_scheme.h"
+#include <ostream>
+
+#include "base/logging.h"
+
namespace media {
EncryptionScheme::EncryptionScheme() = default;
@@ -27,7 +31,29 @@ const EncryptionPattern& EncryptionScheme::pattern() const {
}
bool EncryptionScheme::Matches(const EncryptionScheme& other) const {
- return mode_ == other.mode_ && pattern_.Matches(other.pattern_);
+ return mode_ == other.mode_ && pattern_ == other.pattern_;
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const EncryptionScheme& encryption_scheme) {
+ if (!encryption_scheme.is_encrypted())
+ return os << "Unencrypted";
+
+ bool pattern_in_effect = encryption_scheme.pattern().IsInEffect();
+
+ if (encryption_scheme.mode() == EncryptionScheme::CIPHER_MODE_AES_CTR &&
+ !pattern_in_effect) {
+ return os << "CENC";
+ }
+
+ if (encryption_scheme.mode() == EncryptionScheme::CIPHER_MODE_AES_CBC &&
+ pattern_in_effect) {
+ return os << "CBCS";
+ }
+
+ NOTREACHED();
+ return os << "Unknown (mode = " << encryption_scheme.mode()
+ << ", pattern_in_effect = " << pattern_in_effect << ")";
}
} // namespace media