Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1874)

Side by Side Diff: remoting/protocol/rtp_reader.h

Issue 8116021: Switch remoting/protocol to new callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/rtcp_writer.cc ('k') | remoting/protocol/rtp_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/callback.h"
8 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
9 #include "remoting/base/compound_buffer.h" 10 #include "remoting/base/compound_buffer.h"
10 #include "remoting/protocol/rtp_utils.h" 11 #include "remoting/protocol/rtp_utils.h"
11 #include "remoting/protocol/socket_reader_base.h" 12 #include "remoting/protocol/socket_reader_base.h"
12 13
13 namespace remoting { 14 namespace remoting {
14 namespace protocol { 15 namespace protocol {
15 16
16 class RtpPacket { 17 class RtpPacket {
17 public: 18 public:
(...skipping 27 matching lines...) Expand all
45 // socket, parses them, calculates extended sequence number and then 46 // socket, parses them, calculates extended sequence number and then
46 // passes them to a callback. It also collects statistics for RTCP 47 // passes them to a callback. It also collects statistics for RTCP
47 // receiver reports, but doesn't send any RTCP packets itself. 48 // receiver reports, but doesn't send any RTCP packets itself.
48 class RtpReader : public SocketReaderBase { 49 class RtpReader : public SocketReaderBase {
49 public: 50 public:
50 RtpReader(); 51 RtpReader();
51 virtual ~RtpReader(); 52 virtual ~RtpReader();
52 53
53 // The OnMessageCallback is called whenever a new message is received. 54 // The OnMessageCallback is called whenever a new message is received.
54 // Ownership of the message is passed the callback. 55 // Ownership of the message is passed the callback.
55 typedef Callback1<const RtpPacket*>::Type OnMessageCallback; 56 typedef base::Callback<void(const RtpPacket*)> OnMessageCallback;
56 57
57 // Initialize the reader and start reading. Must be called on the thread 58 // Initialize the reader and start reading. Must be called on the thread
58 // |socket| belongs to. The callback will be called when a new message is 59 // |socket| belongs to. The callback will be called when a new message is
59 // received. RtpReader owns |on_message_callback|, doesn't own 60 // received. RtpReader owns |on_message_callback|, doesn't own
60 // |socket|. 61 // |socket|.
61 void Init(net::Socket* socket, OnMessageCallback* on_message_callback); 62 void Init(net::Socket* socket, const OnMessageCallback& on_message_callback);
62 63
63 void GetReceiverReport(RtcpReceiverReport* report); 64 void GetReceiverReport(RtcpReceiverReport* report);
64 65
65 protected: 66 protected:
66 friend class RtpVideoReaderTest; 67 friend class RtpVideoReaderTest;
67 68
68 virtual void OnDataReceived(net::IOBuffer* buffer, int data_size); 69 virtual void OnDataReceived(net::IOBuffer* buffer, int data_size);
69 70
70 private: 71 private:
71 scoped_ptr<OnMessageCallback> on_message_callback_; 72 OnMessageCallback on_message_callback_;
72 73
73 uint16 max_sequence_number_; 74 uint16 max_sequence_number_;
74 uint16 wrap_around_count_; 75 uint16 wrap_around_count_;
75 int start_sequence_number_; 76 int start_sequence_number_;
76 int total_packets_received_; 77 int total_packets_received_;
77 78
78 DISALLOW_COPY_AND_ASSIGN(RtpReader); 79 DISALLOW_COPY_AND_ASSIGN(RtpReader);
79 }; 80 };
80 81
81 } // namespace protocol 82 } // namespace protocol
82 } // namespace remoting 83 } // namespace remoting
83 84
84 85
85 #endif // REMOTING_PROTOCOL_RTP_READER_H_ 86 #endif // REMOTING_PROTOCOL_RTP_READER_H_
OLDNEW
« no previous file with comments | « remoting/protocol/rtcp_writer.cc ('k') | remoting/protocol/rtp_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698