Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Unified Diff: webkit/glue/webmediaplayer_impl.cc

Issue 159373: Pipeline will execute a callback whenever an run-time error has happened.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webmediaplayer_impl.cc
===================================================================
--- webkit/glue/webmediaplayer_impl.cc (revision 21652)
+++ webkit/glue/webmediaplayer_impl.cc (working copy)
@@ -92,6 +92,11 @@
&WebMediaPlayerImpl::Proxy::PipelineSeekTask));
}
+void WebMediaPlayerImpl::Proxy::PipelineErrorCallback() {
+ render_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
+ &WebMediaPlayerImpl::Proxy::PipelineErrorTask));
+}
+
void WebMediaPlayerImpl::Proxy::RepaintTask() {
DCHECK(MessageLoop::current() == render_loop_);
{
@@ -118,6 +123,13 @@
}
}
+void WebMediaPlayerImpl::Proxy::PipelineErrorTask() {
+ DCHECK(MessageLoop::current() == render_loop_);
+ if (webmediaplayer_) {
+ webmediaplayer_->OnPipelineError();
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////
// WebMediaPlayerImpl implementation
@@ -140,6 +152,8 @@
NOTREACHED() << "Could not start PipelineThread";
} else {
pipeline_ = new media::PipelineImpl(pipeline_thread_.message_loop());
+ pipeline_->SetPipelineErrorCallback(NewCallback(proxy_.get(),
+ &WebMediaPlayerImpl::Proxy::PipelineErrorCallback));
}
// Also we want to be notified of |main_loop_| destruction.
@@ -389,6 +403,38 @@
}
}
+void WebMediaPlayerImpl::OnPipelineError() {
+ DCHECK(MessageLoop::current() == main_loop_);
+ switch (pipeline_->GetError()) {
+ case media::PIPELINE_OK:
+ case media::PIPELINE_STOPPING:
+ // We're in a good state. Do nothing.
+ break;
+
+ case media::PIPELINE_ERROR_INITIALIZATION_FAILED:
+ case media::PIPELINE_ERROR_REQUIRED_FILTER_MISSING:
+ case media::PIPELINE_ERROR_COULD_NOT_RENDER:
+ // Format error.
+ SetNetworkState(WebMediaPlayer::FormatError);
+ break;
+
+ case media::PIPELINE_ERROR_URL_NOT_FOUND:
+ case media::PIPELINE_ERROR_NETWORK:
+ case media::PIPELINE_ERROR_DECODE:
+ case media::PIPELINE_ERROR_ABORT:
+ case media::PIPELINE_ERROR_OUT_OF_MEMORY:
+ case media::PIPELINE_ERROR_READ:
+ case media::PIPELINE_ERROR_AUDIO_HARDWARE:
+ case media::DEMUXER_ERROR_COULD_NOT_OPEN:
+ case media::DEMUXER_ERROR_COULD_NOT_PARSE:
+ case media::DEMUXER_ERROR_NO_SUPPORTED_STREAMS:
+ case media::DEMUXER_ERROR_COULD_NOT_CREATE_THREAD:
+ // Decode error.
+ SetNetworkState(WebMediaPlayer::DecodeError);
+ break;
+ }
+}
+
void WebMediaPlayerImpl::SetNetworkState(
WebKit::WebMediaPlayer::NetworkState state) {
DCHECK(MessageLoop::current() == main_loop_);
« no previous file with comments | « webkit/glue/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698