OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 MEDIA_CAST_RTCP_RTCP_H_ | 5 #ifndef MEDIA_CAST_RTCP_RTCP_H_ |
6 #define MEDIA_CAST_RTCP_RTCP_H_ | 6 #define MEDIA_CAST_RTCP_RTCP_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <queue> | 10 #include <queue> |
(...skipping 21 matching lines...) Expand all Loading... |
32 typedef std::map<uint32, base::TimeTicks> RtcpSendTimeMap; | 32 typedef std::map<uint32, base::TimeTicks> RtcpSendTimeMap; |
33 typedef std::queue<RtcpSendTimePair> RtcpSendTimeQueue; | 33 typedef std::queue<RtcpSendTimePair> RtcpSendTimeQueue; |
34 | 34 |
35 class RtcpSenderFeedback { | 35 class RtcpSenderFeedback { |
36 public: | 36 public: |
37 virtual void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback) = 0; | 37 virtual void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback) = 0; |
38 | 38 |
39 virtual ~RtcpSenderFeedback() {} | 39 virtual ~RtcpSenderFeedback() {} |
40 }; | 40 }; |
41 | 41 |
| 42 class RtcpReceivedLog { |
| 43 public: |
| 44 virtual void OnReceivedReceiverLog( |
| 45 const RtcpReceiverLogMessage& receiver_log) = 0; |
| 46 |
| 47 virtual void OnReceivedSenderLog( |
| 48 const RtcpSenderLogMessage& sender_log) = 0; |
| 49 |
| 50 virtual ~RtcpReceivedLog() {} |
| 51 }; |
| 52 |
42 class RtpSenderStatistics { | 53 class RtpSenderStatistics { |
43 public: | 54 public: |
44 virtual void GetStatistics(const base::TimeTicks& now, | 55 virtual void GetStatistics(const base::TimeTicks& now, |
45 RtcpSenderInfo* sender_info) = 0; | 56 RtcpSenderInfo* sender_info) = 0; |
46 | 57 |
47 virtual ~RtpSenderStatistics() {} | 58 virtual ~RtpSenderStatistics() {} |
48 }; | 59 }; |
49 | 60 |
50 class RtpReceiverStatistics { | 61 class RtpReceiverStatistics { |
51 public: | 62 public: |
52 virtual void GetStatistics(uint8* fraction_lost, | 63 virtual void GetStatistics(uint8* fraction_lost, |
53 uint32* cumulative_lost, // 24 bits valid. | 64 uint32* cumulative_lost, // 24 bits valid. |
54 uint32* extended_high_sequence_number, | 65 uint32* extended_high_sequence_number, |
55 uint32* jitter) = 0; | 66 uint32* jitter) = 0; |
56 | 67 |
57 virtual ~RtpReceiverStatistics() {} | 68 virtual ~RtpReceiverStatistics() {} |
58 }; | 69 }; |
59 | 70 |
60 class Rtcp { | 71 class Rtcp { |
61 public: | 72 public: |
62 Rtcp(base::TickClock* clock, | 73 Rtcp(base::TickClock* clock, |
63 RtcpSenderFeedback* sender_feedback, | 74 RtcpSenderFeedback* sender_feedback, |
64 PacedPacketSender* paced_packet_sender, | 75 PacedPacketSender* paced_packet_sender, |
65 RtpSenderStatistics* rtp_sender_statistics, | 76 RtpSenderStatistics* rtp_sender_statistics, |
66 RtpReceiverStatistics* rtp_receiver_statistics, | 77 RtpReceiverStatistics* rtp_receiver_statistics, |
67 RtcpMode rtcp_mode, | 78 RtcpMode rtcp_mode, |
68 const base::TimeDelta& rtcp_interval, | 79 const base::TimeDelta& rtcp_interval, |
69 bool sending_media, | |
70 uint32 local_ssrc, | 80 uint32 local_ssrc, |
| 81 uint32 remote_ssrc, |
71 const std::string& c_name); | 82 const std::string& c_name); |
72 | 83 |
73 virtual ~Rtcp(); | 84 virtual ~Rtcp(); |
74 | 85 |
75 static bool IsRtcpPacket(const uint8* rtcp_buffer, size_t length); | 86 static bool IsRtcpPacket(const uint8* rtcp_buffer, size_t length); |
76 | 87 |
77 static uint32 GetSsrcOfSender(const uint8* rtcp_buffer, size_t length); | 88 static uint32 GetSsrcOfSender(const uint8* rtcp_buffer, size_t length); |
78 | 89 |
79 base::TimeTicks TimeToSendNextRtcpReport(); | 90 base::TimeTicks TimeToSendNextRtcpReport(); |
80 void SendRtcpReport(uint32 media_ssrc); | 91 // |sender_log_message| is optional; without it no log messages will be |
81 void SendRtcpPli(uint32 media_ssrc); | 92 // attached to the RTCP report; instead a normal RTCP send report will be |
82 void SendRtcpCast(const RtcpCastMessage& cast_message); | 93 // sent. |
83 void SetRemoteSSRC(uint32 ssrc); | 94 void SendRtcpFromRtpSender(const RtcpSenderLogMessage* sender_log_message); |
| 95 |
| 96 // |cast_message| and |receiver_log| is optional; if |cast_message| is |
| 97 // provided the RTCP receiver report will append a Cast message containing |
| 98 // Acks and Nacks; if |receiver_log| is provided the RTCP receiver report will |
| 99 // append the log messages. If no argument is set a normal RTCP receiver |
| 100 // report will be sent. |
| 101 void SendRtcpFromRtpReceiver(const RtcpCastMessage* cast_message, |
| 102 const RtcpReceiverLogMessage* receiver_log); |
84 | 103 |
85 void IncomingRtcpPacket(const uint8* rtcp_buffer, size_t length); | 104 void IncomingRtcpPacket(const uint8* rtcp_buffer, size_t length); |
86 bool Rtt(base::TimeDelta* rtt, base::TimeDelta* avg_rtt, | 105 bool Rtt(base::TimeDelta* rtt, base::TimeDelta* avg_rtt, |
87 base::TimeDelta* min_rtt, base::TimeDelta* max_rtt) const; | 106 base::TimeDelta* min_rtt, base::TimeDelta* max_rtt) const; |
88 bool RtpTimestampInSenderTime(int frequency, | 107 bool RtpTimestampInSenderTime(int frequency, |
89 uint32 rtp_timestamp, | 108 uint32 rtp_timestamp, |
90 base::TimeTicks* rtp_timestamp_in_ticks) const; | 109 base::TimeTicks* rtp_timestamp_in_ticks) const; |
91 | 110 |
92 protected: | 111 protected: |
93 int CheckForWrapAround(uint32 new_timestamp, | 112 int CheckForWrapAround(uint32 new_timestamp, |
(...skipping 24 matching lines...) Expand all Loading... |
118 const base::TimeDelta& receiver_delay); | 137 const base::TimeDelta& receiver_delay); |
119 | 138 |
120 void UpdateNextTimeToSendRtcp(); | 139 void UpdateNextTimeToSendRtcp(); |
121 | 140 |
122 void SaveLastSentNtpTime(const base::TimeTicks& now, uint32 last_ntp_seconds, | 141 void SaveLastSentNtpTime(const base::TimeTicks& now, uint32 last_ntp_seconds, |
123 uint32 last_ntp_fraction); | 142 uint32 last_ntp_fraction); |
124 | 143 |
125 base::TickClock* const clock_; // Not owned by this class. | 144 base::TickClock* const clock_; // Not owned by this class. |
126 const base::TimeDelta rtcp_interval_; | 145 const base::TimeDelta rtcp_interval_; |
127 const RtcpMode rtcp_mode_; | 146 const RtcpMode rtcp_mode_; |
128 const bool sending_media_; | |
129 const uint32 local_ssrc_; | 147 const uint32 local_ssrc_; |
| 148 const uint32 remote_ssrc_; |
130 | 149 |
131 // Not owned by this class. | 150 // Not owned by this class. |
132 RtpSenderStatistics* const rtp_sender_statistics_; | 151 RtpSenderStatistics* const rtp_sender_statistics_; |
133 RtpReceiverStatistics* const rtp_receiver_statistics_; | 152 RtpReceiverStatistics* const rtp_receiver_statistics_; |
134 | 153 |
135 scoped_ptr<LocalRtcpRttFeedback> rtt_feedback_; | 154 scoped_ptr<LocalRtcpRttFeedback> rtt_feedback_; |
136 scoped_ptr<LocalRtcpReceiverFeedback> receiver_feedback_; | 155 scoped_ptr<LocalRtcpReceiverFeedback> receiver_feedback_; |
137 scoped_ptr<RtcpSender> rtcp_sender_; | 156 scoped_ptr<RtcpSender> rtcp_sender_; |
138 scoped_ptr<RtcpReceiver> rtcp_receiver_; | 157 scoped_ptr<RtcpReceiver> rtcp_receiver_; |
139 | 158 |
(...skipping 13 matching lines...) Expand all Loading... |
153 int number_of_rtt_in_avg_; | 172 int number_of_rtt_in_avg_; |
154 float avg_rtt_ms_; | 173 float avg_rtt_ms_; |
155 | 174 |
156 DISALLOW_COPY_AND_ASSIGN(Rtcp); | 175 DISALLOW_COPY_AND_ASSIGN(Rtcp); |
157 }; | 176 }; |
158 | 177 |
159 } // namespace cast | 178 } // namespace cast |
160 } // namespace media | 179 } // namespace media |
161 | 180 |
162 #endif // MEDIA_CAST_RTCP_RTCP_H_ | 181 #endif // MEDIA_CAST_RTCP_RTCP_H_ |
OLD | NEW |