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

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: fix out-of-line errors for SHMBuffer and BufferPair. 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 d4c1b8eb841b4b4fd16257818f7977f7d0566644..f44e29637a341f0575ecf240914c74dcf62158c4 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -586,10 +586,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.
@@ -661,9 +661,20 @@ 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) {
+ DiscardFilter(pipeline_init_state_->video_decoder_);
+ state_ = kInitAudioRenderer;
+ } else {
+ SetError(last_stage_status);
+ }
+ }
+
// If we have received the stop or error signal, return immediately.
if (IsPipelineStopPending() || IsPipelineStopped() || !IsPipelineOk())
return;
@@ -1111,13 +1122,15 @@ void PipelineImpl::FinishDestroyingFiltersTask() {
bool PipelineImpl::PrepareFilter(scoped_refptr<Filter> filter) {
bool ret = pipeline_init_state_->composite_->AddFilter(filter.get());
-
- if (!ret) {
+ if (!ret)
SetError(PIPELINE_ERROR_INITIALIZATION_FAILED);
- }
return ret;
}
+void PipelineImpl::DiscardFilter(scoped_refptr<Filter> filter) {
scherkus (not reviewing) 2011/12/09 00:26:20 nit: maybe RemoveFilter() or even inline the code?
Ami GONE FROM CHROMIUM 2011/12/09 22:55:50 Done.
+ pipeline_init_state_->composite_->RemoveFilter(filter.get());
+}
+
void PipelineImpl::InitializeDemuxer() {
DCHECK_EQ(MessageLoop::current(), message_loop_);
DCHECK(IsPipelineOk());
@@ -1155,7 +1168,7 @@ void PipelineImpl::OnDemuxerBuilt(PipelineStatus status, Demuxer* demuxer) {
clock_->SetTime(demuxer_->GetStartTime());
}
- OnFilterInitialize();
+ OnFilterInitialize(PIPELINE_OK);
}
bool PipelineImpl::InitializeAudioDecoder(
@@ -1183,7 +1196,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;
}
@@ -1240,7 +1253,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;
}
@@ -1264,7 +1277,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