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

Side by Side Diff: media/cast/net/udp_transport.cc

Issue 1565303002: Change IPEndpoint::address() to return a net::IPAddress (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Android Created 4 years, 11 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
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 #include "media/cast/net/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 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/rand_util.h" 14 #include "base/rand_util.h"
15 #include "build/build_config.h" 15 #include "build/build_config.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 22
23 namespace { 23 namespace {
24 const int kMaxPacketSize = 1500; 24 const int kMaxPacketSize = 1500;
25 25
26 bool IsEmpty(const net::IPEndPoint& addr) { 26 bool IsEmpty(const net::IPEndPoint& addr) {
27 net::IPAddressNumber empty_addr(addr.address().size()); 27 net::IPAddressNumber empty_addr(addr.address_number().size());
28 return std::equal( 28 return std::equal(empty_addr.begin(), empty_addr.end(),
eroman 2016/01/13 00:27:57 I have seen this pattern in some other places. Mig
29 empty_addr.begin(), empty_addr.end(), addr.address().begin()) && 29 addr.address_number().begin()) &&
30 !addr.port(); 30 !addr.port();
31 } 31 }
32 32
33 bool IsEqual(const net::IPEndPoint& addr1, const net::IPEndPoint& addr2) { 33 bool IsEqual(const net::IPEndPoint& addr1, const net::IPEndPoint& addr2) {
34 return addr1.port() == addr2.port() && std::equal(addr1.address().begin(), 34 return addr1.port() == addr2.port() &&
35 addr1.address().end(), 35 std::equal(addr1.address_number().begin(),
eroman 2016/01/13 00:27:57 Hmm, this looks wrong. Filed https://code.google.c
36 addr2.address().begin()); 36 addr1.address_number().end(),
37 addr2.address_number().begin());
37 } 38 }
38 } // namespace 39 } // namespace
39 40
40 UdpTransport::UdpTransport( 41 UdpTransport::UdpTransport(
41 net::NetLog* net_log, 42 net::NetLog* net_log,
42 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_proxy, 43 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_proxy,
43 const net::IPEndPoint& local_end_point, 44 const net::IPEndPoint& local_end_point,
44 const net::IPEndPoint& remote_end_point, 45 const net::IPEndPoint& remote_end_point,
45 int32_t send_buffer_size, 46 int32_t send_buffer_size,
46 const CastTransportStatusCallback& status_callback) 47 const CastTransportStatusCallback& status_callback)
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 } 276 }
276 ScheduleReceiveNextPacket(); 277 ScheduleReceiveNextPacket();
277 278
278 if (!cb.is_null()) { 279 if (!cb.is_null()) {
279 cb.Run(); 280 cb.Run();
280 } 281 }
281 } 282 }
282 283
283 } // namespace cast 284 } // namespace cast
284 } // namespace media 285 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698