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 #include "media/cast/transport/transport/udp_transport.h" | 5 #include "media/cast/net/udp_transport.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/rand_util.h" | 15 #include "base/rand_util.h" |
16 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
18 #include "net/base/rand_callback.h" | 18 #include "net/base/rand_callback.h" |
19 | 19 |
20 namespace media { | 20 namespace media { |
21 namespace cast { | 21 namespace cast { |
22 namespace transport { | |
23 | 22 |
24 namespace { | 23 namespace { |
25 const int kMaxPacketSize = 1500; | 24 const int kMaxPacketSize = 1500; |
26 | 25 |
27 bool IsEmpty(const net::IPEndPoint& addr) { | 26 bool IsEmpty(const net::IPEndPoint& addr) { |
28 net::IPAddressNumber empty_addr(addr.address().size()); | 27 net::IPAddressNumber empty_addr(addr.address().size()); |
29 return std::equal( | 28 return std::equal( |
30 empty_addr.begin(), empty_addr.end(), addr.address().begin()) && | 29 empty_addr.begin(), empty_addr.end(), addr.address().begin()) && |
31 !addr.port(); | 30 !addr.port(); |
32 } | 31 } |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } else { | 229 } else { |
231 // Successful send, re-start reading if needed. | 230 // Successful send, re-start reading if needed. |
232 ScheduleReceiveNextPacket(); | 231 ScheduleReceiveNextPacket(); |
233 } | 232 } |
234 | 233 |
235 if (!cb.is_null()) { | 234 if (!cb.is_null()) { |
236 cb.Run(); | 235 cb.Run(); |
237 } | 236 } |
238 } | 237 } |
239 | 238 |
240 } // namespace transport | |
241 } // namespace cast | 239 } // namespace cast |
242 } // namespace media | 240 } // namespace media |
OLD | NEW |