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

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

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_NET_CAST_TRANSPORT_CONFIG_H_ 5 #ifndef MEDIA_CAST_NET_CAST_TRANSPORT_CONFIG_H_
6 #define MEDIA_CAST_NET_CAST_TRANSPORT_CONFIG_H_ 6 #define MEDIA_CAST_NET_CAST_TRANSPORT_CONFIG_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h"
11 #include "base/callback.h" 10 #include "base/callback.h"
12 #include "base/stl_util.h" 11 #include "base/stl_util.h"
13 #include "media/cast/net/cast_transport_defines.h" 12 #include "media/cast/net/cast_transport_defines.h"
14 13
15 namespace media { 14 namespace media {
16 namespace cast { 15 namespace cast {
17 16
18 enum Codec { 17 enum Codec {
19 CODEC_UNKNOWN, 18 CODEC_UNKNOWN,
20 CODEC_AUDIO_OPUS, 19 CODEC_AUDIO_OPUS,
21 CODEC_AUDIO_PCM16, 20 CODEC_AUDIO_PCM16,
22 CODEC_AUDIO_AAC, 21 CODEC_AUDIO_AAC,
23 CODEC_VIDEO_FAKE, 22 CODEC_VIDEO_FAKE,
24 CODEC_VIDEO_VP8, 23 CODEC_VIDEO_VP8,
25 CODEC_VIDEO_H264, 24 CODEC_VIDEO_H264,
26 CODEC_LAST = CODEC_VIDEO_H264 25 CODEC_LAST = CODEC_VIDEO_H264
27 }; 26 };
28 27
29 struct CastTransportRtpConfig { 28 struct CastTransportRtpConfig {
30 CastTransportRtpConfig(); 29 CastTransportRtpConfig();
31 ~CastTransportRtpConfig(); 30 ~CastTransportRtpConfig();
32 31
33 // Identifier refering to this sender. 32 // Identifier refering to this sender.
34 uint32 ssrc; 33 uint32_t ssrc;
35 34
36 // Identifier for incoming RTCP traffic. 35 // Identifier for incoming RTCP traffic.
37 uint32 feedback_ssrc; 36 uint32_t feedback_ssrc;
38 37
39 // RTP payload type enum: Specifies the type/encoding of frame data. 38 // RTP payload type enum: Specifies the type/encoding of frame data.
40 int rtp_payload_type; 39 int rtp_payload_type;
41 40
42 // The AES crypto key and initialization vector. Each of these strings 41 // The AES crypto key and initialization vector. Each of these strings
43 // contains the data in binary form, of size kAesKeySize. If they are empty 42 // contains the data in binary form, of size kAesKeySize. If they are empty
44 // strings, crypto is not being used. 43 // strings, crypto is not being used.
45 std::string aes_key; 44 std::string aes_key;
46 std::string aes_iv_mask; 45 std::string aes_iv_mask;
47 }; 46 };
(...skipping 15 matching lines...) Expand all
63 // Independently decodable, and no future frames will depend on any frames 62 // Independently decodable, and no future frames will depend on any frames
64 // before this one. 63 // before this one.
65 KEY, 64 KEY,
66 65
67 DEPENDENCY_LAST = KEY 66 DEPENDENCY_LAST = KEY
68 }; 67 };
69 68
70 EncodedFrame(); 69 EncodedFrame();
71 virtual ~EncodedFrame(); 70 virtual ~EncodedFrame();
72 71
73 // Convenience accessors to data as an array of uint8 elements. 72 // Convenience accessors to data as an array of uint8_t elements.
74 const uint8* bytes() const { 73 const uint8_t* bytes() const {
75 return reinterpret_cast<uint8*>(string_as_array( 74 return reinterpret_cast<uint8_t*>(
76 const_cast<std::string*>(&data))); 75 string_as_array(const_cast<std::string*>(&data)));
77 } 76 }
78 uint8* mutable_bytes() { 77 uint8_t* mutable_bytes() {
79 return reinterpret_cast<uint8*>(string_as_array(&data)); 78 return reinterpret_cast<uint8_t*>(string_as_array(&data));
80 } 79 }
81 80
82 // Copies all data members except |data| to |dest|. 81 // Copies all data members except |data| to |dest|.
83 // Does not modify |dest->data|. 82 // Does not modify |dest->data|.
84 void CopyMetadataTo(EncodedFrame* dest) const; 83 void CopyMetadataTo(EncodedFrame* dest) const;
85 84
86 // This frame's dependency relationship with respect to other frames. 85 // This frame's dependency relationship with respect to other frames.
87 Dependency dependency; 86 Dependency dependency;
88 87
89 // The label associated with this frame. Implies an ordering relative to 88 // The label associated with this frame. Implies an ordering relative to
90 // other frames in the same stream. 89 // other frames in the same stream.
91 uint32 frame_id; 90 uint32_t frame_id;
92 91
93 // The label associated with the frame upon which this frame depends. If 92 // The label associated with the frame upon which this frame depends. If
94 // this frame does not require any other frame in order to become decodable 93 // this frame does not require any other frame in order to become decodable
95 // (e.g., key frames), |referenced_frame_id| must equal |frame_id|. 94 // (e.g., key frames), |referenced_frame_id| must equal |frame_id|.
96 uint32 referenced_frame_id; 95 uint32_t referenced_frame_id;
97 96
98 // The stream timestamp, on the timeline of the signal data. For example, RTP 97 // The stream timestamp, on the timeline of the signal data. For example, RTP
99 // timestamps for audio are usually defined as the total number of audio 98 // timestamps for audio are usually defined as the total number of audio
100 // samples encoded in all prior frames. A playback system uses this value to 99 // samples encoded in all prior frames. A playback system uses this value to
101 // detect gaps in the stream, and otherwise stretch the signal to match 100 // detect gaps in the stream, and otherwise stretch the signal to match
102 // playout targets. 101 // playout targets.
103 uint32 rtp_timestamp; 102 uint32_t rtp_timestamp;
104 103
105 // The common reference clock timestamp for this frame. This value originates 104 // The common reference clock timestamp for this frame. This value originates
106 // from a sender and is used to provide lip synchronization between streams in 105 // from a sender and is used to provide lip synchronization between streams in
107 // a receiver. Thus, in the sender context, this is set to the time at which 106 // a receiver. Thus, in the sender context, this is set to the time at which
108 // the frame was captured/recorded. In the receiver context, this is set to 107 // the frame was captured/recorded. In the receiver context, this is set to
109 // the target playout time. Over a sequence of frames, this time value is 108 // the target playout time. Over a sequence of frames, this time value is
110 // expected to drift with respect to the elapsed time implied by the RTP 109 // expected to drift with respect to the elapsed time implied by the RTP
111 // timestamps; and it may not necessarily increment with precise regularity. 110 // timestamps; and it may not necessarily increment with precise regularity.
112 base::TimeTicks reference_time; 111 base::TimeTicks reference_time;
113 112
114 // Playout delay for this and all future frames. Used by the Adaptive 113 // Playout delay for this and all future frames. Used by the Adaptive
115 // Playout delay extension. Zero means no change. 114 // Playout delay extension. Zero means no change.
116 uint16 new_playout_delay_ms; 115 uint16_t new_playout_delay_ms;
117 116
118 // The encoded signal data. 117 // The encoded signal data.
119 std::string data; 118 std::string data;
120 }; 119 };
121 120
122 typedef base::Callback<void(scoped_ptr<Packet> packet)> PacketReceiverCallback; 121 typedef base::Callback<void(scoped_ptr<Packet> packet)> PacketReceiverCallback;
123 typedef base::Callback<bool(scoped_ptr<Packet> packet)> 122 typedef base::Callback<bool(scoped_ptr<Packet> packet)>
124 PacketReceiverCallbackWithStatus; 123 PacketReceiverCallbackWithStatus;
125 124
126 class PacketSender { 125 class PacketSender {
127 public: 126 public:
128 // Send a packet to the network. Returns false if the network is blocked 127 // Send a packet to the network. Returns false if the network is blocked
129 // and we should wait for |cb| to be called. It is not allowed to called 128 // and we should wait for |cb| to be called. It is not allowed to called
130 // SendPacket again until |cb| has been called. Any other errors that 129 // SendPacket again until |cb| has been called. Any other errors that
131 // occur will be reported through side channels, in such cases, this function 130 // occur will be reported through side channels, in such cases, this function
132 // will return true indicating that the channel is not blocked. 131 // will return true indicating that the channel is not blocked.
133 virtual bool SendPacket(PacketRef packet, const base::Closure& cb) = 0; 132 virtual bool SendPacket(PacketRef packet, const base::Closure& cb) = 0;
134 133
135 // Returns the number of bytes ever sent. 134 // Returns the number of bytes ever sent.
136 virtual int64 GetBytesSent() = 0; 135 virtual int64_t GetBytesSent() = 0;
137 136
138 virtual ~PacketSender() {} 137 virtual ~PacketSender() {}
139 }; 138 };
140 139
141 struct RtcpSenderInfo { 140 struct RtcpSenderInfo {
142 RtcpSenderInfo(); 141 RtcpSenderInfo();
143 ~RtcpSenderInfo(); 142 ~RtcpSenderInfo();
144 // First three members are used for lipsync. 143 // First three members are used for lipsync.
145 // First two members are used for rtt. 144 // First two members are used for rtt.
146 uint32 ntp_seconds; 145 uint32_t ntp_seconds;
147 uint32 ntp_fraction; 146 uint32_t ntp_fraction;
148 uint32 rtp_timestamp; 147 uint32_t rtp_timestamp;
149 uint32 send_packet_count; 148 uint32_t send_packet_count;
150 size_t send_octet_count; 149 size_t send_octet_count;
151 }; 150 };
152 151
153 struct RtcpReportBlock { 152 struct RtcpReportBlock {
154 RtcpReportBlock(); 153 RtcpReportBlock();
155 ~RtcpReportBlock(); 154 ~RtcpReportBlock();
156 uint32 remote_ssrc; // SSRC of sender of this report. 155 uint32_t remote_ssrc; // SSRC of sender of this report.
157 uint32 media_ssrc; // SSRC of the RTP packet sender. 156 uint32_t media_ssrc; // SSRC of the RTP packet sender.
158 uint8 fraction_lost; 157 uint8_t fraction_lost;
159 uint32 cumulative_lost; // 24 bits valid. 158 uint32_t cumulative_lost; // 24 bits valid.
160 uint32 extended_high_sequence_number; 159 uint32_t extended_high_sequence_number;
161 uint32 jitter; 160 uint32_t jitter;
162 uint32 last_sr; 161 uint32_t last_sr;
163 uint32 delay_since_last_sr; 162 uint32_t delay_since_last_sr;
164 }; 163 };
165 164
166 struct RtcpDlrrReportBlock { 165 struct RtcpDlrrReportBlock {
167 RtcpDlrrReportBlock(); 166 RtcpDlrrReportBlock();
168 ~RtcpDlrrReportBlock(); 167 ~RtcpDlrrReportBlock();
169 uint32 last_rr; 168 uint32_t last_rr;
170 uint32 delay_since_last_rr; 169 uint32_t delay_since_last_rr;
171 }; 170 };
172 171
173 inline bool operator==(RtcpSenderInfo lhs, RtcpSenderInfo rhs) { 172 inline bool operator==(RtcpSenderInfo lhs, RtcpSenderInfo rhs) {
174 return lhs.ntp_seconds == rhs.ntp_seconds && 173 return lhs.ntp_seconds == rhs.ntp_seconds &&
175 lhs.ntp_fraction == rhs.ntp_fraction && 174 lhs.ntp_fraction == rhs.ntp_fraction &&
176 lhs.rtp_timestamp == rhs.rtp_timestamp && 175 lhs.rtp_timestamp == rhs.rtp_timestamp &&
177 lhs.send_packet_count == rhs.send_packet_count && 176 lhs.send_packet_count == rhs.send_packet_count &&
178 lhs.send_octet_count == rhs.send_octet_count; 177 lhs.send_octet_count == rhs.send_octet_count;
179 } 178 }
180 179
181 } // namespace cast 180 } // namespace cast
182 } // namespace media 181 } // namespace media
183 182
184 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_CONFIG_H_ 183 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_CONFIG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698