| Index: media/base/composite_filter.cc
|
| diff --git a/media/base/composite_filter.cc b/media/base/composite_filter.cc
|
| index 94665fd97925388f206f8a7974d3cf446a3e4e4e..41eb31c6382d2b8b2e0f4914c2c9924ccb33764d 100644
|
| --- a/media/base/composite_filter.cc
|
| +++ b/media/base/composite_filter.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "media/base/composite_filter.h"
|
|
|
| +#include "base/message_loop.h"
|
| #include "base/stl_util-inl.h"
|
| #include "media/base/callback.h"
|
|
|
| @@ -40,46 +41,21 @@ class CompositeFilter::FilterHostImpl : public FilterHost {
|
| DISALLOW_COPY_AND_ASSIGN(FilterHostImpl);
|
| };
|
|
|
| -CompositeFilter::CompositeFilter(MessageLoop* message_loop) {
|
| - Init(message_loop, NULL);
|
| -}
|
| -
|
| -CompositeFilter::CompositeFilter(MessageLoop* message_loop,
|
| - ThreadFactoryFunction thread_factory) {
|
| - DCHECK(thread_factory);
|
| - Init(message_loop, thread_factory);
|
| -}
|
| -
|
| -void CompositeFilter::Init(MessageLoop* message_loop,
|
| - ThreadFactoryFunction thread_factory) {
|
| +CompositeFilter::CompositeFilter(MessageLoop* message_loop)
|
| + : state_(kCreated),
|
| + sequence_index_(0),
|
| + message_loop_(message_loop),
|
| + error_(PIPELINE_OK) {
|
| DCHECK(message_loop);
|
| - message_loop_ = message_loop;
|
| - thread_factory_ = thread_factory;
|
| runnable_factory_.reset(
|
| new ScopedRunnableMethodFactory<CompositeFilter>(this));
|
| -
|
| - if (!thread_factory_) {
|
| - thread_factory_ = &CompositeFilter::DefaultThreadFactory;
|
| - }
|
| -
|
| - state_ = kCreated;
|
| - sequence_index_ = 0;
|
| - error_ = PIPELINE_OK;
|
| }
|
|
|
| CompositeFilter::~CompositeFilter() {
|
| DCHECK_EQ(message_loop_, MessageLoop::current());
|
| DCHECK(state_ == kCreated || state_ == kStopped);
|
|
|
| - // Stop every running filter thread.
|
| - for (FilterThreadVector::iterator iter = filter_threads_.begin();
|
| - iter != filter_threads_.end();
|
| - ++iter) {
|
| - (*iter)->Stop();
|
| - }
|
| -
|
| filters_.clear();
|
| - STLDeleteElements(&filter_threads_);
|
| }
|
|
|
| bool CompositeFilter::AddFilter(scoped_refptr<Filter> filter) {
|
| @@ -87,19 +63,6 @@ bool CompositeFilter::AddFilter(scoped_refptr<Filter> filter) {
|
| if (!filter.get() || state_ != kCreated || !host())
|
| return false;
|
|
|
| - // Create a dedicated thread for this filter if applicable.
|
| - if (filter->requires_message_loop()) {
|
| - scoped_ptr<base::Thread> thread(
|
| - thread_factory_(filter->message_loop_name()));
|
| -
|
| - if (!thread.get() || !thread->Start()) {
|
| - return false;
|
| - }
|
| -
|
| - filter->set_message_loop(thread->message_loop());
|
| - filter_threads_.push_back(thread.release());
|
| - }
|
| -
|
| // Register ourselves as the filter's host.
|
| filter->set_host(host_impl_.get());
|
| filters_.push_back(make_scoped_refptr(filter.get()));
|
| @@ -121,22 +84,6 @@ FilterHost* CompositeFilter::host() {
|
| return host_impl_.get() ? host_impl_->host() : NULL;
|
| }
|
|
|
| -bool CompositeFilter::requires_message_loop() const {
|
| - return false;
|
| -}
|
| -
|
| -const char* CompositeFilter::message_loop_name() const {
|
| - return "CompositeFilter";
|
| -}
|
| -
|
| -void CompositeFilter::set_message_loop(MessageLoop* message_loop) {
|
| - NOTREACHED() << "Message loop should not be set.";
|
| -}
|
| -
|
| -MessageLoop* CompositeFilter::message_loop() {
|
| - return NULL;
|
| -}
|
| -
|
| void CompositeFilter::Play(FilterCallback* play_callback) {
|
| DCHECK_EQ(message_loop_, MessageLoop::current());
|
| scoped_ptr<FilterCallback> callback(play_callback);
|
| @@ -278,11 +225,6 @@ void CompositeFilter::OnAudioRendererDisabled() {
|
| }
|
| }
|
|
|
| -base::Thread* CompositeFilter::DefaultThreadFactory(
|
| - const char* thread_name) {
|
| - return new base::Thread(thread_name);
|
| -}
|
| -
|
| void CompositeFilter::ChangeState(State new_state) {
|
| DCHECK_EQ(message_loop_, MessageLoop::current());
|
| state_ = new_state;
|
| @@ -529,9 +471,9 @@ void CompositeFilter::SetError(PipelineError error) {
|
| }
|
|
|
| CompositeFilter::FilterHostImpl::FilterHostImpl(CompositeFilter* parent,
|
| - FilterHost* host) :
|
| - parent_(parent),
|
| - host_(host) {
|
| + FilterHost* host)
|
| + : parent_(parent),
|
| + host_(host) {
|
| }
|
|
|
| FilterHost* CompositeFilter::FilterHostImpl::host() {
|
|
|