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 |
| 13 class CompoundBuffer; |
| 14 |
12 namespace protocol { | 15 namespace protocol { |
13 | 16 |
14 class RtpWriter { | 17 class RtpWriter { |
15 public: | 18 public: |
16 RtpWriter(); | 19 RtpWriter(); |
17 virtual ~RtpWriter(); | 20 virtual ~RtpWriter(); |
18 | 21 |
19 // Initializes the writer. Must be called on the thread the sockets belong | 22 // Initializes the writer. Must be called on the thread the sockets belong |
20 // to. | 23 // to. |
21 void Init(net::Socket* rtp_socket, net::Socket* rtcp_socket); | 24 void Init(net::Socket* rtp_socket, net::Socket* rtcp_socket); |
22 | 25 |
23 // Sends next packet. | 26 // Sends next packet. |
24 void SendPacket(const char* payload, int payload_size, uint32 timestamp); | 27 void SendPacket(const CompoundBuffer& payload, uint32 timestamp); |
25 | 28 |
26 // Returns number of packets queued in the buffer. | 29 // Returns number of packets queued in the buffer. |
27 int GetPendingPackets(); | 30 int GetPendingPackets(); |
28 | 31 |
29 // Stop writing and drop pending data. Must be called from the same thread as | 32 // Stop writing and drop pending data. Must be called from the same thread as |
30 // Init(). | 33 // Init(). |
31 void Close(); | 34 void Close(); |
32 | 35 |
33 private: | 36 private: |
34 net::Socket* rtp_socket_; | 37 net::Socket* rtp_socket_; |
35 net::Socket* rtcp_socket_; | 38 net::Socket* rtcp_socket_; |
36 | 39 |
37 uint32 last_packet_number_; | 40 uint32 last_packet_number_; |
38 | 41 |
39 scoped_refptr<BufferedDatagramWriter> buffered_rtp_writer_; | 42 scoped_refptr<BufferedDatagramWriter> buffered_rtp_writer_; |
40 }; | 43 }; |
41 | 44 |
42 } // namespace protocol | 45 } // namespace protocol |
43 } // namespace remoting | 46 } // namespace remoting |
44 | 47 |
45 #endif // REMOTING_PROTOCOL_RTP_WRITER_H_ | 48 #endif // REMOTING_PROTOCOL_RTP_WRITER_H_ |
OLD | NEW |