New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 752403 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Some APNG flicker when playing

Reported by holliswu...@gmail.com, Aug 4 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36

Example URL:

Steps to reproduce the problem:
1. Go to the links below and play the png image
2. The last one played without issue. Others have issue described below

Image URLs:
1. https://en.wikipedia.org/wiki/APNG#/media/File:Animated_PNG_example_bouncing_beach_ball.png
2. https://media.52poke.com/wiki/1/1d/Spr_6x_115.png
3. https://en.wikipedia.org/wiki/APNG#/media/File:Brain_MRI_apng_105px_100ms.png

What is the expected behavior?
APNG image played as normal and does not flick

What went wrong?
Some image flicks while others do not

See attached video for detail. It shows the above images in sequence.

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 60.0.3112.90  Channel: stable
OS Version: Arch linux
Flash Version: N/A

Tested on both my desktop and laptop. Both have this issue.

Tried to disable hardware acceleration but does not work.

Desktop uses a Nvidia display card with property driver. Laptop uses Intel display card. Both have the issue.

(Only tested on desktop) Firefox 54 can show animation without issue.
 
output.mp4
116 KB View Download
Just done some more experiment. This issue only affect __Chromium__ but not Google Chrome (Compiled from AUR, google-chrome package).

Google Chrome can play APNG normally in all three situations.

Google Chrome version: 60.0.3112.90, 64 bit, stable

Comment 2 by kochi@chromium.org, Aug 7 2017

Cc: kochi@chromium.org
Components: -Blink Blink>Image
Owner: hcm@chromium.org
hcm@, can you clarify this?

Comment 3 by hcm@chromium.org, Aug 7 2017

Cc: scroggo@chromium.org
I'm not sure why you'd see different results on Chrome vs Chromium...something else coming into play at build time?  I've tested versions 59, 60, and 61 on Ubuntu and cannot repro...
My first thought was that this was the same as  issue 722072 , but I cannot repro even if I revert  issue 722072 's fix
Just tried testing this out on different Linux system inside virtual box. Can only reproduce this bug under Arch linux.

Tried under following versions without issue:
Ubuntu 16.04.3 LTS
Ubuntu 17.04
Fedora 26

Arch linux with i3 as WM have issue.


Another test I have tried is to run chromium using this script, inside my host system with arch linux. No issue on playing APNG with that build.

The script: https://github.com/scheib/chromium-latest-linux

I suspect this is an issue with Arch Linux's build. Should I file a report to them?
Yes, please file against the Arch linux distribution. It only happens there and it's not a distribution we work with directly.

Comment 7 by kochi@chromium.org, Aug 10 2017

Status: WontFix (was: Unconfirmed)
Let's close this as WontFix, please go to Arch Linux bug tracker for
reporting the issue.
If the real culprit remains in Chromium side, please feel free to file a
new separate bug, or reopen this if appropriate.
Filed to Arch issue tracker: https://bugs.archlinux.org/task/55093

Just to make a reference ;)

Comment 9 by kochi@chromium.org, Aug 10 2017

Great, thanks!
The issue appears to be related to the fact that libpng on Arch is patched for APNG support. [1] (With non-patched system libpng, the images are animated correctly.)

The following warnings (originating from code in the libpng-apng patch [1]) are printed repeatedly when viewing the bouncing ball image:

    libpng warning: size in first frame's fcTL must match the size in IHDR
    libpng warning: Skipped (ignored) a chunk between APNG chunks

Could Chromium's PNG decoder be made to work with system libpng carrying the apng patch?

[1] https://sourceforge.net/projects/libpng-apng/
I'm not sure what Chromium's policy is for working with alternative versions of libraries that we're not testing.

That said, I have an idea of what might be going wrong here. Chromium works without the APNG patch by modifying the data it passes to libpng - e.g. it uses a modified IHDR with the size of the fcTL, so that they always match. Let's say the IDAT is part of the image, and we're decoding a frame after that, whose size does not match the IHDR chunk. We'll modify the IHDR to match the size of the fcTL in PNGImageReader::StartFrameDecoding [1]. The problem is, we then tell libpng to process the other chunks leading up to the IDAT. Since the first frame is part of the image, it looks something like:

IHDR
fcTL (matches IHDR)
IDAT
fcTL (does not match IHDR)
fdAT

So at [2], we (incidentally) tell libpng to process the first fcTL, which does not match the modified IHDR (which matches the second fcTL).

A couple of possible solutions:
- Make this method skip over APNG chunks, so it treats the image as a standard PNG
- Tell libpng to ignore APNG chunks. IIUC, png_set_keep_unknown_chunks can be used to tell libpng to let the client handle (most) chunks. I don't think this will currently work because the APNG-patched libpng checks for fcTL [3] before looking at the user-chunks [4]. Standard libpng already makes an exception - user cannot override handling of IDAT or IEND. Not sure whether it was a deliberate decision to disallow overriding APNG chunks.

[1] https://chromium.googlesource.com/chromium/src/+/03bbf72bf0b90103dd7f016f378de5e373a7892f/third_party/WebKit/Source/platform/image-decoders/png/PNGImageReader.cpp#192
[2] https://chromium.googlesource.com/chromium/src/+/03bbf72bf0b90103dd7f016f378de5e373a7892f/third_party/WebKit/Source/platform/image-decoders/png/PNGImageReader.cpp#218
[3] https://sourceforge.net/p/libpng-apng/code/ci/master/tree/pngpread.c#l238
[4] https://sourceforge.net/p/libpng-apng/code/ci/master/tree/pngpread.c#l367

Sign in to add a comment