| 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_READER_H_ | 5 #ifndef REMOTING_PROTOCOL_RTP_READER_H_ |
| 6 #define REMOTING_PROTOCOL_RTP_READER_H_ | 6 #define REMOTING_PROTOCOL_RTP_READER_H_ |
| 7 | 7 |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "remoting/protocol/rtp_utils.h" | 9 #include "remoting/protocol/rtp_utils.h" |
| 10 #include "remoting/protocol/socket_reader_base.h" | 10 #include "remoting/protocol/socket_reader_base.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 int payload_size; | 21 int payload_size; |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 class RtpReader : public SocketReaderBase { | 24 class RtpReader : public SocketReaderBase { |
| 25 public: | 25 public: |
| 26 RtpReader(); | 26 RtpReader(); |
| 27 ~RtpReader(); | 27 ~RtpReader(); |
| 28 | 28 |
| 29 // The OnMessageCallback is called whenever a new message is received. | 29 // The OnMessageCallback is called whenever a new message is received. |
| 30 // Ownership of the message is passed the callback. | 30 // Ownership of the message is passed the callback. |
| 31 typedef Callback1<RtpPacket*>::Type OnMessageCallback; | 31 typedef Callback1<const RtpPacket&>::Type OnMessageCallback; |
| 32 | 32 |
| 33 // Initialize the reader and start reading. Must be called on the thread | 33 // Initialize the reader and start reading. Must be called on the thread |
| 34 // |socket| belongs to. The callback will be called when a new message is | 34 // |socket| belongs to. The callback will be called when a new message is |
| 35 // received. RtpReader owns |on_message_callback|, doesn't own | 35 // received. RtpReader owns |on_message_callback|, doesn't own |
| 36 // |socket|. | 36 // |socket|. |
| 37 void Init(net::Socket* socket, OnMessageCallback* on_message_callback); | 37 void Init(net::Socket* socket, OnMessageCallback* on_message_callback); |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 virtual void OnDataReceived(net::IOBuffer* buffer, int data_size); | 40 virtual void OnDataReceived(net::IOBuffer* buffer, int data_size); |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 scoped_ptr<OnMessageCallback> on_message_callback_; | 43 scoped_ptr<OnMessageCallback> on_message_callback_; |
| 44 | 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(RtpReader); | 45 DISALLOW_COPY_AND_ASSIGN(RtpReader); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace remoting | 48 } // namespace remoting |
| 49 | 49 |
| 50 | 50 |
| 51 #endif // REMOTING_PROTOCOL_RTP_READER_H_ | 51 #endif // REMOTING_PROTOCOL_RTP_READER_H_ |
| OLD | NEW |