Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: media/cast/net/cast_transport_defines.h

Issue 388663003: Cast: Reshuffle files under media/cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: similarity = 10 Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_NET_CAST_TRANSPORT_DEFINES_H_
6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_DEFINES_H_ 6 #define MEDIA_CAST_NET_CAST_TRANSPORT_DEFINES_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 16
17 namespace media { 17 namespace media {
18 namespace cast { 18 namespace cast {
19 namespace transport {
20 19
21 // TODO(mikhal): Implement and add more types. 20 // TODO(mikhal): Implement and add more types.
22 enum CastTransportStatus { 21 enum CastTransportStatus {
23 TRANSPORT_AUDIO_UNINITIALIZED = 0, 22 TRANSPORT_AUDIO_UNINITIALIZED = 0,
24 TRANSPORT_VIDEO_UNINITIALIZED, 23 TRANSPORT_VIDEO_UNINITIALIZED,
25 TRANSPORT_AUDIO_INITIALIZED, 24 TRANSPORT_AUDIO_INITIALIZED,
26 TRANSPORT_VIDEO_INITIALIZED, 25 TRANSPORT_VIDEO_INITIALIZED,
27 TRANSPORT_INVALID_CRYPTO_CONFIG, 26 TRANSPORT_INVALID_CRYPTO_CONFIG,
28 TRANSPORT_SOCKET_ERROR, 27 TRANSPORT_SOCKET_ERROR,
29 CAST_TRANSPORT_STATUS_LAST = TRANSPORT_SOCKET_ERROR 28 CAST_TRANSPORT_STATUS_LAST = TRANSPORT_SOCKET_ERROR
30 }; 29 };
31 30
32 const size_t kMaxIpPacketSize = 1500; 31 const size_t kMaxIpPacketSize = 1500;
33 // Each uint16 represents one packet id within a cast frame. 32 // Each uint16 represents one packet id within a cast frame.
34 typedef std::set<uint16> PacketIdSet; 33 typedef std::set<uint16> PacketIdSet;
35 // Each uint8 represents one cast frame. 34 // Each uint8 represents one cast frame.
36 typedef std::map<uint8, PacketIdSet> MissingFramesAndPacketsMap; 35 typedef std::map<uint8, PacketIdSet> MissingFramesAndPacketsMap;
37 36
38 // Crypto.
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) {
wtc 2014/07/11 22:31:36 Why did you delete this function from this header
Alpha Left Google 2014/07/12 01:37:55 This function is used only once in the .cc file th
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. 37 // Rtcp defines.
59 38
60 enum RtcpPacketFields { 39 enum RtcpPacketFields {
61 kPacketTypeLow = 194, // SMPTE time-code mapping. 40 kPacketTypeLow = 194, // SMPTE time-code mapping.
62 kPacketTypeInterArrivalJitterReport = 195, 41 kPacketTypeInterArrivalJitterReport = 195,
63 kPacketTypeSenderReport = 200, 42 kPacketTypeSenderReport = 200,
64 kPacketTypeReceiverReport = 201, 43 kPacketTypeReceiverReport = 201,
65 kPacketTypeSdes = 202, 44 kPacketTypeSdes = 202,
66 kPacketTypeBye = 203, 45 kPacketTypeBye = 203,
67 kPacketTypeApplicationDefined = 204, 46 kPacketTypeApplicationDefined = 204,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 DISALLOW_COPY_AND_ASSIGN(FrameIdWrapHelper); 134 DISALLOW_COPY_AND_ASSIGN(FrameIdWrapHelper);
156 }; 135 };
157 136
158 inline uint32 GetVideoRtpTimestamp(const base::TimeTicks& time_ticks) { 137 inline uint32 GetVideoRtpTimestamp(const base::TimeTicks& time_ticks) {
159 base::TimeTicks zero_time; 138 base::TimeTicks zero_time;
160 base::TimeDelta recorded_delta = time_ticks - zero_time; 139 base::TimeDelta recorded_delta = time_ticks - zero_time;
161 // Timestamp is in 90 KHz for video. 140 // Timestamp is in 90 KHz for video.
162 return static_cast<uint32>(recorded_delta.InMilliseconds() * 90); 141 return static_cast<uint32>(recorded_delta.InMilliseconds() * 90);
163 } 142 }
164 143
165 } // namespace transport
166 } // namespace cast 144 } // namespace cast
167 } // namespace media 145 } // namespace media
168 146
169 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_DEFINES_H_ 147 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_DEFINES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698