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

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

Issue 1472083005: Remove kint64min. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint5
Patch Set: rebase Created 5 years 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/rtcp/rtcp.h ('k') | media/cdm/ppapi/external_clear_key/clear_key_cdm.h » ('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 #include "media/cast/net/rtcp/rtcp.h" 5 #include "media/cast/net/rtcp/rtcp.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "media/cast/cast_environment.h" 10 #include "media/cast/cast_environment.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 delay_us >>= 16; 49 delay_us >>= 16;
50 delay_us += 50 delay_us +=
51 ((ntp_delay & 0xffff0000) >> 16) * base::Time::kMicrosecondsPerSecond; 51 ((ntp_delay & 0xffff0000) >> 16) * base::Time::kMicrosecondsPerSecond;
52 return base::TimeDelta::FromMicroseconds(delay_us); 52 return base::TimeDelta::FromMicroseconds(delay_us);
53 } 53 }
54 54
55 // A receiver frame event is identified by frame RTP timestamp, event timestamp 55 // A receiver frame event is identified by frame RTP timestamp, event timestamp
56 // and event type. 56 // and event type.
57 // A receiver packet event is identified by all of the above plus packet id. 57 // A receiver packet event is identified by all of the above plus packet id.
58 // The key format is as follows: 58 // The key format is as follows:
59 // First uint64: 59 // First uint64_t:
60 // bits 0-11: zeroes (unused). 60 // bits 0-11: zeroes (unused).
61 // bits 12-15: event type ID. 61 // bits 12-15: event type ID.
62 // bits 16-31: packet ID if packet event, 0 otherwise. 62 // bits 16-31: packet ID if packet event, 0 otherwise.
63 // bits 32-63: RTP timestamp. 63 // bits 32-63: RTP timestamp.
64 // Second uint64: 64 // Second uint64_t:
65 // bits 0-63: event TimeTicks internal value. 65 // bits 0-63: event TimeTicks internal value.
66 std::pair<uint64, uint64> GetReceiverEventKey( 66 std::pair<uint64_t, uint64_t> GetReceiverEventKey(
67 uint32 frame_rtp_timestamp, 67 uint32_t frame_rtp_timestamp,
68 const base::TimeTicks& event_timestamp, 68 const base::TimeTicks& event_timestamp,
69 uint8 event_type, 69 uint8_t event_type,
70 uint16 packet_id_or_zero) { 70 uint16_t packet_id_or_zero) {
71 uint64 value1 = event_type; 71 uint64_t value1 = event_type;
72 value1 <<= 16; 72 value1 <<= 16;
73 value1 |= packet_id_or_zero; 73 value1 |= packet_id_or_zero;
74 value1 <<= 32; 74 value1 <<= 32;
75 value1 |= frame_rtp_timestamp; 75 value1 |= frame_rtp_timestamp;
76 return std::make_pair( 76 return std::make_pair(
77 value1, static_cast<uint64>(event_timestamp.ToInternalValue())); 77 value1, static_cast<uint64_t>(event_timestamp.ToInternalValue()));
78 } 78 }
79 79
80 } // namespace 80 } // namespace
81 81
82 Rtcp::Rtcp(const RtcpCastMessageCallback& cast_callback, 82 Rtcp::Rtcp(const RtcpCastMessageCallback& cast_callback,
83 const RtcpRttCallback& rtt_callback, 83 const RtcpRttCallback& rtt_callback,
84 const RtcpLogMessageCallback& log_callback, 84 const RtcpLogMessageCallback& log_callback,
85 base::TickClock* clock, 85 base::TickClock* clock,
86 PacedPacketSender* packet_sender, 86 PacedPacketSender* packet_sender,
87 uint32 local_ssrc, 87 uint32_t local_ssrc,
88 uint32 remote_ssrc) 88 uint32_t remote_ssrc)
89 : cast_callback_(cast_callback), 89 : cast_callback_(cast_callback),
90 rtt_callback_(rtt_callback), 90 rtt_callback_(rtt_callback),
91 log_callback_(log_callback), 91 log_callback_(log_callback),
92 clock_(clock), 92 clock_(clock),
93 rtcp_builder_(local_ssrc), 93 rtcp_builder_(local_ssrc),
94 packet_sender_(packet_sender), 94 packet_sender_(packet_sender),
95 local_ssrc_(local_ssrc), 95 local_ssrc_(local_ssrc),
96 remote_ssrc_(remote_ssrc), 96 remote_ssrc_(remote_ssrc),
97 last_report_truncated_ntp_(0), 97 last_report_truncated_ntp_(0),
98 local_clock_ahead_by_(ClockDriftSmoother::GetDefaultTimeConstant()), 98 local_clock_ahead_by_(ClockDriftSmoother::GetDefaultTimeConstant()),
99 lip_sync_rtp_timestamp_(0), 99 lip_sync_rtp_timestamp_(0),
100 lip_sync_ntp_timestamp_(0), 100 lip_sync_ntp_timestamp_(0),
101 largest_seen_timestamp_(base::TimeTicks::FromInternalValue( 101 largest_seen_timestamp_(base::TimeTicks::FromInternalValue(
102 std::numeric_limits<int64_t>::min())), 102 std::numeric_limits<int64_t>::min())),
103 ack_frame_id_wrap_helper_(kFirstFrameId - 1) {} 103 ack_frame_id_wrap_helper_(kFirstFrameId - 1) {}
104 104
105 Rtcp::~Rtcp() {} 105 Rtcp::~Rtcp() {}
106 106
107 bool Rtcp::IsRtcpPacket(const uint8* packet, size_t length) { 107 bool Rtcp::IsRtcpPacket(const uint8_t* packet, size_t length) {
108 if (length < kMinLengthOfRtcp) { 108 if (length < kMinLengthOfRtcp) {
109 LOG(ERROR) << "Invalid RTCP packet received."; 109 LOG(ERROR) << "Invalid RTCP packet received.";
110 return false; 110 return false;
111 } 111 }
112 112
113 uint8 packet_type = packet[1]; 113 uint8_t packet_type = packet[1];
114 return packet_type >= kPacketTypeLow && packet_type <= kPacketTypeHigh; 114 return packet_type >= kPacketTypeLow && packet_type <= kPacketTypeHigh;
115 } 115 }
116 116
117 uint32 Rtcp::GetSsrcOfSender(const uint8* rtcp_buffer, size_t length) { 117 uint32_t Rtcp::GetSsrcOfSender(const uint8_t* rtcp_buffer, size_t length) {
118 if (length < kMinLengthOfRtcp) 118 if (length < kMinLengthOfRtcp)
119 return 0; 119 return 0;
120 uint32 ssrc_of_sender; 120 uint32_t ssrc_of_sender;
121 base::BigEndianReader big_endian_reader( 121 base::BigEndianReader big_endian_reader(
122 reinterpret_cast<const char*>(rtcp_buffer), length); 122 reinterpret_cast<const char*>(rtcp_buffer), length);
123 big_endian_reader.Skip(4); // Skip header. 123 big_endian_reader.Skip(4); // Skip header.
124 big_endian_reader.ReadU32(&ssrc_of_sender); 124 big_endian_reader.ReadU32(&ssrc_of_sender);
125 return ssrc_of_sender; 125 return ssrc_of_sender;
126 } 126 }
127 127
128 bool Rtcp::IncomingRtcpPacket(const uint8* data, size_t length) { 128 bool Rtcp::IncomingRtcpPacket(const uint8_t* data, size_t length) {
129 // Check if this is a valid RTCP packet. 129 // Check if this is a valid RTCP packet.
130 if (!IsRtcpPacket(data, length)) { 130 if (!IsRtcpPacket(data, length)) {
131 VLOG(1) << "Rtcp@" << this << "::IncomingRtcpPacket() -- " 131 VLOG(1) << "Rtcp@" << this << "::IncomingRtcpPacket() -- "
132 << "Received an invalid (non-RTCP?) packet."; 132 << "Received an invalid (non-RTCP?) packet.";
133 return false; 133 return false;
134 } 134 }
135 135
136 // Check if this packet is to us. 136 // Check if this packet is to us.
137 uint32 ssrc_of_sender = GetSsrcOfSender(data, length); 137 uint32_t ssrc_of_sender = GetSsrcOfSender(data, length);
138 if (ssrc_of_sender != remote_ssrc_) { 138 if (ssrc_of_sender != remote_ssrc_) {
139 return false; 139 return false;
140 } 140 }
141 141
142 // Parse this packet. 142 // Parse this packet.
143 RtcpParser parser(local_ssrc_, remote_ssrc_); 143 RtcpParser parser(local_ssrc_, remote_ssrc_);
144 base::BigEndianReader reader(reinterpret_cast<const char*>(data), length); 144 base::BigEndianReader reader(reinterpret_cast<const char*>(data), length);
145 if (parser.Parse(&reader)) { 145 if (parser.Parse(&reader)) {
146 if (parser.has_receiver_reference_time_report()) { 146 if (parser.has_receiver_reference_time_report()) {
147 base::TimeTicks t = ConvertNtpToTimeTicks( 147 base::TimeTicks t = ConvertNtpToTimeTicks(
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 if (rtp_receiver_statistics) { 244 if (rtp_receiver_statistics) {
245 report_block.remote_ssrc = 0; // Not needed to set send side. 245 report_block.remote_ssrc = 0; // Not needed to set send side.
246 report_block.media_ssrc = remote_ssrc_; // SSRC of the RTP packet sender. 246 report_block.media_ssrc = remote_ssrc_; // SSRC of the RTP packet sender.
247 report_block.fraction_lost = rtp_receiver_statistics->fraction_lost; 247 report_block.fraction_lost = rtp_receiver_statistics->fraction_lost;
248 report_block.cumulative_lost = rtp_receiver_statistics->cumulative_lost; 248 report_block.cumulative_lost = rtp_receiver_statistics->cumulative_lost;
249 report_block.extended_high_sequence_number = 249 report_block.extended_high_sequence_number =
250 rtp_receiver_statistics->extended_high_sequence_number; 250 rtp_receiver_statistics->extended_high_sequence_number;
251 report_block.jitter = rtp_receiver_statistics->jitter; 251 report_block.jitter = rtp_receiver_statistics->jitter;
252 report_block.last_sr = last_report_truncated_ntp_; 252 report_block.last_sr = last_report_truncated_ntp_;
253 if (!time_last_report_received_.is_null()) { 253 if (!time_last_report_received_.is_null()) {
254 uint32 delay_seconds = 0; 254 uint32_t delay_seconds = 0;
255 uint32 delay_fraction = 0; 255 uint32_t delay_fraction = 0;
256 base::TimeDelta delta = time_data.timestamp - time_last_report_received_; 256 base::TimeDelta delta = time_data.timestamp - time_last_report_received_;
257 ConvertTimeToFractions(delta.InMicroseconds(), &delay_seconds, 257 ConvertTimeToFractions(delta.InMicroseconds(), &delay_seconds,
258 &delay_fraction); 258 &delay_fraction);
259 report_block.delay_since_last_sr = 259 report_block.delay_since_last_sr =
260 ConvertToNtpDiff(delay_seconds, delay_fraction); 260 ConvertToNtpDiff(delay_seconds, delay_fraction);
261 } else { 261 } else {
262 report_block.delay_since_last_sr = 0; 262 report_block.delay_since_last_sr = 0;
263 } 263 }
264 } 264 }
265 RtcpBuilder rtcp_builder(local_ssrc_); 265 RtcpBuilder rtcp_builder(local_ssrc_);
266 packet_sender_->SendRtcpPacket( 266 packet_sender_->SendRtcpPacket(
267 local_ssrc_, 267 local_ssrc_,
268 rtcp_builder.BuildRtcpFromReceiver( 268 rtcp_builder.BuildRtcpFromReceiver(
269 rtp_receiver_statistics ? &report_block : NULL, 269 rtp_receiver_statistics ? &report_block : NULL,
270 &rrtr, 270 &rrtr,
271 cast_message, 271 cast_message,
272 rtcp_events, 272 rtcp_events,
273 target_delay)); 273 target_delay));
274 } 274 }
275 275
276 void Rtcp::SendRtcpFromRtpSender(base::TimeTicks current_time, 276 void Rtcp::SendRtcpFromRtpSender(base::TimeTicks current_time,
277 uint32 current_time_as_rtp_timestamp, 277 uint32_t current_time_as_rtp_timestamp,
278 uint32 send_packet_count, 278 uint32_t send_packet_count,
279 size_t send_octet_count) { 279 size_t send_octet_count) {
280 uint32 current_ntp_seconds = 0; 280 uint32_t current_ntp_seconds = 0;
281 uint32 current_ntp_fractions = 0; 281 uint32_t current_ntp_fractions = 0;
282 ConvertTimeTicksToNtp(current_time, &current_ntp_seconds, 282 ConvertTimeTicksToNtp(current_time, &current_ntp_seconds,
283 &current_ntp_fractions); 283 &current_ntp_fractions);
284 SaveLastSentNtpTime(current_time, current_ntp_seconds, 284 SaveLastSentNtpTime(current_time, current_ntp_seconds,
285 current_ntp_fractions); 285 current_ntp_fractions);
286 286
287 RtcpSenderInfo sender_info; 287 RtcpSenderInfo sender_info;
288 sender_info.ntp_seconds = current_ntp_seconds; 288 sender_info.ntp_seconds = current_ntp_seconds;
289 sender_info.ntp_fraction = current_ntp_fractions; 289 sender_info.ntp_fraction = current_ntp_fractions;
290 sender_info.rtp_timestamp = current_time_as_rtp_timestamp; 290 sender_info.rtp_timestamp = current_time_as_rtp_timestamp;
291 sender_info.send_packet_count = send_packet_count; 291 sender_info.send_packet_count = send_packet_count;
292 sender_info.send_octet_count = send_octet_count; 292 sender_info.send_octet_count = send_octet_count;
293 293
294 packet_sender_->SendRtcpPacket( 294 packet_sender_->SendRtcpPacket(
295 local_ssrc_, 295 local_ssrc_,
296 rtcp_builder_.BuildRtcpFromSender(sender_info)); 296 rtcp_builder_.BuildRtcpFromSender(sender_info));
297 } 297 }
298 298
299 void Rtcp::OnReceivedNtp(uint32 ntp_seconds, uint32 ntp_fraction) { 299 void Rtcp::OnReceivedNtp(uint32_t ntp_seconds, uint32_t ntp_fraction) {
300 last_report_truncated_ntp_ = ConvertToNtpDiff(ntp_seconds, ntp_fraction); 300 last_report_truncated_ntp_ = ConvertToNtpDiff(ntp_seconds, ntp_fraction);
301 301
302 const base::TimeTicks now = clock_->NowTicks(); 302 const base::TimeTicks now = clock_->NowTicks();
303 time_last_report_received_ = now; 303 time_last_report_received_ = now;
304 304
305 // TODO(miu): This clock offset calculation does not account for packet 305 // TODO(miu): This clock offset calculation does not account for packet
306 // transit time over the network. End2EndTest.EvilNetwork confirms that this 306 // transit time over the network. End2EndTest.EvilNetwork confirms that this
307 // contributes a very significant source of error here. Determine whether 307 // contributes a very significant source of error here. Determine whether
308 // RTT should be factored-in, and how that changes the rest of the 308 // RTT should be factored-in, and how that changes the rest of the
309 // calculation. 309 // calculation.
310 const base::TimeDelta measured_offset = 310 const base::TimeDelta measured_offset =
311 now - ConvertNtpToTimeTicks(ntp_seconds, ntp_fraction); 311 now - ConvertNtpToTimeTicks(ntp_seconds, ntp_fraction);
312 local_clock_ahead_by_.Update(now, measured_offset); 312 local_clock_ahead_by_.Update(now, measured_offset);
313 if (measured_offset < local_clock_ahead_by_.Current()) { 313 if (measured_offset < local_clock_ahead_by_.Current()) {
314 // Logically, the minimum offset between the clocks has to be the correct 314 // Logically, the minimum offset between the clocks has to be the correct
315 // one. For example, the time it took to transmit the current report may 315 // one. For example, the time it took to transmit the current report may
316 // have been lower than usual, and so some of the error introduced by the 316 // have been lower than usual, and so some of the error introduced by the
317 // transmission time can be eliminated. 317 // transmission time can be eliminated.
318 local_clock_ahead_by_.Reset(now, measured_offset); 318 local_clock_ahead_by_.Reset(now, measured_offset);
319 } 319 }
320 VLOG(1) << "Local clock is ahead of the remote clock by: " 320 VLOG(1) << "Local clock is ahead of the remote clock by: "
321 << "measured=" << measured_offset.InMicroseconds() << " usec, " 321 << "measured=" << measured_offset.InMicroseconds() << " usec, "
322 << "filtered=" << local_clock_ahead_by_.Current().InMicroseconds() 322 << "filtered=" << local_clock_ahead_by_.Current().InMicroseconds()
323 << " usec."; 323 << " usec.";
324 } 324 }
325 325
326 void Rtcp::OnReceivedLipSyncInfo(uint32 rtp_timestamp, uint32 ntp_seconds, 326 void Rtcp::OnReceivedLipSyncInfo(uint32_t rtp_timestamp,
327 uint32 ntp_fraction) { 327 uint32_t ntp_seconds,
328 uint32_t ntp_fraction) {
328 if (ntp_seconds == 0) { 329 if (ntp_seconds == 0) {
329 NOTREACHED(); 330 NOTREACHED();
330 return; 331 return;
331 } 332 }
332 lip_sync_rtp_timestamp_ = rtp_timestamp; 333 lip_sync_rtp_timestamp_ = rtp_timestamp;
333 lip_sync_ntp_timestamp_ = 334 lip_sync_ntp_timestamp_ =
334 (static_cast<uint64>(ntp_seconds) << 32) | ntp_fraction; 335 (static_cast<uint64_t>(ntp_seconds) << 32) | ntp_fraction;
335 } 336 }
336 337
337 bool Rtcp::GetLatestLipSyncTimes(uint32* rtp_timestamp, 338 bool Rtcp::GetLatestLipSyncTimes(uint32_t* rtp_timestamp,
338 base::TimeTicks* reference_time) const { 339 base::TimeTicks* reference_time) const {
339 if (!lip_sync_ntp_timestamp_) 340 if (!lip_sync_ntp_timestamp_)
340 return false; 341 return false;
341 342
342 const base::TimeTicks local_reference_time = 343 const base::TimeTicks local_reference_time =
343 ConvertNtpToTimeTicks(static_cast<uint32>(lip_sync_ntp_timestamp_ >> 32), 344 ConvertNtpToTimeTicks(
344 static_cast<uint32>(lip_sync_ntp_timestamp_)) + 345 static_cast<uint32_t>(lip_sync_ntp_timestamp_ >> 32),
346 static_cast<uint32_t>(lip_sync_ntp_timestamp_)) +
345 local_clock_ahead_by_.Current(); 347 local_clock_ahead_by_.Current();
346 348
347 // Sanity-check: Getting regular lip sync updates? 349 // Sanity-check: Getting regular lip sync updates?
348 DCHECK((clock_->NowTicks() - local_reference_time) < 350 DCHECK((clock_->NowTicks() - local_reference_time) <
349 base::TimeDelta::FromMinutes(1)); 351 base::TimeDelta::FromMinutes(1));
350 352
351 *rtp_timestamp = lip_sync_rtp_timestamp_; 353 *rtp_timestamp = lip_sync_rtp_timestamp_;
352 *reference_time = local_reference_time; 354 *reference_time = local_reference_time;
353 return true; 355 return true;
354 } 356 }
355 357
356 void Rtcp::OnReceivedDelaySinceLastReport(uint32 last_report, 358 void Rtcp::OnReceivedDelaySinceLastReport(uint32_t last_report,
357 uint32 delay_since_last_report) { 359 uint32_t delay_since_last_report) {
358 RtcpSendTimeMap::iterator it = last_reports_sent_map_.find(last_report); 360 RtcpSendTimeMap::iterator it = last_reports_sent_map_.find(last_report);
359 if (it == last_reports_sent_map_.end()) { 361 if (it == last_reports_sent_map_.end()) {
360 return; // Feedback on another report. 362 return; // Feedback on another report.
361 } 363 }
362 364
363 const base::TimeDelta sender_delay = clock_->NowTicks() - it->second; 365 const base::TimeDelta sender_delay = clock_->NowTicks() - it->second;
364 const base::TimeDelta receiver_delay = 366 const base::TimeDelta receiver_delay =
365 ConvertFromNtpDiff(delay_since_last_report); 367 ConvertFromNtpDiff(delay_since_last_report);
366 current_round_trip_time_ = sender_delay - receiver_delay; 368 current_round_trip_time_ = sender_delay - receiver_delay;
367 // If the round trip time was computed as less than 1 ms, assume clock 369 // If the round trip time was computed as less than 1 ms, assume clock
368 // imprecision by one or both peers caused a bad value to be calculated. 370 // imprecision by one or both peers caused a bad value to be calculated.
369 // While plenty of networks do easily achieve less than 1 ms round trip time, 371 // While plenty of networks do easily achieve less than 1 ms round trip time,
370 // such a level of precision cannot be measured with our approach; and 1 ms is 372 // such a level of precision cannot be measured with our approach; and 1 ms is
371 // good enough to represent "under 1 ms" for our use cases. 373 // good enough to represent "under 1 ms" for our use cases.
372 current_round_trip_time_ = 374 current_round_trip_time_ =
373 std::max(current_round_trip_time_, base::TimeDelta::FromMilliseconds(1)); 375 std::max(current_round_trip_time_, base::TimeDelta::FromMilliseconds(1));
374 376
375 if (!rtt_callback_.is_null()) 377 if (!rtt_callback_.is_null())
376 rtt_callback_.Run(current_round_trip_time_); 378 rtt_callback_.Run(current_round_trip_time_);
377 } 379 }
378 380
379 void Rtcp::OnReceivedCastFeedback(const RtcpCastMessage& cast_message) { 381 void Rtcp::OnReceivedCastFeedback(const RtcpCastMessage& cast_message) {
380 if (cast_callback_.is_null()) 382 if (cast_callback_.is_null())
381 return; 383 return;
382 cast_callback_.Run(cast_message); 384 cast_callback_.Run(cast_message);
383 } 385 }
384 386
385 void Rtcp::SaveLastSentNtpTime(const base::TimeTicks& now, 387 void Rtcp::SaveLastSentNtpTime(const base::TimeTicks& now,
386 uint32 last_ntp_seconds, 388 uint32_t last_ntp_seconds,
387 uint32 last_ntp_fraction) { 389 uint32_t last_ntp_fraction) {
388 // Make sure |now| is always greater than the last element in 390 // Make sure |now| is always greater than the last element in
389 // |last_reports_sent_queue_|. 391 // |last_reports_sent_queue_|.
390 if (!last_reports_sent_queue_.empty()) { 392 if (!last_reports_sent_queue_.empty()) {
391 DCHECK(now >= last_reports_sent_queue_.back().second); 393 DCHECK(now >= last_reports_sent_queue_.back().second);
392 } 394 }
393 395
394 uint32 last_report = ConvertToNtpDiff(last_ntp_seconds, last_ntp_fraction); 396 uint32_t last_report = ConvertToNtpDiff(last_ntp_seconds, last_ntp_fraction);
395 last_reports_sent_map_[last_report] = now; 397 last_reports_sent_map_[last_report] = now;
396 last_reports_sent_queue_.push(std::make_pair(last_report, now)); 398 last_reports_sent_queue_.push(std::make_pair(last_report, now));
397 399
398 const base::TimeTicks timeout = 400 const base::TimeTicks timeout =
399 now - TimeDelta::FromMilliseconds(kStatsHistoryWindowMs); 401 now - TimeDelta::FromMilliseconds(kStatsHistoryWindowMs);
400 402
401 // Cleanup old statistics older than |timeout|. 403 // Cleanup old statistics older than |timeout|.
402 while (!last_reports_sent_queue_.empty()) { 404 while (!last_reports_sent_queue_.empty()) {
403 RtcpSendTimePair oldest_report = last_reports_sent_queue_.front(); 405 RtcpSendTimePair oldest_report = last_reports_sent_queue_.front();
404 if (oldest_report.second < timeout) { 406 if (oldest_report.second < timeout) {
405 last_reports_sent_map_.erase(oldest_report.first); 407 last_reports_sent_map_.erase(oldest_report.first);
406 last_reports_sent_queue_.pop(); 408 last_reports_sent_queue_.pop();
407 } else { 409 } else {
408 break; 410 break;
409 } 411 }
410 } 412 }
411 } 413 }
412 414
413 void Rtcp::OnReceivedReceiverLog(const RtcpReceiverLogMessage& receiver_log) { 415 void Rtcp::OnReceivedReceiverLog(const RtcpReceiverLogMessage& receiver_log) {
414 if (log_callback_.is_null()) 416 if (log_callback_.is_null())
415 return; 417 return;
416 log_callback_.Run(receiver_log); 418 log_callback_.Run(receiver_log);
417 } 419 }
418 420
419 } // namespace cast 421 } // namespace cast
420 } // namespace media 422 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/net/rtcp/rtcp.h ('k') | media/cdm/ppapi/external_clear_key/clear_key_cdm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698