Opened 3 months ago
Last modified 3 months ago
It appears that web browsers use black magic to figure out the actual delay between frames, and people have come to rely on this. This should probably be fixed in GTK+, but what I've done as a workaround is to replace (in gtkanimview.c) the two instances of:
aview->timer_id = g_timeout_add (aview->delay,
with
aview->timer_id = g_timeout_add (aview->delay < MIN_DELAY ? MIN_DELAY : aview->delay,
A minimum delay of 50 seems to work.
I've now also changed the g_timeout_adds to g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE, ...), because my progressive loading function wasn't getting called when a gif was hogging the CPU. And cranking up the priority for the loading function caused the GUI to hang during loading.
Maybe there's a better solution though.
Another animation issue: To be able to do set_anim(None) I had to add null-ok to the parameter: - '("GdkPixbufAnimation*" "anim") + '("GdkPixbufAnimation*" "anim" (null-ok))
(I needed set_anim(None) to get progressive loading and gifs to play nice.)
Thanks for the bug report(s)! The null-ok problem is now fixed in r548. Animation delay workaround added in r550. Actually, that is a problem in gdk-pixbuf, see http://bugzilla.gnome.org/show_bug.cgi?id=437791. I'd love to hear more about gif hogging the CPU. I have never seen a gif able to do that. It must have been a particularly big gif animation or something?
Thank you for your response.
The workaround you added in incorrect. It is what I also tried at first, but since aview->delay is fed into gdk_pixbuf_animation_iter_advance, the frame rate is lowered but the playback speed isn't.
For the CPU hogging, find a somewhat fast playing gif and just start zooming in. You should see CPU usage rise.
You are right about the frame delay, the fix didn't work. But the new fix in r565 should work.
The CPU hogging is unfortunately not something that can (easily) be fixed. I don't think there is any particular inefficiency in GtkImageView -- gdk-pixbuf's bilinear filtering is to slow to be done in realtime on big, fast gif animations. You could turn off bilinear filtering while playing gif animations which should make everything run much smoother.