summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webmediaplayer_impl.cc
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-17 17:58:04 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-17 17:58:04 +0000
commita7281024bc3adc15e818ed641acca01507130342 (patch)
tree1901990df0943b2d8b08049ff5352754773a1944 /webkit/glue/webmediaplayer_impl.cc
parentce1ded6845140b92b8585a8bee169de04bcf6e32 (diff)
downloadchromium_src-a7281024bc3adc15e818ed641acca01507130342.zip
chromium_src-a7281024bc3adc15e818ed641acca01507130342.tar.gz
chromium_src-a7281024bc3adc15e818ed641acca01507130342.tar.bz2
Report load errors for <video> according to WebKit's
BUG=13907 This patch resolve failures for: LayoutTests/media/video-src-plus-source.html LayoutTests/media/video-src-invalid-remove.html LayoutTests/media/video-load-networkState.html Review URL: http://codereview.chromium.org/125226 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18632 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webmediaplayer_impl.cc')
-rw-r--r--webkit/glue/webmediaplayer_impl.cc30
1 files changed, 23 insertions, 7 deletions
diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc
index ebdda91..836ef12 100644
--- a/webkit/glue/webmediaplayer_impl.cc
+++ b/webkit/glue/webmediaplayer_impl.cc
@@ -97,7 +97,15 @@ WebMediaPlayerImpl::~WebMediaPlayerImpl() {
void WebMediaPlayerImpl::load(const WebKit::WebURL& url) {
DCHECK(main_loop_ && MessageLoop::current() == main_loop_);
- // Initialize the pipeline
+ // Initialize the pipeline.
+ if (network_state_ != WebKit::WebMediaPlayer::Loading) {
+ network_state_ = WebKit::WebMediaPlayer::Loading;
+ client_->networkStateChanged();
+ }
+ if (ready_state_ != WebKit::WebMediaPlayer::HaveNothing) {
+ ready_state_ = WebKit::WebMediaPlayer::HaveNothing;
+ client_->readyStateChanged();
+ }
pipeline_.Start(filter_factory_.get(), url.spec(),
NewCallback(this, &WebMediaPlayerImpl::OnPipelineInitialize));
}
@@ -279,6 +287,8 @@ void WebMediaPlayerImpl::WillDestroyCurrentMessageLoop() {
}
void WebMediaPlayerImpl::OnPipelineInitialize(bool successful) {
+ WebKit::WebMediaPlayer::ReadyState old_ready_state = ready_state_;
+ WebKit::WebMediaPlayer::NetworkState old_network_state = network_state_;
if (successful) {
// Since we have initialized the pipeline, say we have everything.
// TODO(hclam): change this to report the correct status.
@@ -287,14 +297,20 @@ void WebMediaPlayerImpl::OnPipelineInitialize(bool successful) {
} else {
// TODO(hclam): should use pipeline_.GetError() to determine the state
// properly and reports error using MediaError.
- ready_state_ = WebKit::WebMediaPlayer::HaveNothing;
- network_state_ = WebKit::WebMediaPlayer::NetworkError;
+ // WebKit uses FormatError to indicate an error for bogus URL or bad file.
+ // Since we are at the initialization stage we can safely treat every error
+ // as format error.
+ network_state_ = WebKit::WebMediaPlayer::FormatError;
}
- PostTask(kNetworkStateTaskIndex,
- &WebKit::WebMediaPlayerClient::networkStateChanged);
- PostTask(kReadyStateTaskIndex,
- &WebKit::WebMediaPlayerClient::readyStateChanged);
+ if (network_state_ != old_network_state) {
+ PostTask(kNetworkStateTaskIndex,
+ &WebKit::WebMediaPlayerClient::networkStateChanged);
+ }
+ if (ready_state_ != old_ready_state) {
+ PostTask(kReadyStateTaskIndex,
+ &WebKit::WebMediaPlayerClient::readyStateChanged);
+ }
}
void WebMediaPlayerImpl::OnPipelineSeek(bool successful) {