OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 REMOTING_PROTOCOL_RTP_WRITER_H_ | 5 #ifndef REMOTING_PROTOCOL_RTP_WRITER_H_ |
6 #define REMOTING_PROTOCOL_RTP_WRITER_H_ | 6 #define REMOTING_PROTOCOL_RTP_WRITER_H_ |
7 | 7 |
8 #include "net/socket/socket.h" | 8 #include "net/socket/socket.h" |
9 #include "remoting/protocol/buffered_socket_writer.h" | 9 #include "remoting/protocol/buffered_socket_writer.h" |
10 | 10 |
11 namespace remoting { | 11 namespace remoting { |
12 | 12 |
13 class RtpWriter { | 13 class RtpWriter { |
14 public: | 14 public: |
15 RtpWriter(); | 15 RtpWriter(); |
16 virtual ~RtpWriter(); | 16 virtual ~RtpWriter(); |
17 | 17 |
18 // Initializes the writer. Must be called on the thread the sockets belong | 18 // Initializes the writer. Must be called on the thread the sockets belong |
19 // to. | 19 // to. |
20 void Init(net::Socket* rtp_socket, net::Socket* rtcp_socket); | 20 void Init(net::Socket* rtp_socket, net::Socket* rtcp_socket); |
21 | 21 |
22 void SendPacket(const char* buffer, int packet_size, | 22 // Sends next packet. |
23 uint32 timestamp); | 23 void SendPacket(const char* payload, int payload_size, uint32 timestamp); |
| 24 |
| 25 // Returns number of packets queued in the buffer. |
| 26 int GetPendingPackets(); |
24 | 27 |
25 // Stop writing and drop pending data. Must be called from the same thread as | 28 // Stop writing and drop pending data. Must be called from the same thread as |
26 // Init(). | 29 // Init(). |
27 void Close(); | 30 void Close(); |
28 | 31 |
29 private: | 32 private: |
30 net::Socket* rtp_socket_; | 33 net::Socket* rtp_socket_; |
31 net::Socket* rtcp_socket_; | 34 net::Socket* rtcp_socket_; |
32 | 35 |
33 uint32 last_packet_number_; | 36 uint32 last_packet_number_; |
34 | 37 |
35 scoped_refptr<BufferedDatagramWriter> buffered_rtp_writer_; | 38 scoped_refptr<BufferedDatagramWriter> buffered_rtp_writer_; |
36 }; | 39 }; |
37 | 40 |
38 } // namespace remoting | 41 } // namespace remoting |
39 | 42 |
40 #endif // REMOTING_PROTOCOL_RTP_WRITER_H_ | 43 #endif // REMOTING_PROTOCOL_RTP_WRITER_H_ |
OLD | NEW |