Use int64_t for milliseconds more often, primarily for TimeUntilNextProcess.

This fixes a variety of MSVC warnings about value truncations when implicitly
storing the 64-bit values we get back from e.g. TimeTicks in 32-bit objects, and
removes the need for a number of explicit casts.

This also moves a number of constants so they're declared right where they're used, which is easier to read and maintain, and makes some of them of integral type rather than using the "enum hack".

BUG=chromium:81439
TEST=none
R=tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/33649004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7905 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pkasting@chromium.org
2014-12-15 22:09:40 +00:00
parent 96a626262a
commit 0b1534c52e
68 changed files with 160 additions and 173 deletions

View File

@ -20,7 +20,7 @@
namespace webrtc {
const int64_t kStatisticsTimeoutMs = 8000;
const int kStatisticsProcessIntervalMs = 1000;
const int64_t kStatisticsProcessIntervalMs = 1000;
StreamStatistician::~StreamStatistician() {}
@ -491,11 +491,12 @@ int32_t ReceiveStatisticsImpl::Process() {
return 0;
}
int32_t ReceiveStatisticsImpl::TimeUntilNextProcess() {
int64_t ReceiveStatisticsImpl::TimeUntilNextProcess() {
CriticalSectionScoped cs(receive_statistics_lock_.get());
int time_since_last_update = clock_->TimeInMilliseconds() -
int64_t time_since_last_update = clock_->TimeInMilliseconds() -
last_rate_update_ms_;
return std::max(kStatisticsProcessIntervalMs - time_since_last_update, 0);
return std::max<int64_t>(
kStatisticsProcessIntervalMs - time_since_last_update, 0);
}
void ReceiveStatisticsImpl::RegisterRtcpStatisticsCallback(
@ -548,7 +549,7 @@ StreamStatistician* NullReceiveStatistics::GetStatistician(
void NullReceiveStatistics::SetMaxReorderingThreshold(
int max_reordering_threshold) {}
int32_t NullReceiveStatistics::TimeUntilNextProcess() { return 0; }
int64_t NullReceiveStatistics::TimeUntilNextProcess() { return 0; }
int32_t NullReceiveStatistics::Process() { return 0; }