OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 | 436 |
437 void CompositeFilter::OnStatusCB(const base::Closure& callback, | 437 void CompositeFilter::OnStatusCB(const base::Closure& callback, |
438 PipelineStatus status) { | 438 PipelineStatus status) { |
439 if (status != PIPELINE_OK) | 439 if (status != PIPELINE_OK) |
440 SetError(status); | 440 SetError(status); |
441 | 441 |
442 callback.Run(); | 442 callback.Run(); |
443 } | 443 } |
444 | 444 |
445 void CompositeFilter::SetError(PipelineStatus error) { | 445 void CompositeFilter::SetError(PipelineStatus error) { |
446 // TODO(acolwell): Temporary hack to handle errors that occur | |
447 // during filter initialization. In this case we just forward | |
448 // the error to the host even if it is on the wrong thread. We | |
449 // have to do this because if we defer the call, we can't be | |
450 // sure the host will get the error before the "init done" callback | |
451 // is executed. This will be cleaned up when filter init is refactored. | |
452 if (state_ == kCreated) { | |
453 SendErrorToHost(error); | |
454 return; | |
455 } | |
456 | |
457 if (message_loop_ != MessageLoop::current()) { | 446 if (message_loop_ != MessageLoop::current()) { |
458 message_loop_->PostTask(FROM_HERE, | 447 message_loop_->PostTask(FROM_HERE, |
459 base::Bind(&CompositeFilter::SetError, this, error)); | 448 base::Bind(&CompositeFilter::SetError, this, error)); |
460 return; | 449 return; |
461 } | 450 } |
462 | 451 |
463 DCHECK_EQ(message_loop_, MessageLoop::current()); | 452 DCHECK_EQ(message_loop_, MessageLoop::current()); |
Ami GONE FROM CHROMIUM
2012/02/01 18:39:11
DCHECK_NE(state_, kCreated);
acolwell GONE FROM CHROMIUM
2012/02/01 19:59:46
Done.
| |
464 | 453 |
465 // Drop errors recieved while stopping or stopped. | 454 // Drop errors recieved while stopping or stopped. |
466 // This shields the owner of this object from having | 455 // This shields the owner of this object from having |
467 // to deal with errors it can't do anything about. | 456 // to deal with errors it can't do anything about. |
468 if (state_ == kStopPending || state_ == kStopped) | 457 if (state_ == kStopPending || state_ == kStopped) |
469 return; | 458 return; |
470 | 459 |
471 status_ = error; | 460 status_ = error; |
472 if (CanForwardError()) | 461 if (CanForwardError()) |
473 SendErrorToHost(error); | 462 SendErrorToHost(error); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
507 | 496 |
508 void CompositeFilter::FilterHostImpl::NotifyEnded() { | 497 void CompositeFilter::FilterHostImpl::NotifyEnded() { |
509 host_->NotifyEnded(); | 498 host_->NotifyEnded(); |
510 } | 499 } |
511 | 500 |
512 void CompositeFilter::FilterHostImpl::DisableAudioRenderer() { | 501 void CompositeFilter::FilterHostImpl::DisableAudioRenderer() { |
513 host_->DisableAudioRenderer(); | 502 host_->DisableAudioRenderer(); |
514 } | 503 } |
515 | 504 |
516 } // namespace media | 505 } // namespace media |
OLD | NEW |