From f467d03becdffdd9862dacb1feec243781f24952 Mon Sep 17 00:00:00 2001 From: "scherkus@chromium.org" Date: Fri, 23 Oct 2009 00:56:24 +0000 Subject: Use a saved copy of the time when pausing media elements. Since our internal pause is asynchronous and we don't want to hang the render thread, it's possible to have our clock creep ahead. This produces unexpected behaviour when pausing media elements, such as seeing currentTime attribute nudge a little ahead after calling pause(). This so happens to also address layout test flakiness. BUG=13907 TEST=layout tests, especially video-pause-immediately.html -- a new layout test I wrote and am upstreaming Review URL: http://codereview.chromium.org/334002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29851 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/webmediaplayer_impl.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'webkit/glue/webmediaplayer_impl.h') diff --git a/webkit/glue/webmediaplayer_impl.h b/webkit/glue/webmediaplayer_impl.h index 5c5de44..97c4d89 100644 --- a/webkit/glue/webmediaplayer_impl.h +++ b/webkit/glue/webmediaplayer_impl.h @@ -271,8 +271,15 @@ class WebMediaPlayerImpl : public WebKit::WebMediaPlayer, // single "playback rate" over worrying about paused/stopped etc... It forces // all clients to manage the pause+playback rate externally, but is that // really a bad thing? + // + // TODO(scherkus): since SetPlaybackRate(0) is asynchronous and we don't want + // to hang the render thread during pause(), we record the time at the same + // time we pause and then return that value in currentTime(). Otherwise our + // clock can creep forward a little bit while the asynchronous + // SetPlaybackRate(0) is being executed. bool paused_; float playback_rate_; + base::TimeDelta paused_time_; WebKit::WebMediaPlayerClient* client_; -- cgit v1.1