From 4948090e4385c271a374e94baf43d2dcc4c230ce Mon Sep 17 00:00:00 2001 From: "scherkus@chromium.org" Date: Tue, 14 Jul 2009 20:23:43 +0000 Subject: Fixed bug where playbackRate wasn't being respected. BUG=16502 TEST=setting defaultPlaybackRate before the media starts playing should be respected when play() is called Review URL: http://codereview.chromium.org/155404 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20652 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/webmediaplayer_impl.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'webkit/glue/webmediaplayer_impl.cc') diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc index 9f5702f..3bd5138 100644 --- a/webkit/glue/webmediaplayer_impl.cc +++ b/webkit/glue/webmediaplayer_impl.cc @@ -167,6 +167,8 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(WebKit::WebMediaPlayerClient* client, main_loop_(NULL), filter_factory_(factory), pipeline_thread_("PipelineThread"), + paused_(true), + playback_rate_(0.0f), client_(client) { // Saves the current message loop. DCHECK(!main_loop_); @@ -224,14 +226,14 @@ void WebMediaPlayerImpl::cancelLoad() { void WebMediaPlayerImpl::play() { DCHECK(MessageLoop::current() == main_loop_); - // TODO(hclam): We should restore the previous playback rate rather than - // having it at 1.0. - pipeline_->SetPlaybackRate(1.0f); + paused_ = false; + pipeline_->SetPlaybackRate(playback_rate_); } void WebMediaPlayerImpl::pause() { DCHECK(MessageLoop::current() == main_loop_); + paused_ = true; pipeline_->SetPlaybackRate(0.0f); } @@ -257,7 +259,10 @@ void WebMediaPlayerImpl::setEndTime(float seconds) { void WebMediaPlayerImpl::setRate(float rate) { DCHECK(MessageLoop::current() == main_loop_); - pipeline_->SetPlaybackRate(rate); + playback_rate_ = rate; + if (!paused_) { + pipeline_->SetPlaybackRate(rate); + } } void WebMediaPlayerImpl::setVolume(float volume) { -- cgit v1.1