diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 20:00:30 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 20:00:30 +0000 |
commit | 9d8c6da308c378adb3236b3723918897aca039e6 (patch) | |
tree | 7bc73d33668d886c6abbbc86e7946425b42bbc5a /webkit/glue/webmediaplayer_impl.cc | |
parent | 1ba48dd0630846f6c7e9ebd3ec16335fbb7b8c58 (diff) | |
download | chromium_src-9d8c6da308c378adb3236b3723918897aca039e6.zip chromium_src-9d8c6da308c378adb3236b3723918897aca039e6.tar.gz chromium_src-9d8c6da308c378adb3236b3723918897aca039e6.tar.bz2 |
Correct network state and ready state reporting.
For network state, make it return "loading" for everything that's not a file source since our cache does not yet reliably support caching the full media w/o need for a network.
For ready state, correctly handle seeks to drop from HaveEnoughData down to HaveMetaData until the seek completes. Also implement the seeking() function.
BUG=18975
TEST=none
Review URL: http://codereview.chromium.org/165432
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24002 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webmediaplayer_impl.cc')
-rw-r--r-- | webkit/glue/webmediaplayer_impl.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc index d3d3679..0438e54 100644 --- a/webkit/glue/webmediaplayer_impl.cc +++ b/webkit/glue/webmediaplayer_impl.cc @@ -272,6 +272,7 @@ void WebMediaPlayerImpl::seek(float seconds) { // Try to preserve as much accuracy as possible. float microseconds = seconds * base::Time::kMicrosecondsPerSecond; + SetReadyState(WebKit::WebMediaPlayer::HaveMetadata); pipeline_->Seek( base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds)), NewCallback(proxy_.get(), @@ -361,7 +362,10 @@ bool WebMediaPlayerImpl::paused() const { bool WebMediaPlayerImpl::seeking() const { DCHECK(MessageLoop::current() == main_loop_); - return false; + if (ready_state_ == WebKit::WebMediaPlayer::HaveNothing) + return false; + + return ready_state_ == WebKit::WebMediaPlayer::HaveMetadata; } float WebMediaPlayerImpl::duration() const { @@ -467,7 +471,11 @@ void WebMediaPlayerImpl::OnPipelineInitialize() { // TODO(hclam): change this to report the correct status. SetReadyState(WebKit::WebMediaPlayer::HaveMetadata); SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData); - SetNetworkState(WebKit::WebMediaPlayer::Loaded); + if (pipeline_->IsLoaded()) { + SetNetworkState(WebKit::WebMediaPlayer::Loaded); + } else { + SetNetworkState(WebKit::WebMediaPlayer::Loading); + } } else { // TODO(hclam): should use pipeline_->GetError() to determine the state // properly and reports error using MediaError. @@ -484,6 +492,7 @@ void WebMediaPlayerImpl::OnPipelineInitialize() { void WebMediaPlayerImpl::OnPipelineSeek() { DCHECK(MessageLoop::current() == main_loop_); if (pipeline_->GetError() == media::PIPELINE_OK) { + SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData); GetClient()->timeChanged(); } } |