| 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;
|
|
|