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

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

Issue 7508044: Remove video_channel() from Session interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 4 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
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_VIDEO_READER_H_ 5 #ifndef REMOTING_PROTOCOL_RTP_VIDEO_READER_H_
6 #define REMOTING_PROTOCOL_RTP_VIDEO_READER_H_ 6 #define REMOTING_PROTOCOL_RTP_VIDEO_READER_H_
7 7
8 #include "base/compiler_specific.h"
8 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/memory/scoped_ptr.h"
9 #include "remoting/protocol/rtcp_writer.h" 11 #include "remoting/protocol/rtcp_writer.h"
10 #include "remoting/protocol/rtp_reader.h" 12 #include "remoting/protocol/rtp_reader.h"
11 #include "remoting/protocol/video_reader.h" 13 #include "remoting/protocol/video_reader.h"
12 14
13 namespace remoting { 15 namespace remoting {
14 namespace protocol { 16 namespace protocol {
15 17
18 class RtcpWriter;
19 class RtpReader;
16 class Session; 20 class Session;
17 21
18 class RtpVideoReader : public VideoReader { 22 class RtpVideoReader : public VideoReader {
19 public: 23 public:
20 RtpVideoReader(); 24 RtpVideoReader();
21 virtual ~RtpVideoReader(); 25 virtual ~RtpVideoReader();
22 26
23 // VideoReader interface. 27 // VideoReader interface.
24 virtual void Init(protocol::Session* session, VideoStub* video_stub); 28 virtual void Init(protocol::Session* session,
29 VideoStub* video_stub,
30 const InitializedCallback& callback) OVERRIDE;
25 31
26 private: 32 private:
27 friend class RtpVideoReaderTest; 33 friend class RtpVideoReaderTest;
28 34
29 // Following struct is used to store pending packets in |packets_queue_|. 35 // Following struct is used to store pending packets in |packets_queue_|.
30 // Each entry may be in three different states: 36 // Each entry may be in three different states:
31 // |received| == false, |packet| == NULL - packet with the corresponding 37 // |received| == false, |packet| == NULL - packet with the corresponding
32 // sequence number hasn't been received. 38 // sequence number hasn't been received.
33 // |received| == true, |packet| != NULL - packet with the corresponding 39 // |received| == true, |packet| != NULL - packet with the corresponding
34 // sequence number has been received, but hasn't been processed, still 40 // sequence number has been received, but hasn't been processed, still
35 // waiting for other fragments. 41 // waiting for other fragments.
36 // |received| == true, |packet| == NULL - packet with the corresponding 42 // |received| == true, |packet| == NULL - packet with the corresponding
37 // sequence number has been received and processed. Ignore any additional 43 // sequence number has been received and processed. Ignore any additional
38 // packet with the same sequence number. 44 // packet with the same sequence number.
39 struct PacketsQueueEntry { 45 struct PacketsQueueEntry {
40 PacketsQueueEntry(); 46 PacketsQueueEntry();
41 bool received; 47 bool received;
42 const RtpPacket* packet; 48 const RtpPacket* packet;
43 }; 49 };
44 50
45 typedef std::deque<PacketsQueueEntry> PacketsQueue; 51 typedef std::deque<PacketsQueueEntry> PacketsQueue;
46 52
53 void OnChannelReady(const std::string& name, net::Socket* socket);
54
47 void OnRtpPacket(const RtpPacket* rtp_packet); 55 void OnRtpPacket(const RtpPacket* rtp_packet);
48 void CheckFullPacket(const PacketsQueue::iterator& pos); 56 void CheckFullPacket(const PacketsQueue::iterator& pos);
49 void RebuildVideoPacket(const PacketsQueue::iterator& from, 57 void RebuildVideoPacket(const PacketsQueue::iterator& from,
50 const PacketsQueue::iterator& to); 58 const PacketsQueue::iterator& to);
51 void ResetQueue(); 59 void ResetQueue();
52 60
53 // Helper method that sends RTCP receiver reports if enough time has 61 // Helper method that sends RTCP receiver reports if enough time has
54 // passed since the last report. It is called from 62 // passed since the last report. It is called from
55 // OnRtpPacket(). Interval between reports is defined by 63 // OnRtpPacket(). Interval between reports is defined by
56 // |kReceiverReportsIntervalMs|. 64 // |kReceiverReportsIntervalMs|.
57 void SendReceiverReportIf(); 65 void SendReceiverReportIf();
58 66
67 bool initialized_;
68 InitializedCallback initialized_callback_;
69
70 scoped_ptr<net::Socket> rtp_channel_;
59 RtpReader rtp_reader_; 71 RtpReader rtp_reader_;
72 scoped_ptr<net::Socket> rtcp_channel_;
60 RtcpWriter rtcp_writer_; 73 RtcpWriter rtcp_writer_;
61 74
62 PacketsQueue packets_queue_; 75 PacketsQueue packets_queue_;
63 uint32 last_sequence_number_; 76 uint32 last_sequence_number_;
64 77
65 base::Time last_receiver_report_; 78 base::Time last_receiver_report_;
66 79
67 // The stub that processes all received packets. 80 // The stub that processes all received packets.
68 VideoStub* video_stub_; 81 VideoStub* video_stub_;
69 82
70 DISALLOW_COPY_AND_ASSIGN(RtpVideoReader); 83 DISALLOW_COPY_AND_ASSIGN(RtpVideoReader);
71 }; 84 };
72 85
73 } // namespace protocol 86 } // namespace protocol
74 } // namespace remoting 87 } // namespace remoting
75 88
76 #endif // REMOTING_PROTOCOL_RTP_VIDEO_READER_H_ 89 #endif // REMOTING_PROTOCOL_RTP_VIDEO_READER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698