Bug 55268 - Optimization to prevent native control updates when HTML5 video control panel is completely transparent
Summary: Optimization to prevent native control updates when HTML5 video control panel...
Status: CLOSED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://diveintohtml5.org/video.html
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-25 14:55 PST by Max Feil
Modified: 2012-11-02 12:28 PDT (History)
2 users (show)

See Also:


Attachments
Patch based on svn revision 79683 (2.67 KB, patch)
2011-02-25 14:55 PST, Max Feil
eric: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Max Feil 2011-02-25 14:55:19 PST
Created attachment 83882 [details]
Patch based on svn revision 79683

The MediaControls::update() method may be called repeatedly while an HTML5 video is playing and the controls are completely transparent. This results in unnecessary processing which can take quite a bit of CPU on some platforms, including re-layout and re-rendering large tiles.

This fairly simple patch addresses this by checking for opacity values of 0 and not updating controls in this case. It also ensures that the controls are updated before they fade in again.

Note that the m_timeUpdateTimer may still be updating some of the controls (timeline, time numbers). In the port of WebKit I am working on we have disabled this timer because the MediaControls::update() method gets called consistently when the media time changes. I tested the trunk svn revision 79683 linux GTK+ build and when HTML5 video plays the MediaControls::update() method gets called repeatedly for a while after the page is loaded, but then these calls stop and the timeUpdateTimer is all that is updating controls.

This patch could also be extended to include an opacity check in MediaControls::timeUpdateTimerFired(), but I did not do this because it's beyond the scope of our port and would not get tested very well.

An example HTML5 video with native controls is near the bottom of the following page: http://diveintohtml5.org/video.html
Comment 1 WebKit Review Bot 2011-02-25 14:58:20 PST
Attachment 83882 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/html/shadow/MediaControls.c..." exit_code: 1

Source/WebCore/html/shadow/MediaControls.cpp:201:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Source/WebCore/html/shadow/MediaControls.cpp:441:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Total errors found: 2 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 2 Eric Seidel (no email) 2011-04-10 16:24:18 PDT
Comment on attachment 83882 [details]
Patch based on svn revision 79683

Needs a ChangeLog (and tests!)
Comment 3 Max Feil 2012-11-02 12:28:21 PDT
This bug is invalid. See comments by Jer Noble in bug 86769 for the reason.
Comment 4 Max Feil 2012-11-02 12:28:49 PDT
Closing invalid bug.