OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/webm/webm_cluster_parser.h" | 5 #include "media/webm/webm_cluster_parser.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/sys_byteorder.h" | 8 #include "base/sys_byteorder.h" |
9 #include "media/base/data_buffer.h" | 9 #include "media/base/data_buffer.h" |
10 #include "media/base/decrypt_config.h" | 10 #include "media/base/decrypt_config.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 scoped_refptr<StreamParserBuffer> buffer = | 228 scoped_refptr<StreamParserBuffer> buffer = |
229 StreamParserBuffer::CopyFrom(data + offset, size - offset, is_keyframe); | 229 StreamParserBuffer::CopyFrom(data + offset, size - offset, is_keyframe); |
230 | 230 |
231 if (encrypted) { | 231 if (encrypted) { |
232 uint64 network_iv; | 232 uint64 network_iv; |
233 memcpy(&network_iv, data + kWebMHmacSize, sizeof(network_iv)); | 233 memcpy(&network_iv, data + kWebMHmacSize, sizeof(network_iv)); |
234 const uint64 iv = base::NetToHost64(network_iv); | 234 const uint64 iv = base::NetToHost64(network_iv); |
235 | 235 |
236 scoped_array<uint8> counter_block(GenerateCounterBlock(iv)); | 236 scoped_array<uint8> counter_block(GenerateCounterBlock(iv)); |
237 buffer->SetDecryptConfig(scoped_ptr<DecryptConfig>(new DecryptConfig( | 237 buffer->SetDecryptConfig(scoped_ptr<DecryptConfig>(new DecryptConfig( |
238 video_encryption_key_id_.get(), video_encryption_key_id_size_, | 238 std::string( |
239 counter_block.get(), DecryptConfig::kDecryptionKeySize, | 239 reinterpret_cast<const char*>(video_encryption_key_id_.get()), |
240 data, kWebMHmacSize, | 240 video_encryption_key_id_size_), |
241 sizeof(iv)))); | 241 std::string( |
| 242 reinterpret_cast<const char*>(counter_block.get()), |
| 243 DecryptConfig::kDecryptionKeySize), |
| 244 std::string(reinterpret_cast<const char*>(data), kWebMHmacSize), |
| 245 sizeof(iv), |
| 246 std::vector<SubsampleEntry>()))); |
242 } | 247 } |
243 | 248 |
244 buffer->SetTimestamp(timestamp); | 249 buffer->SetTimestamp(timestamp); |
245 if (cluster_start_time_ == kNoTimestamp()) | 250 if (cluster_start_time_ == kNoTimestamp()) |
246 cluster_start_time_ = timestamp; | 251 cluster_start_time_ = timestamp; |
247 | 252 |
248 if (block_duration >= 0) { | 253 if (block_duration >= 0) { |
249 buffer->SetDuration(base::TimeDelta::FromMicroseconds( | 254 buffer->SetDuration(base::TimeDelta::FromMicroseconds( |
250 block_duration * timecode_multiplier_)); | 255 block_duration * timecode_multiplier_)); |
251 } | 256 } |
(...skipping 24 matching lines...) Expand all Loading... |
276 | 281 |
277 buffers_.push_back(buffer); | 282 buffers_.push_back(buffer); |
278 return true; | 283 return true; |
279 } | 284 } |
280 | 285 |
281 void WebMClusterParser::Track::Reset() { | 286 void WebMClusterParser::Track::Reset() { |
282 buffers_.clear(); | 287 buffers_.clear(); |
283 } | 288 } |
284 | 289 |
285 } // namespace media | 290 } // namespace media |
OLD | NEW |