Bug 87304

Summary: Early returns in MediaPlayer setters
Product: WebKit Reporter: Philippe Normand <pnormand>
Component: MediaAssignee: Philippe Normand <pnormand>
Status: RESOLVED INVALID    
Severity: Normal CC: dglazkov, eric.carlson, feature-media-reviews, gustavo, jer.noble, menard, mrobinson, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 101954    
Bug Blocks: 101824    
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ec2-cr-linux-02
none
Patch
eric.carlson: review+
Patch
webkit.review.bot: commit-queue-
Archive of layout-test-results from gce-cr-linux-05
none
Patch
none
Patch none

Philippe Normand
Reported 2012-05-23 13:17:24 PDT
Some calls to the MediaPlayerPrivate implementation can be avoided if the value to set and the current value are equal.
Attachments
Patch (2.92 KB, patch)
2012-05-23 13:22 PDT, Philippe Normand
no flags
Archive of layout-test-results from ec2-cr-linux-02 (439.14 KB, application/zip)
2012-05-23 18:30 PDT, WebKit Review Bot
no flags
Patch (3.18 KB, patch)
2012-05-29 10:05 PDT, Philippe Normand
eric.carlson: review+
Patch (4.28 KB, patch)
2012-08-20 05:39 PDT, Philippe Normand
webkit.review.bot: commit-queue-
Archive of layout-test-results from gce-cr-linux-05 (528.80 KB, application/zip)
2012-08-20 06:09 PDT, WebKit Review Bot
no flags
Patch (4.05 KB, patch)
2012-08-20 06:38 PDT, Philippe Normand
no flags
Patch (3.62 KB, patch)
2012-08-20 23:27 PDT, Philippe Normand
no flags
Philippe Normand
Comment 1 2012-05-23 13:22:05 PDT
Philippe Normand
Comment 2 2012-05-23 13:40:08 PDT
Thanks Martin for the quick review. I asked about this small issue with Eric on IRC. I'll just land the patch later today or tomorrow unless he raises any red flag :) I checked the patch with the media suite on the GTK+ port.
WebKit Review Bot
Comment 3 2012-05-23 18:30:01 PDT
Comment on attachment 143632 [details] Patch Attachment 143632 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/12797022 New failing tests: media/audio-garbage-collect.html media/track/track-cues-pause-on-exit.html fast/loader/loadInProgress.html platform/chromium/compositing/video-frame-size-change.html fast/loader/unload-form-post-about-blank.html media/media-element-play-after-eos.html media/media-fragments/TC0001-TC0009.html http/tests/xmlhttprequest/zero-length-response.html http/tests/security/script-crossorigin-loads-correctly.html media/track/track-cues-cuechange.html media/track/track-cues-missed.html media/media-fragments/TC0010-TC0019.html media/media-document-audio-repaint.html media/media-fragments/TC0070-TC0079.html media/media-fragments/TC0050-TC0059.html media/media-controller-playback.html media/track/track-cues-enter-exit.html media/audio-concurrent-supported.html http/tests/media/media-source/webm/video-media-source-play.html media/media-fragments/TC0020-TC0029.html media/media-continues-playing-after-replace-source.html http/tests/media/media-source/webm/video-media-source-seek.html
WebKit Review Bot
Comment 4 2012-05-23 18:30:05 PDT
Created attachment 143697 [details] Archive of layout-test-results from ec2-cr-linux-02 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-02 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Philippe Normand
Comment 5 2012-05-23 19:16:26 PDT
Hum, looks like this patch makes Chromium sad. :( I'll try to see what's going on.
Philippe Normand
Comment 6 2012-05-29 10:05:00 PDT
Philippe Normand
Comment 7 2012-08-20 05:37:31 PDT
I got back to this patch today, wanted to check the tests locally again before commiting and found one issue, MediaPlayerPrivate::setRate() not called anymore. I'll upload a new patch adding an explicit call in MediaPlayer::loadWithNextMediaEngine()
Philippe Normand
Comment 8 2012-08-20 05:39:41 PDT
WebKit Review Bot
Comment 9 2012-08-20 06:09:46 PDT
Comment on attachment 159402 [details] Patch Attachment 159402 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13537708 New failing tests: media/audio-garbage-collect.html media/media-fragments/TC0011.html media/track/track-cues-pause-on-exit.html fast/loader/loadInProgress.html platform/chromium/compositing/video-frame-size-change.html inspector/debugger/source-frame.html fast/loader/unload-form-post-about-blank.html http/tests/media/media-source/video-media-source-play.html fast/canvas/webgl/shader-precision-format.html media/media-fragments/TC0006.html media/media-fragments/TC0004.html media/media-element-play-after-eos.html http/tests/xmlhttprequest/zero-length-response.html media/track/track-cues-cuechange.html media/track/track-cues-missed.html media/media-controller-time-clamp.html media/media-document-audio-repaint.html fast/frames/cached-frame-counter.html http/tests/media/video-buffered-range-contains-currentTime.html media/track/track-cues-sorted-before-dispatch.html media/media-fragments/TC0015.html media/media-fragments/TC0017.html media/track/track-cues-enter-exit.html media/audio-concurrent-supported.html media/media-fragments/TC0005.html media/media-controller-playback.html http/tests/media/media-source/video-media-source-seek.html
WebKit Review Bot
Comment 10 2012-08-20 06:09:52 PDT
Created attachment 159407 [details] Archive of layout-test-results from gce-cr-linux-05 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-05 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Philippe Normand
Comment 11 2012-08-20 06:34:12 PDT
Oh well, the ::setRate() method doesn't need early return because the HTMLMediaElement already performs pre-emptive checks.
Philippe Normand
Comment 12 2012-08-20 06:38:57 PDT
Eric Carlson
Comment 13 2012-08-20 07:00:48 PDT
Comment on attachment 159413 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=159413&action=review > Source/WebCore/platform/graphics/MediaPlayer.cpp:410 > m_private->setPreservesPitch(preservesPitch()); > + m_private->setRate(m_rate); > if (m_shouldPrepareToRender) This may be a fine change, but why is it required? If so, it should be described in the ChangeLog. > Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:472 > void MediaPlayerPrivateGStreamer::seek(float time) > if (m_errorOccured) > return; > > + if (!m_player->rate()) > + return; > + Why should seeking while rate is 0 be ignored?
Philippe Normand
Comment 14 2012-08-20 07:24:29 PDT
(In reply to comment #13) > (From update of attachment 159413 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=159413&action=review > > > Source/WebCore/platform/graphics/MediaPlayer.cpp:410 > > m_private->setPreservesPitch(preservesPitch()); > > + m_private->setRate(m_rate); > > if (m_shouldPrepareToRender) > > This may be a fine change, but why is it required? If so, it should be described in the ChangeLog. > I'll add a note in the ChangeLog. > > Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:472 > > void MediaPlayerPrivateGStreamer::seek(float time) > > if (m_errorOccured) > > return; > > > > + if (!m_player->rate()) > > + return; > > + > > Why should seeking while rate is 0 be ignored? Oh, this is an unintended change, I'll revert it. Thanks for the review!
Philippe Normand
Comment 15 2012-08-20 23:27:19 PDT
Philippe Normand
Comment 16 2012-08-21 08:12:30 PDT
Comment on attachment 159625 [details] Patch Clearing flags on attachment: 159625 Committed r126157: <http://trac.webkit.org/changeset/126157>
Philippe Normand
Comment 17 2012-08-21 08:12:39 PDT
All reviewed patches have been landed. Closing bug.
Jer Noble
Comment 18 2012-11-09 23:05:55 PST
This change breaks a lot of assumptions. Many of the MediaPlayerPrivate implementations will ignore calls to, for example, setVolume() before a load() occurs. Since MediaPlayer is now bailing out early, further calls to setVolume() with the same value will be ignored, and post-load, the volume value will never be changed from the default. In other words, after this patch: video.volume = 0; video.src = "foo.ogv"; video.load(); // wait for loadedmetadata alert(video.volume); // prints "1".
Jer Noble
Comment 19 2012-11-09 23:24:03 PST
As far as I can tell, this breaks the following properties when set pre-load: setVolume() - mac, avfoundation, win-quicktime, blackberry setMuted() - mac, avfoundation, win-quicktime, blackberry, gstreamer setPreservesPitch() - mac, win-quicktime The following properties already check to see if the properties being set are the same as previous and bail out early: setSize() - blackberry, qt setVisible() - mac, avfoundation, Many of the remaining have empty implementations, so this optimization is pointless. I see no good reason why this optimization was done, and it significantly breaks things. I think this patch should be rolled out.
WebKit Review Bot
Comment 20 2012-11-12 11:19:32 PST
Re-opened since this is blocked by bug 101954
Philippe Normand
Comment 21 2012-11-12 23:50:04 PST
Sorry for the trouble introduced by this patch. Let's close this bug then.
Note You need to log in before you can comment on or make changes to this bug.