| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/base/composite_filter.h" | 5 #include "media/base/composite_filter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/callback_helpers.h" |
| 9 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 11 | 12 |
| 12 namespace media { | 13 namespace media { |
| 13 | 14 |
| 14 class CompositeFilter::FilterHostImpl : public FilterHost { | 15 class CompositeFilter::FilterHostImpl : public FilterHost { |
| 15 public: | 16 public: |
| 16 FilterHostImpl(CompositeFilter* parent, FilterHost* host); | 17 FilterHostImpl(CompositeFilter* parent, FilterHost* host); |
| 17 | 18 |
| 18 FilterHost* host(); | 19 FilterHost* host(); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 default: | 284 default: |
| 284 ChangeState(kError); | 285 ChangeState(kError); |
| 285 DispatchPendingCallback(PIPELINE_ERROR_INVALID_STATE); | 286 DispatchPendingCallback(PIPELINE_ERROR_INVALID_STATE); |
| 286 } | 287 } |
| 287 } | 288 } |
| 288 | 289 |
| 289 void CompositeFilter::DispatchPendingCallback(PipelineStatus status) { | 290 void CompositeFilter::DispatchPendingCallback(PipelineStatus status) { |
| 290 DCHECK(status_cb_.is_null() ^ callback_.is_null()); | 291 DCHECK(status_cb_.is_null() ^ callback_.is_null()); |
| 291 | 292 |
| 292 if (!status_cb_.is_null()) { | 293 if (!status_cb_.is_null()) { |
| 293 ResetAndRunCB(&status_cb_, status); | 294 base::ResetAndReturn(&status_cb_).Run(status); |
| 294 return; | 295 return; |
| 295 } | 296 } |
| 296 | 297 |
| 297 if (!callback_.is_null()) { | 298 if (!callback_.is_null()) { |
| 298 if (status != PIPELINE_OK) | 299 if (status != PIPELINE_OK) |
| 299 SendErrorToHost(status); | 300 SendErrorToHost(status); |
| 300 ResetAndRunCB(&callback_); | 301 base::ResetAndReturn(&callback_).Run(); |
| 301 } | 302 } |
| 302 } | 303 } |
| 303 | 304 |
| 304 CompositeFilter::State CompositeFilter::GetNextState(State state) const { | 305 CompositeFilter::State CompositeFilter::GetNextState(State state) const { |
| 305 State ret = kInvalid; | 306 State ret = kInvalid; |
| 306 switch (state) { | 307 switch (state) { |
| 307 case kPlayPending: | 308 case kPlayPending: |
| 308 ret = kPlaying; | 309 ret = kPlaying; |
| 309 break; | 310 break; |
| 310 case kPausePending: | 311 case kPausePending: |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 493 |
| 493 void CompositeFilter::FilterHostImpl::NotifyEnded() { | 494 void CompositeFilter::FilterHostImpl::NotifyEnded() { |
| 494 host_->NotifyEnded(); | 495 host_->NotifyEnded(); |
| 495 } | 496 } |
| 496 | 497 |
| 497 void CompositeFilter::FilterHostImpl::DisableAudioRenderer() { | 498 void CompositeFilter::FilterHostImpl::DisableAudioRenderer() { |
| 498 host_->DisableAudioRenderer(); | 499 host_->DisableAudioRenderer(); |
| 499 } | 500 } |
| 500 | 501 |
| 501 } // namespace media | 502 } // namespace media |
| OLD | NEW |