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

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

Issue 362123005: Cast: Update simulator tool with more inputs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Diff Created 6 years, 5 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
OLDNEW
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 #include "media/cast/rtcp/rtcp.h" 5 #include "media/cast/rtcp/rtcp.h"
6 6
7 #include "base/big_endian.h" 7 #include "base/big_endian.h"
8 #include "base/rand_util.h"
9 #include "media/cast/cast_config.h" 8 #include "media/cast/cast_config.h"
10 #include "media/cast/cast_defines.h" 9 #include "media/cast/cast_defines.h"
11 #include "media/cast/cast_environment.h" 10 #include "media/cast/cast_environment.h"
12 #include "media/cast/rtcp/rtcp_defines.h" 11 #include "media/cast/rtcp/rtcp_defines.h"
13 #include "media/cast/rtcp/rtcp_receiver.h" 12 #include "media/cast/rtcp/rtcp_receiver.h"
14 #include "media/cast/rtcp/rtcp_sender.h" 13 #include "media/cast/rtcp/rtcp_sender.h"
15 #include "media/cast/rtcp/rtcp_utility.h" 14 #include "media/cast/rtcp/rtcp_utility.h"
16 #include "media/cast/transport/cast_transport_defines.h" 15 #include "media/cast/transport/cast_transport_defines.h"
17 16
18 namespace media { 17 namespace media {
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 if (number_of_rtt_in_avg_ == 0) return false; 376 if (number_of_rtt_in_avg_ == 0) return false;
378 377
379 *rtt = rtt_; 378 *rtt = rtt_;
380 *avg_rtt = base::TimeDelta::FromMillisecondsD(avg_rtt_ms_); 379 *avg_rtt = base::TimeDelta::FromMillisecondsD(avg_rtt_ms_);
381 *min_rtt = min_rtt_; 380 *min_rtt = min_rtt_;
382 *max_rtt = max_rtt_; 381 *max_rtt = max_rtt_;
383 return true; 382 return true;
384 } 383 }
385 384
386 void Rtcp::UpdateNextTimeToSendRtcp() { 385 void Rtcp::UpdateNextTimeToSendRtcp() {
387 int random = base::RandInt(0, 999);
388 base::TimeDelta time_to_next =
389 (rtcp_interval_ / 2) + (rtcp_interval_ * random / 1000);
390
391 base::TimeTicks now = cast_environment_->Clock()->NowTicks(); 386 base::TimeTicks now = cast_environment_->Clock()->NowTicks();
392 next_time_to_send_rtcp_ = now + time_to_next; 387 next_time_to_send_rtcp_ = now + rtcp_interval_;
393 } 388 }
394 389
395 void Rtcp::OnReceivedReceiverLog(const RtcpReceiverLogMessage& receiver_log) { 390 void Rtcp::OnReceivedReceiverLog(const RtcpReceiverLogMessage& receiver_log) {
396 // Add received log messages into our log system. 391 // Add received log messages into our log system.
397 RtcpReceiverLogMessage::const_iterator it = receiver_log.begin(); 392 RtcpReceiverLogMessage::const_iterator it = receiver_log.begin();
398 for (; it != receiver_log.end(); ++it) { 393 for (; it != receiver_log.end(); ++it) {
399 uint32 rtp_timestamp = it->rtp_timestamp_; 394 uint32 rtp_timestamp = it->rtp_timestamp_;
400 395
401 RtcpReceiverEventLogMessages::const_iterator event_it = 396 RtcpReceiverEventLogMessages::const_iterator event_it =
402 it->event_log_messages_.begin(); 397 it->event_log_messages_.begin();
(...skipping 20 matching lines...) Expand all
423 VLOG(2) << "Received log message via RTCP that we did not expect: " 418 VLOG(2) << "Received log message via RTCP that we did not expect: "
424 << static_cast<int>(event_it->type); 419 << static_cast<int>(event_it->type);
425 break; 420 break;
426 } 421 }
427 } 422 }
428 } 423 }
429 } 424 }
430 425
431 } // namespace cast 426 } // namespace cast
432 } // namespace media 427 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698