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_UDP_TRANSPORT_H_ | 5 #ifndef MEDIA_CAST_NET_UDP_TRANSPORT_H_ |
6 #define MEDIA_CAST_NET_UDP_TRANSPORT_H_ | 6 #define MEDIA_CAST_NET_UDP_TRANSPORT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "media/cast/cast_environment.h" | 17 #include "media/cast/cast_environment.h" |
17 #include "media/cast/net/cast_transport.h" | 18 #include "media/cast/net/cast_transport.h" |
18 #include "media/cast/net/cast_transport_config.h" | 19 #include "media/cast/net/cast_transport_config.h" |
19 #include "media/cast/net/pacing/paced_sender.h" | 20 #include "media/cast/net/pacing/paced_sender.h" |
20 #include "net/base/io_buffer.h" | 21 #include "net/base/io_buffer.h" |
21 #include "net/base/ip_endpoint.h" | 22 #include "net/base/ip_endpoint.h" |
22 #include "net/udp/diff_serv_code_point.h" | 23 #include "net/udp/diff_serv_code_point.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void ScheduleReceiveNextPacket(); | 96 void ScheduleReceiveNextPacket(); |
96 | 97 |
97 void OnSent(const scoped_refptr<net::IOBuffer>& buf, | 98 void OnSent(const scoped_refptr<net::IOBuffer>& buf, |
98 PacketRef packet, | 99 PacketRef packet, |
99 const base::Closure& cb, | 100 const base::Closure& cb, |
100 int result); | 101 int result); |
101 | 102 |
102 const scoped_refptr<base::SingleThreadTaskRunner> io_thread_proxy_; | 103 const scoped_refptr<base::SingleThreadTaskRunner> io_thread_proxy_; |
103 const net::IPEndPoint local_addr_; | 104 const net::IPEndPoint local_addr_; |
104 net::IPEndPoint remote_addr_; | 105 net::IPEndPoint remote_addr_; |
105 scoped_ptr<net::UDPSocket> udp_socket_; | 106 std::unique_ptr<net::UDPSocket> udp_socket_; |
106 bool send_pending_; | 107 bool send_pending_; |
107 bool receive_pending_; | 108 bool receive_pending_; |
108 bool client_connected_; | 109 bool client_connected_; |
109 net::DiffServCodePoint next_dscp_value_; | 110 net::DiffServCodePoint next_dscp_value_; |
110 scoped_ptr<Packet> next_packet_; | 111 std::unique_ptr<Packet> next_packet_; |
111 scoped_refptr<net::WrappedIOBuffer> recv_buf_; | 112 scoped_refptr<net::WrappedIOBuffer> recv_buf_; |
112 net::IPEndPoint recv_addr_; | 113 net::IPEndPoint recv_addr_; |
113 PacketReceiverCallbackWithStatus packet_receiver_; | 114 PacketReceiverCallbackWithStatus packet_receiver_; |
114 int32_t send_buffer_size_; | 115 int32_t send_buffer_size_; |
115 const CastTransportStatusCallback status_callback_; | 116 const CastTransportStatusCallback status_callback_; |
116 int bytes_sent_; | 117 int bytes_sent_; |
117 | 118 |
118 // NOTE: Weak pointers must be invalidated before all other member variables. | 119 // NOTE: Weak pointers must be invalidated before all other member variables. |
119 base::WeakPtrFactory<UdpTransport> weak_factory_; | 120 base::WeakPtrFactory<UdpTransport> weak_factory_; |
120 | 121 |
121 DISALLOW_COPY_AND_ASSIGN(UdpTransport); | 122 DISALLOW_COPY_AND_ASSIGN(UdpTransport); |
122 }; | 123 }; |
123 | 124 |
124 } // namespace cast | 125 } // namespace cast |
125 } // namespace media | 126 } // namespace media |
126 | 127 |
127 #endif // MEDIA_CAST_NET_UDP_TRANSPORT_H_ | 128 #endif // MEDIA_CAST_NET_UDP_TRANSPORT_H_ |
OLD | NEW |