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

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

Issue 34623008: Change to calculate the real NTP in TimeTicks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed flaky test Created 7 years, 1 month 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/rtp_sender/rtp_sender.h" 5 #include "media/cast/rtp_sender/rtp_sender.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "media/cast/cast_defines.h" 9 #include "media/cast/cast_defines.h"
10 #include "media/cast/pacing/paced_sender.h" 10 #include "media/cast/pacing/paced_sender.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 115
116 void RtpSender::RtpStatistics(const base::TimeTicks& now, 116 void RtpSender::RtpStatistics(const base::TimeTicks& now,
117 RtcpSenderInfo* sender_info) { 117 RtcpSenderInfo* sender_info) {
118 // The timestamp of this Rtcp packet should be estimated as the timestamp of 118 // The timestamp of this Rtcp packet should be estimated as the timestamp of
119 // the frame being captured at this moment. We are calculating that 119 // the frame being captured at this moment. We are calculating that
120 // timestamp as the last frame's timestamp + the time since the last frame 120 // timestamp as the last frame's timestamp + the time since the last frame
121 // was captured. 121 // was captured.
122 uint32 ntp_seconds = 0; 122 uint32 ntp_seconds = 0;
123 uint32 ntp_fraction = 0; 123 uint32 ntp_fraction = 0;
124 ConvertTimeToNtp(now, &ntp_seconds, &ntp_fraction); 124 ConvertTimeTicksToNtp(now, &ntp_seconds, &ntp_fraction);
125 sender_info->ntp_seconds = ntp_seconds; 125 sender_info->ntp_seconds = ntp_seconds;
126 sender_info->ntp_fraction = ntp_fraction; 126 sender_info->ntp_fraction = ntp_fraction;
127 127
128 base::TimeTicks time_sent; 128 base::TimeTicks time_sent;
129 uint32 rtp_timestamp; 129 uint32 rtp_timestamp;
130 if (packetizer_->LastSentTimestamp(&time_sent, &rtp_timestamp)) { 130 if (packetizer_->LastSentTimestamp(&time_sent, &rtp_timestamp)) {
131 base::TimeDelta time_since_last_send = now - time_sent; 131 base::TimeDelta time_since_last_send = now - time_sent;
132 sender_info->rtp_timestamp = rtp_timestamp + 132 sender_info->rtp_timestamp = rtp_timestamp +
133 time_since_last_send.InMilliseconds() * (config_.frequency / 1000); 133 time_since_last_send.InMilliseconds() * (config_.frequency / 1000);
134 } else { 134 } else {
135 sender_info->rtp_timestamp = 0; 135 sender_info->rtp_timestamp = 0;
136 } 136 }
137 sender_info->send_packet_count = packetizer_->send_packets_count(); 137 sender_info->send_packet_count = packetizer_->send_packets_count();
138 sender_info->send_octet_count = packetizer_->send_octet_count(); 138 sender_info->send_octet_count = packetizer_->send_octet_count();
139 } 139 }
140 140
141 } // namespace cast 141 } // namespace cast
142 } // namespace media 142 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/rtp_sender/rtp_packetizer/rtp_packetizer_unittest.cc ('k') | media/cast/test/encode_decode_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698