Hacker News new | past | comments | ask | show | jobs | submit login
Issue 3422 - android - Animated GIF not working in browser (code.google.com)
48 points by alexandros on April 7, 2010 | hide | past | favorite | 38 comments



Comment #42

  It's a shortcoming of the graphics engine, complicated by
  the relative lack of memory and the trickiness with
  managing what little it has. The implementation in WebKit
  for GIF support allocates a 32 bpp bitmap for each
  frame, which can chew through memory very quickly. The
  bitmap allocator is backed by ashmem, but when the
  kernel detects low memory, it tends to kill the process
  rather than giving it a chance to back off.

  If you have expertise in this area, we'd gladly accept
  your help in fixing this.


I'm curious how Apple managed to do it on devices that are substantially underpowered compared to many of the ones that make up the modern Android ecosystem.


I wouldn't say Apple's is any better. I've rarely ever had animated gifs work on my iPod. In fact, I don't ever remember a single one working. I might get a frame or two, at most, but that's it. Maybe they've fixed it in version 3 of the iPhone OS. I don't know, none of the features were worth the upgrade.


I've seen them work on my iPhone, but whatever algorithm they're using is horrible. For every frame of animation it seems to want to read from the "start" of the file. For a few frames, it's fine, but anything longer than 2-3 seconds of animation makes it slow to a crawl.

Animated gifs are so uncommon anyway (the use cases I've seen where it falls down are lolcat-worthy animations) that it's probably not worth fixing. The 90s-era gif animations probably look good enough.


Comment #45:

According to the Android developer in comment 42 the explanation is that Android has multitasking while the iPhone doesn't.


That's just silly explanation. They have enough processing power to decode every frame into the single-frame buffer every time a new one is needed. Why preallocate the whole movie? I guess they don't do it the same way for videos anyways...

Also, I'm not sure where did commenter #45 get the idea about multitasking. #42 said just that process which is memory-hungry will be killed. That's it. It doesn't matter if the OS is multitasking or not... Maemo is multitasking (linux based) and displays animated GIFs just fine.


Not really understanding what short of a truly massive design flaw could cause these two things to be related. Surely if we're running low on memory the backgrounded processes should be the first ones to get killed. Or else how can you make an app that when active pushes the limits of the device? You'd always be worried about getting killed and not about doing what your app is there to do.


What if there's a bug in the foreground process that eats memory? In that case, you don't want to start killing off background processes at random, or you'll get a dead phone.

Seriously, google "OOM killer." This problem, and problems like it, are not new, nor are they simple to solve.


I'm aware of what an OOM killer is, but it strikes me that the rules are a little different on a device where the resource constraints and mode of operation will frequently demand all the resources for a single process.


Also surely you could just have:

  function readGIF(filename) {
    if (calcMemSizeNeeded(filename) > memoryFree()) {
      displayGifPlaceholder();
    }  
  }
eg just display an animated GIF if there's enough ram, and if not, display some placeholder.

I guess one of the other issues there though is websites that 'stream' animated gifs that never end. Still, you could just disable those for now.


Probably first by only allocating the necessary 8 bpp instead of 32 bpp


The amusing thing is I've been using Android phones for well over a year and never even noticed this problem...


My initial response was that's a feature, not a bug. Then I realized that there are plenty of real uses for animated gifs.


E.g. loading graphics.


Problem is, they're also massively abused by people using them to show video. Playing an animated gif 'video' would consume a ton of ram.


Just the other day I installed ADT and decided to give it another try (I had played with it back the whole thing was brand new).

The story for developers is quite poor. Emulation is very slow (you can't get close to real life snapdragon speed) and then you have Eclipse (which seems to be a hate it or love it).

I've done both iPhone and Compact Framework development, and despite objective-c, iphone development is far superior to the other two.

Anyways, these types of issues, the lack of core features like USB Host and [apparently] animated GIFs, keep making me think i should actually learn Silverlight for WM7.


Android development doesn't require Eclipse.


Certainly an interesting issue.

For the record, I just tested animated GIFs with Opera Mobile 5 Beta on my G1 running CompleteEclair 2.0 and it doesn't do animations either.


In the context of the sea of complaints about Apple's iP* not supporting Flash this looks… interesting.


Wow, now that is very surprising and to see the ticket go on for nearly a year with google.

Especially since how comment #134 on there makes the fix look kinda simple to include as an option for higher memory devices.


Animated PNG (APNG) not working either.


I'm GLAD of this, frankly. 99%+ of animated gifs are simply annoying and unnecessary


...and as with all these things, the remaining 1% are absolutely vital and a deal-breaker for those who need them.


True, but to play devil's advocate, this road leads to Microsoft Word, where each user only needs 1% of the product's features but of course every user has their own unique 1%. The result is a massive product that is resource-insatiable.

Which... leads us back here. Viewed in isolation it is no big deal, much as each feature of Word is no big deal in isolation. But the Android team have to deal with the combination of features running on resource-constrained handsets.

:-)


> this road leads to Microsoft Word

I wouldn't mind walking down the road to one of the most successful and widely loved (not to mention profitable) pieces of software in the industry.


It's a feature LOL.


Android team: failure has never looked this easy.

It would take too long to numerate the demonstrations of incompetence in the Android ecosystem. I guess I'll just point out a couple:

* How about that Update All button on the market application? Oh wait, there isn't one.

* Nice next and previous conversation buttons in mail. What's that you say? Neither is available on the screen itself, and the two actions are in different parts of the menu?

* Truly impressed with that universal copy and paste. Um, about that.

Seriously folks. The phone should never have launched with these deficiencies and the many others that better people than I have noted. But to allow it to stagnate and still not address them for so long? That's flat out contempt for the user.


Those are all minor UI nitpicks. Android is open-source. If an "Update All" or better placement of Forward/Back buttons in Gmail app is so important to you, you should add it.


Enough minor UI nitpicks, and there are more than enough, begin to stack up. The "it's open source, fix it yourself" defense is tired, especially when given for a device I'd pay for (if I didn't have the good sense to own an iPhone -- or anything else -- instead).

