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 "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 UdpTransport( | 39 UdpTransport( |
40 net::NetLog* net_log, | 40 net::NetLog* net_log, |
41 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_proxy, | 41 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_proxy, |
42 const net::IPEndPoint& local_end_point, | 42 const net::IPEndPoint& local_end_point, |
43 const net::IPEndPoint& remote_end_point, | 43 const net::IPEndPoint& remote_end_point, |
44 int32 send_buffer_size, | 44 int32 send_buffer_size, |
45 const CastTransportStatusCallback& status_callback); | 45 const CastTransportStatusCallback& status_callback); |
46 ~UdpTransport() override; | 46 ~UdpTransport() override; |
47 | 47 |
48 // Start receiving packets. Packets are submitted to |packet_receiver|. | 48 // Start receiving packets. Packets are submitted to |packet_receiver|. |
49 void StartReceiving(const PacketReceiverCallback& packet_receiver); | 49 void StartReceiving(const PacketReceiverCallbackWithStatus& packet_receiver); |
| 50 void StopReceiving(); |
50 | 51 |
51 // Set a new DSCP value to the socket. The value will be set right before | 52 // Set a new DSCP value to the socket. The value will be set right before |
52 // the next send. | 53 // the next send. |
53 void SetDscp(net::DiffServCodePoint dscp); | 54 void SetDscp(net::DiffServCodePoint dscp); |
54 | 55 |
55 // PacketSender implementations. | 56 // PacketSender implementations. |
56 bool SendPacket(PacketRef packet, const base::Closure& cb) override; | 57 bool SendPacket(PacketRef packet, const base::Closure& cb) override; |
57 int64 GetBytesSent() override; | 58 int64 GetBytesSent() override; |
58 | 59 |
59 private: | 60 private: |
(...skipping 15 matching lines...) Expand all Loading... |
75 const net::IPEndPoint local_addr_; | 76 const net::IPEndPoint local_addr_; |
76 net::IPEndPoint remote_addr_; | 77 net::IPEndPoint remote_addr_; |
77 const scoped_ptr<net::UDPSocket> udp_socket_; | 78 const scoped_ptr<net::UDPSocket> udp_socket_; |
78 bool send_pending_; | 79 bool send_pending_; |
79 bool receive_pending_; | 80 bool receive_pending_; |
80 bool client_connected_; | 81 bool client_connected_; |
81 net::DiffServCodePoint next_dscp_value_; | 82 net::DiffServCodePoint next_dscp_value_; |
82 scoped_ptr<Packet> next_packet_; | 83 scoped_ptr<Packet> next_packet_; |
83 scoped_refptr<net::WrappedIOBuffer> recv_buf_; | 84 scoped_refptr<net::WrappedIOBuffer> recv_buf_; |
84 net::IPEndPoint recv_addr_; | 85 net::IPEndPoint recv_addr_; |
85 PacketReceiverCallback packet_receiver_; | 86 PacketReceiverCallbackWithStatus packet_receiver_; |
86 int32 send_buffer_size_; | 87 int32 send_buffer_size_; |
87 const CastTransportStatusCallback status_callback_; | 88 const CastTransportStatusCallback status_callback_; |
88 int bytes_sent_; | 89 int bytes_sent_; |
89 | 90 |
90 // NOTE: Weak pointers must be invalidated before all other member variables. | 91 // NOTE: Weak pointers must be invalidated before all other member variables. |
91 base::WeakPtrFactory<UdpTransport> weak_factory_; | 92 base::WeakPtrFactory<UdpTransport> weak_factory_; |
92 | 93 |
93 DISALLOW_COPY_AND_ASSIGN(UdpTransport); | 94 DISALLOW_COPY_AND_ASSIGN(UdpTransport); |
94 }; | 95 }; |
95 | 96 |
96 } // namespace cast | 97 } // namespace cast |
97 } // namespace media | 98 } // namespace media |
98 | 99 |
99 #endif // MEDIA_CAST_NET_UDP_TRANSPORT_H_ | 100 #endif // MEDIA_CAST_NET_UDP_TRANSPORT_H_ |
OLD | NEW |