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

Side by Side Diff: media/cast/net/rtcp/rtcp.h

Issue 532373003: [Cast] RTT clean-up to the max! (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove RTT accessors in FrameSender (not needed post-refactor). Created 6 years, 3 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
« no previous file with comments | « media/cast/net/cast_transport_sender_impl.cc ('k') | media/cast/net/rtcp/rtcp.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // This class maintains a bi-directional RTCP connection with a remote 5 // This class maintains a bi-directional RTCP connection with a remote
6 // peer. 6 // peer.
7 7
8 #ifndef MEDIA_CAST_RTCP_RTCP_H_ 8 #ifndef MEDIA_CAST_RTCP_RTCP_H_
9 #define MEDIA_CAST_RTCP_RTCP_H_ 9 #define MEDIA_CAST_RTCP_RTCP_H_
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 base::TimeDelta target_delay, 82 base::TimeDelta target_delay,
83 const ReceiverRtcpEventSubscriber::RtcpEventMultiMap* rtcp_events, 83 const ReceiverRtcpEventSubscriber::RtcpEventMultiMap* rtcp_events,
84 RtpReceiverStatistics* rtp_receiver_statistics); 84 RtpReceiverStatistics* rtp_receiver_statistics);
85 85
86 // Submit a received packet to this object. The packet will be parsed 86 // Submit a received packet to this object. The packet will be parsed
87 // and used to maintain a RTCP session. 87 // and used to maintain a RTCP session.
88 // Returns false if this is not a RTCP packet or it is not directed to 88 // Returns false if this is not a RTCP packet or it is not directed to
89 // this session, e.g. SSRC doesn't match. 89 // this session, e.g. SSRC doesn't match.
90 bool IncomingRtcpPacket(const uint8* data, size_t length); 90 bool IncomingRtcpPacket(const uint8* data, size_t length);
91 91
92 // TODO(miu): Clean up this method and downstream code: Only VideoSender uses
93 // this (for congestion control), and only the |rtt| and |avg_rtt| values, and
94 // it's not clear that any of the downstream code is doing the right thing
95 // with this data.
96 bool Rtt(base::TimeDelta* rtt,
97 base::TimeDelta* avg_rtt,
98 base::TimeDelta* min_rtt,
99 base::TimeDelta* max_rtt) const;
100
101 // If available, returns true and sets the output arguments to the latest 92 // If available, returns true and sets the output arguments to the latest
102 // lip-sync timestamps gleaned from the sender reports. While the sender 93 // lip-sync timestamps gleaned from the sender reports. While the sender
103 // provides reference NTP times relative to its own wall clock, the 94 // provides reference NTP times relative to its own wall clock, the
104 // |reference_time| returned here has been translated to the local 95 // |reference_time| returned here has been translated to the local
105 // CastEnvironment clock. 96 // CastEnvironment clock.
106 bool GetLatestLipSyncTimes(uint32* rtp_timestamp, 97 bool GetLatestLipSyncTimes(uint32* rtp_timestamp,
107 base::TimeTicks* reference_time) const; 98 base::TimeTicks* reference_time) const;
108 99
109 void OnReceivedReceiverLog(const RtcpReceiverLogMessage& receiver_log); 100 void OnReceivedReceiverLog(const RtcpReceiverLogMessage& receiver_log);
110 101
102 // If greater than zero, this is the last measured network round trip time.
103 base::TimeDelta current_round_trip_time() const {
104 return current_round_trip_time_;
105 }
106
111 static bool IsRtcpPacket(const uint8* packet, size_t length); 107 static bool IsRtcpPacket(const uint8* packet, size_t length);
112 static uint32 GetSsrcOfSender(const uint8* rtcp_buffer, size_t length); 108 static uint32 GetSsrcOfSender(const uint8* rtcp_buffer, size_t length);
113 const base::TimeDelta& rtt() const { return rtt_; }
114 109
115 protected: 110 protected:
116 void OnReceivedNtp(uint32 ntp_seconds, uint32 ntp_fraction); 111 void OnReceivedNtp(uint32 ntp_seconds, uint32 ntp_fraction);
117 void OnReceivedLipSyncInfo(uint32 rtp_timestamp, 112 void OnReceivedLipSyncInfo(uint32 rtp_timestamp,
118 uint32 ntp_seconds, 113 uint32 ntp_seconds,
119 uint32 ntp_fraction); 114 uint32 ntp_fraction);
120 115
121 private: 116 private:
122 void OnReceivedDelaySinceLastReport(uint32 last_report, 117 void OnReceivedDelaySinceLastReport(uint32 last_report,
123 uint32 delay_since_last_report); 118 uint32 delay_since_last_report);
124 119
125 void OnReceivedCastFeedback(const RtcpCastMessage& cast_message); 120 void OnReceivedCastFeedback(const RtcpCastMessage& cast_message);
126 121
127 void UpdateRtt(const base::TimeDelta& sender_delay,
128 const base::TimeDelta& receiver_delay);
129
130 void SaveLastSentNtpTime(const base::TimeTicks& now, 122 void SaveLastSentNtpTime(const base::TimeTicks& now,
131 uint32 last_ntp_seconds, 123 uint32 last_ntp_seconds,
132 uint32 last_ntp_fraction); 124 uint32 last_ntp_fraction);
133 125
134 // Remove duplicate events in |receiver_log|. 126 // Remove duplicate events in |receiver_log|.
135 // Returns true if any events remain. 127 // Returns true if any events remain.
136 bool DedupeReceiverLog(RtcpReceiverLogMessage* receiver_log); 128 bool DedupeReceiverLog(RtcpReceiverLogMessage* receiver_log);
137 129
138 const RtcpCastMessageCallback cast_callback_; 130 const RtcpCastMessageCallback cast_callback_;
139 const RtcpRttCallback rtt_callback_; 131 const RtcpRttCallback rtt_callback_;
(...skipping 20 matching lines...) Expand all
160 ClockDriftSmoother local_clock_ahead_by_; 152 ClockDriftSmoother local_clock_ahead_by_;
161 153
162 // Latest "lip sync" info from the sender. The sender provides the RTP 154 // Latest "lip sync" info from the sender. The sender provides the RTP
163 // timestamp of some frame of its choosing and also a corresponding reference 155 // timestamp of some frame of its choosing and also a corresponding reference
164 // NTP timestamp sampled from a clock common to all media streams. It is 156 // NTP timestamp sampled from a clock common to all media streams. It is
165 // expected that the sender will update this data regularly and in a timely 157 // expected that the sender will update this data regularly and in a timely
166 // manner (e.g., about once per second). 158 // manner (e.g., about once per second).
167 uint32 lip_sync_rtp_timestamp_; 159 uint32 lip_sync_rtp_timestamp_;
168 uint64 lip_sync_ntp_timestamp_; 160 uint64 lip_sync_ntp_timestamp_;
169 161
170 base::TimeDelta rtt_; 162 // The last measured network round trip time. This is updated with each
171 base::TimeDelta min_rtt_; 163 // sender report --> receiver report round trip. If this is zero, then the
172 base::TimeDelta max_rtt_; 164 // round trip time has not been measured yet.
173 int number_of_rtt_in_avg_; 165 base::TimeDelta current_round_trip_time_;
174 base::TimeDelta avg_rtt_;
175 166
176 base::TimeTicks largest_seen_timestamp_; 167 base::TimeTicks largest_seen_timestamp_;
177 168
178 // For extending received ACK frame IDs from 8-bit to 32-bit. 169 // For extending received ACK frame IDs from 8-bit to 32-bit.
179 FrameIdWrapHelper ack_frame_id_wrap_helper_; 170 FrameIdWrapHelper ack_frame_id_wrap_helper_;
180 171
181 // Maintains a history of receiver events. 172 // Maintains a history of receiver events.
182 typedef std::pair<uint64, uint64> ReceiverEventKey; 173 typedef std::pair<uint64, uint64> ReceiverEventKey;
183 base::hash_set<ReceiverEventKey> receiver_event_key_set_; 174 base::hash_set<ReceiverEventKey> receiver_event_key_set_;
184 std::queue<ReceiverEventKey> receiver_event_key_queue_; 175 std::queue<ReceiverEventKey> receiver_event_key_queue_;
185 176
186 DISALLOW_COPY_AND_ASSIGN(Rtcp); 177 DISALLOW_COPY_AND_ASSIGN(Rtcp);
187 }; 178 };
188 179
189 } // namespace cast 180 } // namespace cast
190 } // namespace media 181 } // namespace media
191 182
192 #endif // MEDIA_CAST_RTCP_RTCP_H_ 183 #endif // MEDIA_CAST_RTCP_RTCP_H_
OLDNEW
« no previous file with comments | « media/cast/net/cast_transport_sender_impl.cc ('k') | media/cast/net/rtcp/rtcp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698