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

@ -154,9 +154,10 @@ void ModuleRtpRtcpImpl::DeRegisterChildModule(RtpRtcp* remove_module) {
// Returns the number of milliseconds until the module want a worker thread
// to call Process.
int32_t ModuleRtpRtcpImpl::TimeUntilNextProcess() {
const int64_t now = clock_->TimeInMilliseconds();
return kRtpRtcpMaxIdleTimeProcess - (now - last_process_time_);
int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() {
const int64_t now = clock_->TimeInMilliseconds();
const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5;
return kRtpRtcpMaxIdleTimeProcessMs - (now - last_process_time_);
}
// Process any pending tasks such as timeouts (non time critical events).
@ -164,12 +165,14 @@ int32_t ModuleRtpRtcpImpl::Process() {
const int64_t now = clock_->TimeInMilliseconds();
last_process_time_ = now;
const int64_t kRtpRtcpBitrateProcessTimeMs = 10;
if (now >= last_bitrate_process_time_ + kRtpRtcpBitrateProcessTimeMs) {
rtp_sender_.ProcessBitrate();
last_bitrate_process_time_ = now;
}
if (!IsDefaultModule()) {
const int64_t kRtpRtcpRttProcessTimeMs = 1000;
bool process_rtt = now >= last_rtt_process_time_ + kRtpRtcpRttProcessTimeMs;
if (rtcp_sender_.Sending()) {
// Process RTT if we have received a receiver report and we haven't