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

Unified Diff: chromecast/media/cma/ipc_streamer/decrypt_config_marshaller.cc

Issue 659343003: Chromecast media pipeline: handle CENC "full sample encryption" case. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 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: chromecast/media/cma/ipc_streamer/decrypt_config_marshaller.cc
diff --git a/chromecast/media/cma/ipc_streamer/decrypt_config_marshaller.cc b/chromecast/media/cma/ipc_streamer/decrypt_config_marshaller.cc
index 9e3de954ccb16561be7416b2602ea3d982fc9d28..c36aab9699b0eadf52c78a86371743ab99396e5f 100644
--- a/chromecast/media/cma/ipc_streamer/decrypt_config_marshaller.cc
+++ b/chromecast/media/cma/ipc_streamer/decrypt_config_marshaller.cc
@@ -15,19 +15,26 @@ namespace {
const size_t kMaxKeyIdSize = 256;
const size_t kMaxIvSize = 256;
const size_t kMaxSubsampleCount = 1024;
-}
-// static
-void DecryptConfigMarshaller::Write(
+void WriteDecryptConfigHeader(
const ::media::DecryptConfig& config, MediaMessage* msg) {
CHECK_GT(config.key_id().size(), 0);
CHECK_GT(config.iv().size(), 0);
- CHECK_GT(config.subsamples().size(), 0);
CHECK(msg->WritePod(config.key_id().size()));
CHECK(msg->WriteBuffer(config.key_id().data(), config.key_id().size()));
CHECK(msg->WritePod(config.iv().size()));
CHECK(msg->WriteBuffer(config.iv().data(), config.iv().size()));
+}
+
+}
+
+// static
+void DecryptConfigMarshaller::Write(
+ const ::media::DecryptConfig& config, MediaMessage* msg) {
+ CHECK_GT(config.subsamples().size(), 0);
+ WriteDecryptConfigHeader(config, msg);
+
CHECK(msg->WritePod(config.subsamples().size()));
for (size_t k = 0; k < config.subsamples().size(); k++) {
CHECK(msg->WritePod(config.subsamples()[k].clear_bytes));
@@ -36,6 +43,18 @@ void DecryptConfigMarshaller::Write(
}
// static
+void DecryptConfigMarshaller::WriteFullSampleEncryption(
+ const ::media::DecryptConfig& config, int data_size, MediaMessage* msg) {
+ WriteDecryptConfigHeader(config, msg);
+ CHECK_EQ(config.subsamples().size(), 0);
+
+ // Write exactly one subsample with zero clear bytes, |data_size| cypher bytes
+ CHECK(msg->WritePod(1));
+ CHECK(msg->WritePod(0));
+ CHECK(msg->WritePod(data_size));
+}
+
+// static
scoped_ptr< ::media::DecryptConfig> DecryptConfigMarshaller::Read(
MediaMessage* msg) {
size_t key_id_size = 0;

Powered by Google App Engine
This is Rietveld 408576698