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/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 #include "net/log/net_log_source.h" |
19 | 20 |
20 namespace media { | 21 namespace media { |
21 namespace cast { | 22 namespace cast { |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 const char kOptionDscp[] = "DSCP"; | 26 const char kOptionDscp[] = "DSCP"; |
26 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
27 const char kOptionDisableNonBlockingIO[] = "disable_non_blocking_io"; | 28 const char kOptionDisableNonBlockingIO[] = "disable_non_blocking_io"; |
28 #endif | 29 #endif |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_proxy, | 64 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_proxy, |
64 const net::IPEndPoint& local_end_point, | 65 const net::IPEndPoint& local_end_point, |
65 const net::IPEndPoint& remote_end_point, | 66 const net::IPEndPoint& remote_end_point, |
66 const CastTransportStatusCallback& status_callback) | 67 const CastTransportStatusCallback& status_callback) |
67 : io_thread_proxy_(io_thread_proxy), | 68 : io_thread_proxy_(io_thread_proxy), |
68 local_addr_(local_end_point), | 69 local_addr_(local_end_point), |
69 remote_addr_(remote_end_point), | 70 remote_addr_(remote_end_point), |
70 udp_socket_(new net::UDPSocket(net::DatagramSocket::DEFAULT_BIND, | 71 udp_socket_(new net::UDPSocket(net::DatagramSocket::DEFAULT_BIND, |
71 net::RandIntCallback(), | 72 net::RandIntCallback(), |
72 net_log, | 73 net_log, |
73 net::NetLog::Source())), | 74 net::NetLogSource())), |
74 send_pending_(false), | 75 send_pending_(false), |
75 receive_pending_(false), | 76 receive_pending_(false), |
76 client_connected_(false), | 77 client_connected_(false), |
77 next_dscp_value_(net::DSCP_NO_CHANGE), | 78 next_dscp_value_(net::DSCP_NO_CHANGE), |
78 send_buffer_size_(media::cast::kMaxBurstSize * | 79 send_buffer_size_(media::cast::kMaxBurstSize * |
79 media::cast::kMaxIpPacketSize), | 80 media::cast::kMaxIpPacketSize), |
80 status_callback_(status_callback), | 81 status_callback_(status_callback), |
81 bytes_sent_(0), | 82 bytes_sent_(0), |
82 weak_factory_(this) { | 83 weak_factory_(this) { |
83 DCHECK(!IsEmpty(local_end_point) || !IsEmpty(remote_end_point)); | 84 DCHECK(!IsEmpty(local_end_point) || !IsEmpty(remote_end_point)); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 } | 313 } |
313 #endif | 314 #endif |
314 } | 315 } |
315 | 316 |
316 void UdpTransport::SetSendBufferSize(int32_t send_buffer_size) { | 317 void UdpTransport::SetSendBufferSize(int32_t send_buffer_size) { |
317 send_buffer_size_ = send_buffer_size; | 318 send_buffer_size_ = send_buffer_size; |
318 } | 319 } |
319 | 320 |
320 } // namespace cast | 321 } // namespace cast |
321 } // namespace media | 322 } // namespace media |
OLD | NEW |