commit | d98e784f5f507cce667c38a3c7cce91b239df22b | [log] [tgz] |
---|---|---|
author | stefan@webrtc.org <stefan@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | Wed May 08 06:38:53 2013 |
committer | stefan@webrtc.org <stefan@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | Wed May 08 06:38:53 2013 |
tree | fec7ad2bce35b275d6ee35117b3a86e2e6c5663b | |
parent | b55a12ad327bcb330fa762430bb5ad937e2da804 [diff] |
Fix VCMProcessTimer::TimeUntilProcess() unsigned-integer underflow problem. BUG=1665 R=mflodman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1341004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3979 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/video_coding/main/source/video_coding_impl.cc b/webrtc/modules/video_coding/main/source/video_coding_impl.cc index 881a5db..4ed2e80 100644 --- a/webrtc/modules/video_coding/main/source/video_coding_impl.cc +++ b/webrtc/modules/video_coding/main/source/video_coding_impl.cc
@@ -33,9 +33,13 @@ uint32_t VCMProcessTimer::TimeUntilProcess() const { - return static_cast<uint32_t>( - VCM_MAX(static_cast<int64_t>(_periodMs) - - (_clock->TimeInMilliseconds() - _latestMs), 0)); + const int64_t time_since_process = _clock->TimeInMilliseconds() - + static_cast<int64_t>(_latestMs); + const int64_t time_until_process = static_cast<int64_t>(_periodMs) - + time_since_process; + if (time_until_process < 0) + return 0; + return time_until_process; } void