| 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(video_encryption_key_id_.get(), |
| 239 counter_block.get(), DecryptConfig::kDecryptionKeySize, | 239 video_encryption_key_id_.get() + |
| 240 data, kWebMHmacSize, | 240 video_encryption_key_id_size_), |
| 241 sizeof(iv)))); | 241 std::string(counter_block.get(), |
| 242 counter_block.get() + DecryptConfig::kDecryptionKeySize), |
| 243 std::string(data, data + kWebMHmacSize), |
| 244 sizeof(iv), |
| 245 std::vector<SubsampleEntry>()))); |
| 242 } | 246 } |
| 243 | 247 |
| 244 buffer->SetTimestamp(timestamp); | 248 buffer->SetTimestamp(timestamp); |
| 245 if (cluster_start_time_ == kNoTimestamp()) | 249 if (cluster_start_time_ == kNoTimestamp()) |
| 246 cluster_start_time_ = timestamp; | 250 cluster_start_time_ = timestamp; |
| 247 | 251 |
| 248 if (block_duration >= 0) { | 252 if (block_duration >= 0) { |
| 249 buffer->SetDuration(base::TimeDelta::FromMicroseconds( | 253 buffer->SetDuration(base::TimeDelta::FromMicroseconds( |
| 250 block_duration * timecode_multiplier_)); | 254 block_duration * timecode_multiplier_)); |
| 251 } | 255 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 276 | 280 |
| 277 buffers_.push_back(buffer); | 281 buffers_.push_back(buffer); |
| 278 return true; | 282 return true; |
| 279 } | 283 } |
| 280 | 284 |
| 281 void WebMClusterParser::Track::Reset() { | 285 void WebMClusterParser::Track::Reset() { |
| 282 buffers_.clear(); | 286 buffers_.clear(); |
| 283 } | 287 } |
| 284 | 288 |
| 285 } // namespace media | 289 } // namespace media |
| OLD | NEW |