OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromecast/media/cma/ipc_streamer/decoder_buffer_base_marshaller.h" | 5 #include "chromecast/media/cma/ipc_streamer/decoder_buffer_base_marshaller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chromecast/media/cma/base/decoder_buffer_base.h" | 8 #include "chromecast/media/cma/base/decoder_buffer_base.h" |
9 #include "chromecast/media/cma/ipc/media_message.h" | 9 #include "chromecast/media/cma/ipc/media_message.h" |
10 #include "chromecast/media/cma/ipc/media_message_type.h" | 10 #include "chromecast/media/cma/ipc/media_message_type.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 CHECK(msg->WritePod(buffer->end_of_stream())); | 134 CHECK(msg->WritePod(buffer->end_of_stream())); |
135 if (buffer->end_of_stream()) | 135 if (buffer->end_of_stream()) |
136 return; | 136 return; |
137 | 137 |
138 CHECK(msg->WritePod(buffer->timestamp().ToInternalValue())); | 138 CHECK(msg->WritePod(buffer->timestamp().ToInternalValue())); |
139 | 139 |
140 bool has_decrypt_config = | 140 bool has_decrypt_config = |
141 (buffer->decrypt_config() != NULL && | 141 (buffer->decrypt_config() != NULL && |
142 buffer->decrypt_config()->iv().size() > 0); | 142 buffer->decrypt_config()->iv().size() > 0); |
143 CHECK(msg->WritePod(has_decrypt_config)); | 143 CHECK(msg->WritePod(has_decrypt_config)); |
144 if (has_decrypt_config) | 144 |
145 DecryptConfigMarshaller::Write(*buffer->decrypt_config(), msg); | 145 if (has_decrypt_config) { |
146 // This handles the "Full Sample Encryption" case in | |
147 // ISO/IEC 23001-7:2012 9.5 by declaring one "subsample" with | |
damienv1
2014/10/17 16:20:22
nit: Not sure you should refer to the spec here. D
gunsch
2014/10/17 16:22:52
Done.
| |
148 // |buffer->data_size| encrypted bytes. | |
149 if (buffer->decrypt_config()->subsamples().empty()) { | |
150 std::vector< ::media::SubsampleEntry> encrypted_subsample_list(1); | |
151 encrypted_subsample_list[0].clear_bytes = 0; | |
152 encrypted_subsample_list[0].cypher_bytes = buffer->data_size(); | |
153 ::media::DecryptConfig full_sample_config( | |
154 buffer->decrypt_config()->key_id(), | |
155 buffer->decrypt_config()->iv(), | |
156 encrypted_subsample_list); | |
157 DecryptConfigMarshaller::Write(full_sample_config, msg); | |
158 } | |
159 else | |
damienv1
2014/10/17 16:20:22
nit: I think you also need curly braces for the "e
gunsch
2014/10/17 16:22:52
Done.
lcwu1
2014/10/17 16:26:26
Also else should be in the same line as the previo
| |
160 DecryptConfigMarshaller::Write(*buffer->decrypt_config(), msg); | |
161 } | |
146 | 162 |
147 CHECK(msg->WritePod(buffer->data_size())); | 163 CHECK(msg->WritePod(buffer->data_size())); |
148 CHECK(msg->WriteBuffer(buffer->data(), buffer->data_size())); | 164 CHECK(msg->WriteBuffer(buffer->data(), buffer->data_size())); |
149 } | 165 } |
150 | 166 |
151 // static | 167 // static |
152 scoped_refptr<DecoderBufferBase> DecoderBufferBaseMarshaller::Read( | 168 scoped_refptr<DecoderBufferBase> DecoderBufferBaseMarshaller::Read( |
153 scoped_ptr<MediaMessage> msg) { | 169 scoped_ptr<MediaMessage> msg) { |
154 scoped_refptr<DecoderBufferFromMsg> buffer( | 170 scoped_refptr<DecoderBufferFromMsg> buffer( |
155 new DecoderBufferFromMsg(msg.Pass())); | 171 new DecoderBufferFromMsg(msg.Pass())); |
156 buffer->Initialize(); | 172 buffer->Initialize(); |
157 return buffer; | 173 return buffer; |
158 } | 174 } |
159 | 175 |
160 } // namespace media | 176 } // namespace media |
161 } // namespace chromecast | 177 } // namespace chromecast |
OLD | NEW |