Also, lack of copy and paste is not a "minor" nitpick. As I recall it's one of the things that iPhone haters would not stop harping about when Android first came out with the half-baked copy and paste it still has today. (http://www.youtube.com/watch?v=ofQqhJ_fa2M) Even if that wasn't the case, it's a major, serious deficiency in the device whose absence I would miss on a fairly regular basis if I didn't have it with my iPhone.


I have to reluctantly agree. I love my Droid, and prefer it to iphone, but the Cut&Paste is a mess.


Wait, what problem are you seeing with copy&paste? I use it every day across multiple apps and I've never noticed a single problem.


Couple of things for you to try:

* Copy-paste anything from the browser to elsewhere. You see how you have to go two-deep into a menu? For iPhone users, they just tap the text they want to copy, the drag to put the bounds at the right place.

* Try copying anything out of a received gmail message and pasting it somewhere else.


Nobody is forcing you to use it or to send in a patch. Android is an ambitious project that will probably leave the iPhone in the dust within about 6-12 months. Google has not even begun to be aggressive with pricing.


That no one is forcing me to use it is true, but completely irrelevant to the discussion.

> that will probably leave the iPhone in the dust within about 6-12 months

If I had a dollar for every time an open source advocate claimed incorrectly that their preferred solution would leave its proprietary competitor in the dust in "just a few months," I'd have a lot of money. Not so much in the opposite direction.


Correct me if I'm wrong, but hasn't open source software come to dominate every single industry except perhaps defense? Apple has some nice stuff but it's proprietary nature is a throwback to the 80s.


The consumer electronics industry?


I'd argue that much embedded systems code on consumer electronics devices was probably compiled with gcc.

Of my consumer electronics devices, about half are based on open source (appletv, nexusone, roku, linksys access point)... I don't know about my toaster, microwave, etc.

My blackberry is not, and I doubt things like tvs and dvd players are, but every day there are more benefits to companies using open source. The main threat to this is the GPLv3 license, but fortunately that's not getting too much traction.


Except that it should be pointed out that not all of the applications are open source; in particular, market and gmail (the two discussed here) are proprietary.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: