OLD | NEW |
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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 uint16_t new_playout_delay_ms; | 119 uint16_t new_playout_delay_ms; |
120 | 120 |
121 // The encoded signal data. | 121 // The encoded signal data. |
122 std::string data; | 122 std::string data; |
123 }; | 123 }; |
124 | 124 |
125 typedef base::Callback<void(scoped_ptr<Packet> packet)> PacketReceiverCallback; | 125 typedef base::Callback<void(scoped_ptr<Packet> packet)> PacketReceiverCallback; |
126 typedef base::Callback<bool(scoped_ptr<Packet> packet)> | 126 typedef base::Callback<bool(scoped_ptr<Packet> packet)> |
127 PacketReceiverCallbackWithStatus; | 127 PacketReceiverCallbackWithStatus; |
128 | 128 |
| 129 // TODO(xjz): Rename PacketSender as it also deals with receiving packets. |
| 130 // http://crbug.com/589157. |
129 class PacketSender { | 131 class PacketSender { |
130 public: | 132 public: |
131 // Send a packet to the network. Returns false if the network is blocked | 133 // Send a packet to the network. Returns false if the network is blocked |
132 // and we should wait for |cb| to be called. It is not allowed to called | 134 // and we should wait for |cb| to be called. It is not allowed to called |
133 // SendPacket again until |cb| has been called. Any other errors that | 135 // SendPacket again until |cb| has been called. Any other errors that |
134 // occur will be reported through side channels, in such cases, this function | 136 // occur will be reported through side channels, in such cases, this function |
135 // will return true indicating that the channel is not blocked. | 137 // will return true indicating that the channel is not blocked. |
136 virtual bool SendPacket(PacketRef packet, const base::Closure& cb) = 0; | 138 virtual bool SendPacket(PacketRef packet, const base::Closure& cb) = 0; |
137 | 139 |
138 // Returns the number of bytes ever sent. | 140 // Returns the number of bytes ever sent. |
139 virtual int64_t GetBytesSent() = 0; | 141 virtual int64_t GetBytesSent() = 0; |
140 | 142 |
| 143 // Start receiving packets. Pakets are submitted to |packet_receiver|. |
| 144 virtual void StartReceiving( |
| 145 const PacketReceiverCallbackWithStatus& packet_receiver) = 0; |
| 146 |
| 147 // Stop receiving packets. |
| 148 virtual void StopReceiving() = 0; |
| 149 |
141 virtual ~PacketSender() {} | 150 virtual ~PacketSender() {} |
142 }; | 151 }; |
143 | 152 |
144 struct RtcpSenderInfo { | 153 struct RtcpSenderInfo { |
145 RtcpSenderInfo(); | 154 RtcpSenderInfo(); |
146 ~RtcpSenderInfo(); | 155 ~RtcpSenderInfo(); |
147 // First three members are used for lipsync. | 156 // First three members are used for lipsync. |
148 // Last two members are used for rtt. | 157 // Last two members are used for rtt. |
149 uint32_t ntp_seconds; | 158 uint32_t ntp_seconds; |
150 uint32_t ntp_fraction; | 159 uint32_t ntp_fraction; |
(...skipping 27 matching lines...) Expand all Loading... |
178 lhs.ntp_fraction == rhs.ntp_fraction && | 187 lhs.ntp_fraction == rhs.ntp_fraction && |
179 lhs.rtp_timestamp == rhs.rtp_timestamp && | 188 lhs.rtp_timestamp == rhs.rtp_timestamp && |
180 lhs.send_packet_count == rhs.send_packet_count && | 189 lhs.send_packet_count == rhs.send_packet_count && |
181 lhs.send_octet_count == rhs.send_octet_count; | 190 lhs.send_octet_count == rhs.send_octet_count; |
182 } | 191 } |
183 | 192 |
184 } // namespace cast | 193 } // namespace cast |
185 } // namespace media | 194 } // namespace media |
186 | 195 |
187 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_CONFIG_H_ | 196 #endif // MEDIA_CAST_NET_CAST_TRANSPORT_CONFIG_H_ |
OLD | NEW |