Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_DEFINES_H_ | 5 #ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_DEFINES_H_ |
| 6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_DEFINES_H_ | 6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_DEFINES_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 TRANSPORT_SOCKET_ERROR, | 28 TRANSPORT_SOCKET_ERROR, |
| 29 CAST_TRANSPORT_STATUS_LAST = TRANSPORT_SOCKET_ERROR | 29 CAST_TRANSPORT_STATUS_LAST = TRANSPORT_SOCKET_ERROR |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 const size_t kMaxIpPacketSize = 1500; | 32 const size_t kMaxIpPacketSize = 1500; |
| 33 // Each uint16 represents one packet id within a cast frame. | 33 // Each uint16 represents one packet id within a cast frame. |
| 34 typedef std::set<uint16> PacketIdSet; | 34 typedef std::set<uint16> PacketIdSet; |
| 35 // Each uint8 represents one cast frame. | 35 // Each uint8 represents one cast frame. |
| 36 typedef std::map<uint8, PacketIdSet> MissingFramesAndPacketsMap; | 36 typedef std::map<uint8, PacketIdSet> MissingFramesAndPacketsMap; |
| 37 | 37 |
| 38 // Crypto. | |
|
miu
2014/07/11 01:19:36
Thanks for moving this to where it was actually be
| |
| 39 const size_t kAesBlockSize = 16; | |
| 40 const size_t kAesKeySize = 16; | |
| 41 | |
| 42 inline std::string GetAesNonce(uint32 frame_id, const std::string& iv_mask) { | |
| 43 std::string aes_nonce(kAesBlockSize, 0); | |
| 44 | |
| 45 // Serializing frame_id in big-endian order (aes_nonce[8] is the most | |
| 46 // significant byte of frame_id). | |
| 47 aes_nonce[11] = frame_id & 0xff; | |
| 48 aes_nonce[10] = (frame_id >> 8) & 0xff; | |
| 49 aes_nonce[9] = (frame_id >> 16) & 0xff; | |
| 50 aes_nonce[8] = (frame_id >> 24) & 0xff; | |
| 51 | |
| 52 for (size_t i = 0; i < kAesBlockSize; ++i) { | |
| 53 aes_nonce[i] ^= iv_mask[i]; | |
| 54 } | |
| 55 return aes_nonce; | |
| 56 } | |
| 57 | |
| 58 // Rtcp defines. | 38 // Rtcp defines. |
| 59 | 39 |
| 60 enum RtcpPacketFields { | 40 enum RtcpPacketFields { |
| 61 kPacketTypeLow = 194, // SMPTE time-code mapping. | 41 kPacketTypeLow = 194, // SMPTE time-code mapping. |
| 62 kPacketTypeInterArrivalJitterReport = 195, | 42 kPacketTypeInterArrivalJitterReport = 195, |
| 63 kPacketTypeSenderReport = 200, | 43 kPacketTypeSenderReport = 200, |
| 64 kPacketTypeReceiverReport = 201, | 44 kPacketTypeReceiverReport = 201, |
| 65 kPacketTypeSdes = 202, | 45 kPacketTypeSdes = 202, |
| 66 kPacketTypeBye = 203, | 46 kPacketTypeBye = 203, |
| 67 kPacketTypeApplicationDefined = 204, | 47 kPacketTypeApplicationDefined = 204, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 base::TimeDelta recorded_delta = time_ticks - zero_time; | 140 base::TimeDelta recorded_delta = time_ticks - zero_time; |
| 161 // Timestamp is in 90 KHz for video. | 141 // Timestamp is in 90 KHz for video. |
| 162 return static_cast<uint32>(recorded_delta.InMilliseconds() * 90); | 142 return static_cast<uint32>(recorded_delta.InMilliseconds() * 90); |
| 163 } | 143 } |
| 164 | 144 |
| 165 } // namespace transport | 145 } // namespace transport |
| 166 } // namespace cast | 146 } // namespace cast |
| 167 } // namespace media | 147 } // namespace media |
| 168 | 148 |
| 169 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_DEFINES_H_ | 149 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_DEFINES_H_ |
| OLD | NEW |