Revert conversion from TickTime to int64_t in paced sender.
Introduced with r6600, causing flakes in SuspendBelowMinBitrate. The reason for this flake is currently unknown.
R=pbos@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/17879004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@6605 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/pacing/include/paced_sender.h b/webrtc/modules/pacing/include/paced_sender.h
index 887ab44..41bbbd6 100644
--- a/webrtc/modules/pacing/include/paced_sender.h
+++ b/webrtc/modules/pacing/include/paced_sender.h
@@ -16,6 +16,7 @@
#include "webrtc/modules/interface/module.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
+#include "webrtc/system_wrappers/interface/tick_util.h"
#include "webrtc/typedefs.h"
namespace webrtc {
@@ -139,8 +140,8 @@
// utilized when there's no media to send.
scoped_ptr<paced_sender::IntervalBudget> padding_budget_;
- int64_t time_last_update_;
- int64_t time_last_send_;
+ TickTime time_last_update_;
+ TickTime time_last_send_;
int64_t capture_time_ms_last_queued_;
int64_t capture_time_ms_last_sent_;
diff --git a/webrtc/modules/pacing/paced_sender.cc b/webrtc/modules/pacing/paced_sender.cc
index 0069c6b..5aab4a0 100644
--- a/webrtc/modules/pacing/paced_sender.cc
+++ b/webrtc/modules/pacing/paced_sender.cc
@@ -135,7 +135,7 @@
critsect_(CriticalSectionWrapper::CreateCriticalSection()),
media_budget_(new paced_sender::IntervalBudget(max_bitrate_kbps)),
padding_budget_(new paced_sender::IntervalBudget(min_bitrate_kbps)),
- time_last_update_(clock_->TimeInMilliseconds()),
+ time_last_update_(TickTime::Now()),
capture_time_ms_last_queued_(0),
capture_time_ms_last_sent_(0),
high_priority_packets_(new paced_sender::PacketList),
@@ -242,7 +242,7 @@
int32_t PacedSender::TimeUntilNextProcess() {
CriticalSectionScoped cs(critsect_.get());
int64_t elapsed_time_ms =
- clock_->TimeInMilliseconds() - time_last_update_;
+ (TickTime::Now() - time_last_update_).Milliseconds();
if (elapsed_time_ms <= 0) {
return kMinPacketLimitMs;
}
@@ -253,10 +253,10 @@
}
int32_t PacedSender::Process() {
- int64_t now_ms = clock_->TimeInMilliseconds();
+ TickTime now = TickTime::Now();
CriticalSectionScoped cs(critsect_.get());
- int elapsed_time_ms = now_ms - time_last_update_;
- time_last_update_ = now_ms;
+ int elapsed_time_ms = (now - time_last_update_).Milliseconds();
+ time_last_update_ = now;
if (!enabled_) {
return 0;
}
@@ -328,7 +328,7 @@
if (media_budget_->bytes_remaining() <= 0) {
// All bytes consumed for this interval.
// Check if we have not sent in a too long time.
- if (clock_->TimeInMilliseconds() - time_last_send_ >
+ if ((TickTime::Now() - time_last_send_).Milliseconds() >
kMaxQueueTimeWithoutSendingMs) {
if (!high_priority_packets_->empty()) {
*packet_list = high_priority_packets_.get();
@@ -381,7 +381,7 @@
// MUST have critsect_ when calling.
void PacedSender::UpdateMediaBytesSent(int num_bytes) {
- time_last_send_ = clock_->TimeInMilliseconds();
+ time_last_send_ = TickTime::Now();
media_budget_->UseBudget(num_bytes);
padding_budget_->UseBudget(num_bytes);
}