Closed Bug 350383 Opened 18 years ago Closed 13 years ago

Animated gif plays out of sync / glitchy with other anim. gifs

Categories

(Core :: Graphics: ImageLib, defect)

1.8 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: HanClinto, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6

Note: The test case uses layered transparent animated GIFs to demonstrate the synchronization issues. I'm not sure if it happens with non-layered animations, as the glitches in synchronization are so close together (less than a frame) that it's hard to tell. The test case also demonstrates Bug 284511, but I believe that this bug is unrelated.

Now you may be saying... "Layered transparent animated GIFs?!?! Who would be crazy enough to need something like *that*!"

...

Well I guess I would. I know this is probably a low-priority issue, but it's still really annoying that IE handles it perfectly and FF doesn't (plus, I can't write my Javascript browser-game quite the way I was hoping to). 

Description of the bug:
Animated GIFs of the same framerate (but of different source images) play out of sync on the same page. The test page that I've linked shows the problem in Mozilla quite clearly (it renders perfectly in IE with no animation glitches or synchronization issues). I even tried adding javascript so that when you click on the page, it will reload all of the images at the same time, but they still don't play in sync (they seem to be a fraction of a frame off). 


Reproducible: Always

Steps to Reproduce:
1. Open a page that has several animated gifs of the same framerate (preferrably layered to better notice frame differences)
2. Refresh, and note how playback synchronization is not consistent each time the pages are loaded (even when Javascript is used to assign all of the source images simultaneously)

Actual Results:  
Animations of GIFs seem to display anywhere from about a quarter of a frame off to as much as a frame and a half off in synchronization.


Expected Results:  
Animations of GIFs that have the same framerate (especially when loaded simultaneously) should play in sync.



I have tried this on two different Centrino-processor laptops (Toshiba and IBM), both running Windows XP, both running the latest release version of FireFox. The test URL works perfectly in IE.

Thanks for taking time to look at this bug. :) I know it's obscure. In all of my other workings on this browser-based game, I was frustrated with IE's lack of per-pixel alpha blending for PNG images, so I was genuinely surprised when IE got the clear win of FF in something graphics-rendering related (though of course FF still wins overall).

Keep up the great work! :)

(BTW: there wasn't a selection in the bug filing area to assign this to imagelib, so I'm going to try and move the bug after I submit it).
Component: General → ImageLib
Product: Firefox → Core
QA Contact: general → imagelib
Version: unspecified → 1.8 Branch
Additional details I just noticed:

It's not limited to merely being a small fraction of a frame off -- I left the test page open for an hour or two while testing other stuff, and when I went back, I noticed that the animated GIFs were running at noticably different FPS's. It's like each animated GIF has its own thread (with non-corrective fps timing such that tick rounding errors are compounded) for updating itself, rather than updating all of the graphics together or using timing that is anchored to a specific moment in time rather than going frame-to-frame.
That's exactly going on. (Not with threads, but with system timers) It appears that each GIF uses its own system timer (VERY bad practice for Win 9x) rather than a single shared timer. I can understand why they did this--GIFs can animate at very different rates, and the least common denominator might be quite large. (100FPS, to be exact.)

Mozilla needs a more "elegant" timing system, overall. Maybe timing ALL visuals to the vertical refresh could be an idea. (You'll see some noticeable tearing on http://www.seizurerobots.com/ (pardon the ad). xP)
The images animate in sync when I view the test case, so this looks like it's been fixed. Please reopen if you are still seeing the problem.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.