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

Unified Diff: media/cast/net/rtp/receiver_stats.cc

Issue 1515433002: Replace uses of raw uint32's with a type-checked RtpTimeTicks data type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Speculative workaround fix for win8_chromium_ng compile error. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/cast/net/rtp/receiver_stats.h ('k') | media/cast/net/rtp/receiver_stats_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/net/rtp/receiver_stats.cc
diff --git a/media/cast/net/rtp/receiver_stats.cc b/media/cast/net/rtp/receiver_stats.cc
index 2238f6a74e8f37825bfcecec1bbe60af37e99ee9..da9d0ac6863d57096539a30f91b07d52a3a89684 100644
--- a/media/cast/net/rtp/receiver_stats.cc
+++ b/media/cast/net/rtp/receiver_stats.cc
@@ -74,7 +74,8 @@ RtpReceiverStatistics ReceiverStats::GetStatistics() {
return ret;
}
-void ReceiverStats::UpdateStatistics(const RtpCastHeader& header) {
+void ReceiverStats::UpdateStatistics(const RtpCastHeader& header,
+ int rtp_timebase) {
const uint16_t new_seq_num = header.sequence_number;
if (interval_number_packets_ == 0) {
@@ -97,17 +98,19 @@ void ReceiverStats::UpdateStatistics(const RtpCastHeader& header) {
}
// Compute Jitter.
- base::TimeTicks now = clock_->NowTicks();
- base::TimeDelta delta_new_timestamp =
- base::TimeDelta::FromMilliseconds(header.rtp_timestamp);
+ const base::TimeTicks now = clock_->NowTicks();
if (total_number_packets_ > 0) {
+ const base::TimeDelta packet_time_difference =
+ now - last_received_packet_time_;
+ const base::TimeDelta media_time_differerence =
+ (header.rtp_timestamp - last_received_rtp_timestamp_)
+ .ToTimeDelta(rtp_timebase);
+ const base::TimeDelta delta =
+ packet_time_difference - media_time_differerence;
// Update jitter.
- base::TimeDelta delta =
- (now - last_received_packet_time_) -
- ((delta_new_timestamp - last_received_timestamp_) / 90);
jitter_ += (delta - jitter_) / 16;
}
- last_received_timestamp_ = delta_new_timestamp;
+ last_received_rtp_timestamp_ = header.rtp_timestamp;
last_received_packet_time_ = now;
// Increment counters.
« no previous file with comments | « media/cast/net/rtp/receiver_stats.h ('k') | media/cast/net/rtp/receiver_stats_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698