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

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

Issue 34623008: Change to calculate the real NTP in TimeTicks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/rtcp/rtcp.h" 5 #include "media/cast/rtcp/rtcp.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "media/cast/cast_config.h" 9 #include "media/cast/cast_config.h"
10 #include "media/cast/cast_defines.h" 10 #include "media/cast/cast_defines.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 &delay_seconds, 266 &delay_seconds,
267 &delay_fraction); 267 &delay_fraction);
268 report_block.delay_since_last_sr = 268 report_block.delay_since_last_sr =
269 ConvertToNtpDiff(delay_seconds, delay_fraction); 269 ConvertToNtpDiff(delay_seconds, delay_fraction);
270 } else { 270 } else {
271 report_block.delay_since_last_sr = 0; 271 report_block.delay_since_last_sr = 0;
272 } 272 }
273 273
274 packet_type_flags |= RtcpSender::kRtcpRrtr; 274 packet_type_flags |= RtcpSender::kRtcpRrtr;
275 RtcpReceiverReferenceTimeReport rrtr; 275 RtcpReceiverReferenceTimeReport rrtr;
276 ConvertTimeToNtp(now, &rrtr.ntp_seconds, &rrtr.ntp_fraction); 276 ConvertTimeToFractions(now.ToInternalValue(),
277 &rrtr.ntp_seconds, &rrtr.ntp_fraction);
277 278
278 time_last_report_sent_ = now; 279 time_last_report_sent_ = now;
279 last_report_sent_ = ConvertToNtpDiff(rrtr.ntp_seconds, rrtr.ntp_fraction); 280 last_report_sent_ = ConvertToNtpDiff(rrtr.ntp_seconds, rrtr.ntp_fraction);
280 281
281 rtcp_sender_->SendRtcp(packet_type_flags, 282 rtcp_sender_->SendRtcp(packet_type_flags,
282 NULL, 283 NULL,
283 &report_block, 284 &report_block,
284 media_ssrc, 285 media_ssrc,
285 NULL, 286 NULL,
286 &rrtr, 287 &rrtr,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 int random = base::RandInt(0, 999); 410 int random = base::RandInt(0, 999);
410 base::TimeDelta time_to_next = (rtcp_interval_ / 2) + 411 base::TimeDelta time_to_next = (rtcp_interval_ / 2) +
411 (rtcp_interval_ * random / 1000); 412 (rtcp_interval_ * random / 1000);
412 413
413 base::TimeTicks now = clock_->NowTicks(); 414 base::TimeTicks now = clock_->NowTicks();
414 next_time_to_send_rtcp_ = now + time_to_next; 415 next_time_to_send_rtcp_ = now + time_to_next;
415 } 416 }
416 417
417 } // namespace cast 418 } // namespace cast
418 } // namespace media 419 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698