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

Issue 595299 link

Starred by 2 users

Issue metadata

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



Sign in to add a comment

Chromium retains the V4L2 video decoder alive longer then exptected

Reported by ma...@endlessm.com, Mar 16 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Example URL:
https://vimeo.com/channels/staffpicks

Steps to reproduce the problem:
On an ARM-based device where V4L2-based HW video acceleration is supposed to work, do: 

1. Go to https://vimeo.com/channels/staffpicks and start playing the main video
2. After 2-3 seconds playing the video click on any of the other video thumbnails right before the main video's description
3. Start playing the new video quickly after it gets loaded in the main video's place
4. Repeat steps 2-3 for a few times more (e.g. 5-10 times should be enough)
5. Leave the last video playing for a couple of minutes

What is the expected behavior?
Every video loaded should play smoothly, using the HW accelerated V4L2 video decoder, including the last one.

What went wrong?
The first video plays smoothly, but the following ones do not, as they no longer use the HW video decoder and fall back to SW video decoding instead.

Did this work before? N/A 

Is it a problem with Flash or HTML5? HTML5

Does this work in other browsers? Yes 

Chrome version: 48.0.2564.82 (Developer Build) (ARM 32-bit)  Channel: dev
OS Version: 3.10.33.20150928 armv7l
Flash Version: No flash

The problem seems to be that, in this particular website (which does not reload, simply replaces the content of a video widget with a different video), the VideoDecoder element is not being destroyed when switching to a new video, keeping the instance of GenericV4L2Device created for the first video to stay alive when trying to play the second one.

And this is a problem, because playing the second video means it will try to create a second VideoDecoder for it, but it won't be able to do it since the associated file descriptor (/dev/video-dec) would be still open at that time, causing the GpuVideoDecodeAccelerator::CreateV4L2VDA() call to return an invalid video decoder accelerator, thus falling back into software mode.

We detected this problem a while ago in Endless and got a patch applied that worked it around, although it caused another issues due to the early returns it introduced (e.g. no sound on Duolingo), so we had to revert it after all. See it here for reference:
https://github.com/endlessm/chromium-browser/commit/4c7734ddc9b39df0eade0feed1cb75f3677e2b13

Our second attempt to workaround that issue involved distinguishing between video and audio but, while it seemed to also work fine for Vimeo without breaking audio in Duolingo, we recently found out that it literally broke every single place relying on the Video.JS framework because of the call to stop() we added in this second patch:
https://github.com/endlessm/chromium-browser/pull/38/commits/1f662ea4f417415e54b073032429784395b37007

At the moment I'm playing with a second patch on top of this last one that simply makes sure that the network state is set to EMPTY when removedFrom() is called if there is no data processed yet (another option that seems to work is to simply call userCancelledLoad(), but I tried to kept the patch down to a minimum), but I need to test it a bit more before feeling more confident about it:
https://github.com/endlessm/chromium-browser/commit/c479503f51922889427ca9803f31ec2aaff1bc83

In any case, regardless of whether we adopt or not this workaround downstream, I feel like this is an issue worth reporting, since the V4L2 related code does not seem to have changed much upstream compared to the version I'm using (48.0.2564.82 for armhf), and so it might be an issue in other environments too, such as ChromeOS maybe?

Note: In my particular setup (Amlogic S805 with Mali 450) I check whether the HW video decoder is actually being used by setting it in debug mode via /sys/module/meson_vdec/parameters/debug, and then checking the output of journalctl | grep meson, but YMMV.
 
The latest Chrome canary should be better about this since we will release the internal resources for idle <video> elements after ~15 second timeout.

Comment 2 by ma...@endlessm.com, Mar 17 2016

I see, that should definitely help in some scenarios indeed. However, I'm not sure it would help in this specific case, since it takes way less than 15 seconds for the second video to start playing and so I understand that chromium would still fall back to SW video decoding in that case.
Labels: Needs-Feedback
mario@, did you try on the latest canary build(as of today it is 51.0.2689.0)? does the issue still repro?

Comment 4 by ma...@endlessm.com, Mar 29 2016

Hi. Sorry, I did not have a chance to try that yet, but it's definitely on my plan to try it out when possible since I really don't like the workaround we have in place at the moment, and I'd very much prefer to help fixing it upstream instead.

But I need some time, since I think I'd need to cross compile the latest chromium canary for our ARM devices with our patches rebased on top, which unlikely to happen in the next 2-3 weeks due to some other issue I need to dealt with.

But I'll be back, you can be sure :-). Thanks again for pinging me
Project Member

Comment 5 by sheriffbot@chromium.org, Mar 30 2016

Labels: -Needs-Feedback Needs-Review
Owner: yini...@chromium.org
Thank you for providing more feedback. Adding requester "yiningc@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://sites.google.com/a/chromium.org/dev/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: yini...@chromium.org
Owner: ----
 mario@endlessm.com, any update?

Comment 8 by ma...@endlessm.com, Apr 12 2016

Not yet, sorry. It's been a couple of crazy weeks and haven't had time to check this yet. Reason why is taking me so much is that I need to find some time to rebase our patches on top of the latest Chromium, and so far I could not do it due to more pressing issues, sorry about that.

But sooner or later we'll rebase against Chromium >= 51, so worst case scenario I'll test it by then and then I'll comment back here (although I do hope I manage to do it earlier than that).

Will keep you posted, thanks for the reminder anyway
Status: WontFix (was: Unconfirmed)
I will resolve it as won't fix now. Please feel free to re-activate it after you upgrade to M51 and rebase it then.

Comment 10 by ma...@endlessm.com, Apr 22 2016

That's fine, I understand keeping this open without the extra info can be confusing and distracting. I'll re-open it later on when we rebase it then.

Thanks

Sign in to add a comment