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

Unified Diff: media/base/pipeline_impl.cc

Issue 8686010: <video> decode in hardware! (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing OVERRIDEs Created 9 years 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
Index: media/base/pipeline_impl.cc
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index 386b064a96221aa8d344c5ad5e9dd74a7d9d92d1..4d251c8ce11928f7cb915a27db4d2e8220f03184 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -607,10 +607,10 @@ void PipelineImpl::DisableAudioRenderer() {
}
// Called from any thread.
-void PipelineImpl::OnFilterInitialize() {
+void PipelineImpl::OnFilterInitialize(PipelineStatus status) {
// Continue the initialize task by proceeding to the next stage.
- message_loop_->PostTask(FROM_HERE,
- base::Bind(&PipelineImpl::InitializeTask, this));
+ message_loop_->PostTask(
+ FROM_HERE, base::Bind(&PipelineImpl::InitializeTask, this, status));
}
// Called from any thread.
@@ -682,9 +682,21 @@ void PipelineImpl::StartTask(FilterCollection* filter_collection,
// TODO(hclam): InitializeTask() is now starting the pipeline asynchronously. It
// works like a big state change table. If we no longer need to start filters
// in order, we need to get rid of all the state change.
-void PipelineImpl::InitializeTask() {
+void PipelineImpl::InitializeTask(PipelineStatus last_stage_status) {
DCHECK_EQ(MessageLoop::current(), message_loop_);
+ if (last_stage_status != PIPELINE_OK) {
+ // Currently only VideoDecoders have a recoverable error code.
+ if (state_ == kInitVideoDecoder &&
+ last_stage_status == DECODER_ERROR_NOT_SUPPORTED) {
+ bool discarded = DiscardFilter(pipeline_init_state_->video_decoder_);
+ DCHECK(discarded);
+ state_ = kInitAudioRenderer;
scherkus (not reviewing) 2011/12/06 00:27:44 does this fall back to software or is that handled
Ami GONE FROM CHROMIUM 2011/12/07 00:03:04 The former.
+ } else {
+ SetError(last_stage_status);
+ }
+ }
+
// If we have received the stop or error signal, return immediately.
if (IsPipelineStopPending() || IsPipelineStopped() || !IsPipelineOk())
return;
@@ -1128,10 +1140,15 @@ void PipelineImpl::FinishDestroyingFiltersTask() {
bool PipelineImpl::PrepareFilter(scoped_refptr<Filter> filter) {
bool ret = pipeline_init_state_->composite_->AddFilter(filter.get());
+ if (!ret)
+ SetError(PIPELINE_ERROR_INITIALIZATION_FAILED);
+ return ret;
+}
- if (!ret) {
+bool PipelineImpl::DiscardFilter(scoped_refptr<Filter> filter) {
+ bool ret = pipeline_init_state_->composite_->RemoveFilter(filter.get());
scherkus (not reviewing) 2011/12/06 00:27:44 can we CHECK() inside of methods like RemoveFilter
Ami GONE FROM CHROMIUM 2011/12/07 00:03:04 Hell yes we can! (bonus points for the use of "fr
+ if (!ret)
SetError(PIPELINE_ERROR_INITIALIZATION_FAILED);
- }
return ret;
}
@@ -1172,7 +1189,7 @@ void PipelineImpl::OnDemuxerBuilt(PipelineStatus status, Demuxer* demuxer) {
clock_->SetTime(demuxer_->GetStartTime());
}
- OnFilterInitialize();
+ OnFilterInitialize(PIPELINE_OK);
}
bool PipelineImpl::InitializeAudioDecoder(
@@ -1200,7 +1217,7 @@ bool PipelineImpl::InitializeAudioDecoder(
pipeline_init_state_->audio_decoder_ = audio_decoder;
audio_decoder->Initialize(
stream,
- base::Bind(&PipelineImpl::OnFilterInitialize, this),
+ base::Bind(&PipelineImpl::OnFilterInitialize, this, PIPELINE_OK),
base::Bind(&PipelineImpl::OnUpdateStatistics, this));
return true;
}
@@ -1257,7 +1274,7 @@ bool PipelineImpl::InitializeAudioRenderer(
audio_renderer_->Initialize(
decoder,
- base::Bind(&PipelineImpl::OnFilterInitialize, this),
+ base::Bind(&PipelineImpl::OnFilterInitialize, this, PIPELINE_OK),
base::Bind(&PipelineImpl::OnAudioUnderflow, this));
return true;
}
@@ -1281,7 +1298,7 @@ bool PipelineImpl::InitializeVideoRenderer(
video_renderer_->Initialize(
decoder,
- base::Bind(&PipelineImpl::OnFilterInitialize, this),
+ base::Bind(&PipelineImpl::OnFilterInitialize, this, PIPELINE_OK),
base::Bind(&PipelineImpl::OnUpdateStatistics, this));
return true;
}

Powered by Google App Engine
This is Rietveld 408576698