Index: media/webm/webm_cluster_parser.cc |
diff --git a/media/webm/webm_cluster_parser.cc b/media/webm/webm_cluster_parser.cc |
index fb1c69b874739719169085cbdcf4278862e95a61..a398e4d17fa95687c2a34164f3b0b98fee5ea62a 100644 |
--- a/media/webm/webm_cluster_parser.cc |
+++ b/media/webm/webm_cluster_parser.cc |
@@ -7,7 +7,6 @@ |
#include <vector> |
#include "base/logging.h" |
-#include "base/sys_byteorder.h" |
#include "media/base/data_buffer.h" |
#include "media/base/decrypt_config.h" |
#include "media/webm/webm_constants.h" |
@@ -17,9 +16,9 @@ namespace media { |
// Generates a 16 byte CTR counter block. The CTR counter block format is a |
// CTR IV appended with a CTR block counter. |iv| is an 8 byte CTR IV. |
// Returns a string of kDecryptionKeySize bytes. |
-static std::string GenerateCounterBlock(uint64 iv) { |
- std::string counter_block(reinterpret_cast<char*>(&iv), sizeof(iv)); |
- counter_block.append(DecryptConfig::kDecryptionKeySize - sizeof(iv), 0); |
+static std::string GenerateCounterBlock(const uint8* iv, size_t iv_size) { |
+ std::string counter_block(reinterpret_cast<const char*>(iv), iv_size); |
ddorwin
2012/10/13 17:21:27
Should we counter_block.resize(DecryptConfig::kDec
fgalligan1
2012/10/14 16:45:24
What about this?
std::string counter_block(Decrypt
ddorwin
2012/10/15 02:32:49
SGTM
|
+ counter_block.append(DecryptConfig::kDecryptionKeySize - iv_size, 0); |
return counter_block; |
} |
@@ -237,10 +236,8 @@ bool WebMClusterParser::OnBlock(int track_num, int timecode, |
std::string counter_block; |
if (signal_byte & kWebMFlagEncryptedFrame) { |
- uint64 network_iv; |
- memcpy(&network_iv, data + data_offset, sizeof(network_iv)); |
- data_offset += sizeof(network_iv); |
- counter_block = GenerateCounterBlock(base::NetToHost64(network_iv)); |
+ counter_block = GenerateCounterBlock(data + data_offset, kWebMIvSize); |
+ data_offset += kWebMIvSize; |
} |
// TODO(fgalligan): Revisit if DecryptConfig needs to be set on unencrypted |