summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webmediaplayer_impl.cc
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-14 20:23:43 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-14 20:23:43 +0000
commit4948090e4385c271a374e94baf43d2dcc4c230ce (patch)
tree27597e2489e9caf2accb4df311672d13c84b3e03 /webkit/glue/webmediaplayer_impl.cc
parent8ea6f608f2866de703e386bc947d335054da2faa (diff)
downloadchromium_src-4948090e4385c271a374e94baf43d2dcc4c230ce.zip
chromium_src-4948090e4385c271a374e94baf43d2dcc4c230ce.tar.gz
chromium_src-4948090e4385c271a374e94baf43d2dcc4c230ce.tar.bz2
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
Diffstat (limited to 'webkit/glue/webmediaplayer_impl.cc')
-rw-r--r--webkit/glue/webmediaplayer_impl.cc13
1 files changed, 9 insertions, 4 deletions
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) {