Bug 846861 - Always update the moving average in nsSMILAnimationController::WillRefresh. r=dholbert

CLOSED TREE

--HG--
extra : amend_source : fb2d68d45f8f3e82a268b17092f311abe0e60384
This commit is contained in:
Seth Fowler 2013-03-04 14:05:23 -08:00
parent b25111eb4e
commit 85222ec900

View File

@ -137,18 +137,18 @@ nsSMILAnimationController::WillRefresh(mozilla::TimeStamp aTime)
nsSMILTime elapsedTime =
(nsSMILTime)(aTime - mCurrentSampleTime).ToMilliseconds();
// First sample:
if (mAvgTimeBetweenSamples == 0) {
// First sample.
mAvgTimeBetweenSamples = elapsedTime;
// Unexpectedly long delay between samples:
} else if (elapsedTime > SAMPLE_DEV_THRESHOLD * mAvgTimeBetweenSamples) {
NS_WARNING("Detected really long delay between samples, continuing from "
"previous sample");
mParentOffset += elapsedTime - mAvgTimeBetweenSamples;
// Usual case, update moving average:
} else {
// Due to truncation here the average will normally be a little less than
// it should be but that's probably ok
if (elapsedTime > SAMPLE_DEV_THRESHOLD * mAvgTimeBetweenSamples) {
// Unexpectedly long delay between samples.
NS_WARNING("Detected really long delay between samples, continuing from "
"previous sample");
mParentOffset += elapsedTime - mAvgTimeBetweenSamples;
}
// Update the moving average. Due to truncation here the average will
// normally be a little less than it should be but that's probably ok.
mAvgTimeBetweenSamples =
(nsSMILTime)(elapsedTime * SAMPLE_DUR_WEIGHTING +
mAvgTimeBetweenSamples * (1.0 - SAMPLE_DUR_WEIGHTING));