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

Unified Diff: media/base/pipeline_impl.cc

Issue 155469: Splitting media filter's Initialize() into Create() + callback and Seek() + callback. (Closed)
Patch Set: Fixed valgrind errors 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 | « media/base/pipeline_impl.h ('k') | media/base/pipeline_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/pipeline_impl.cc
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index f021ad366251abfaae4927ccc25db203aba20b66..7ef051de0250ff3b38a0fde925a6a543a4d48d90 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -328,15 +328,6 @@ void PipelineInternal::VolumeChanged(float volume) {
NewRunnableMethod(this, &PipelineInternal::VolumeChangedTask, volume));
}
-// Called from any thread.
-void PipelineInternal::InitializationComplete(FilterHostImpl* host) {
- if (IsPipelineOk()) {
- // Continue the initialize task by proceeding to the next stage.
- message_loop_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &PipelineInternal::InitializeTask));
- }
-}
-
// Called from any thread. Updates the pipeline time.
void PipelineInternal::SetTime(base::TimeDelta time) {
// TODO(scherkus): why not post a task?
@@ -350,6 +341,19 @@ void PipelineInternal::Error(PipelineError error) {
NewRunnableMethod(this, &PipelineInternal::ErrorTask, error));
}
+// Called from any thread.
+void PipelineInternal::OnFilterInitialize() {
+ // Continue the initialize task by proceeding to the next stage.
+ message_loop_->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &PipelineInternal::InitializeTask));
+}
+
+// Called from any thread.
+void PipelineInternal::OnFilterSeek() {
+ // TODO(scherkus): have PipelineInternal wait to receive replies from every
+ // filter before calling the client's |seek_callback_|.
+}
+
void PipelineInternal::StartTask(FilterFactory* filter_factory,
const std::string& url,
PipelineCallback* start_callback) {
@@ -383,8 +387,8 @@ void PipelineInternal::StartTask(FilterFactory* filter_factory,
void PipelineInternal::InitializeTask() {
DCHECK_EQ(MessageLoop::current(), message_loop_);
- // If we have received the stop signal, return immediately.
- if (state_ == kStopped)
+ // If we have received the stop or error signal, return immediately.
+ if (state_ == kStopped || state_ == kError)
return;
DCHECK(state_ == kCreated || IsPipelineInitializing());
@@ -551,7 +555,8 @@ void PipelineInternal::SeekTask(base::TimeDelta time,
for (FilterHostVector::iterator iter = filter_hosts_.begin();
iter != filter_hosts_.end();
++iter) {
- (*iter)->media_filter()->Seek(time);
+ (*iter)->media_filter()->Seek(time,
+ NewCallback(this, &PipelineInternal::OnFilterSeek));
}
// TODO(hclam): we should set the time when the above seek operations were all
@@ -602,9 +607,8 @@ void PipelineInternal::CreateFilter(FilterFactory* filter_factory,
filter_hosts_.push_back(host.release());
// Now initialize the filter.
- if (!filter->Initialize(source)) {
- Error(PIPELINE_ERROR_INITIALIZATION_FAILED);
- }
+ filter->Initialize(source,
+ NewCallback(this, &PipelineInternal::OnFilterInitialize));
}
void PipelineInternal::CreateDataSource() {
« no previous file with comments | « media/base/pipeline_impl.h ('k') | media/base/pipeline_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698