Bug 926048. Part 4. Update the current animation frame time if we hit the end of decoded frames before all frames are decoded. r=edwin

Before the previous patch we would (wrongly) loop through the decoded frames even though we didn't have all of the frames of the animation. This had the beneficial side effect of advancing mCurrentAnimationFrameTime to aTime (the current time). With the previous patch we stop at the last decoded frame and don't advance mCurrentAnimationFrameTime, so it can lag behind. The problem with this is that when we have finished decoding we will then try to catch mCurrentAnimationFrameTime up, and this will jump us to a random point in the animation. So we need to advance mCurrentAnimationFrameTime ourselves.

If we were blocked on network/decoding then displaying the last available decoded frame is the correct frame to be displaying. So we are up to date. So we advance mCurrentAnimationFrameTime to the current time.
This commit is contained in:
Timothy Nikkel 2016-03-01 22:34:40 -06:00
parent 5a904c6fc9
commit 1ca058713b

View File

@ -106,6 +106,16 @@ FrameAnimator::AdvanceFrame(TimeStamp aTime)
// done decoding, otherwise we don't know how many frames there will be.
if (!mDoneDecoding) {
// We've already advanced to the last decoded frame, nothing more we can do.
// We're blocked by network/decoding from displaying the animation at the
// rate specified, so that means the frame we are displaying (the latest
// available) is the frame we want to be displaying at this time. So we
// update the current animation time. If we didn't update the current
// animation time then it could lag behind, which would indicate that we
// are behind in the animation and should try to catch up. When we are
// done decoding (and thus can loop around back to the start of the
// animation) we would then jump to a random point in the animation to
// try to catch up. But we were never behind in the animation.
mCurrentAnimationFrameTime = aTime;
return ret;
}