| OLD | NEW |
| 1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008-2009 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 // TODO(scherkus): clean up PipelineImpl... too many crazy function names, | 5 // TODO(scherkus): clean up PipelineImpl... too many crazy function names, |
| 6 // potential deadlocks, etc... | 6 // potential deadlocks, etc... |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/condition_variable.h" | 9 #include "base/condition_variable.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 AutoLock auto_lock(lock_); | 230 AutoLock auto_lock(lock_); |
| 231 *width_out = video_width_; | 231 *width_out = video_width_; |
| 232 *height_out = video_height_; | 232 *height_out = video_height_; |
| 233 } | 233 } |
| 234 | 234 |
| 235 PipelineError PipelineImpl::GetError() const { | 235 PipelineError PipelineImpl::GetError() const { |
| 236 AutoLock auto_lock(lock_); | 236 AutoLock auto_lock(lock_); |
| 237 return error_; | 237 return error_; |
| 238 } | 238 } |
| 239 | 239 |
| 240 void PipelineImpl::SetPipelineErrorCallback(PipelineCallback* error_callback) { |
| 241 error_callback_.reset(error_callback); |
| 242 } |
| 243 |
| 240 void PipelineImpl::ResetState() { | 244 void PipelineImpl::ResetState() { |
| 241 AutoLock auto_lock(lock_); | 245 AutoLock auto_lock(lock_); |
| 242 running_ = false; | 246 running_ = false; |
| 243 duration_ = base::TimeDelta(); | 247 duration_ = base::TimeDelta(); |
| 244 buffered_time_ = base::TimeDelta(); | 248 buffered_time_ = base::TimeDelta(); |
| 245 buffered_bytes_ = 0; | 249 buffered_bytes_ = 0; |
| 246 total_bytes_ = 0; | 250 total_bytes_ = 0; |
| 247 video_width_ = 0; | 251 video_width_ = 0; |
| 248 video_height_ = 0; | 252 video_height_ = 0; |
| 249 volume_ = 1.0f; | 253 volume_ = 1.0f; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 seek_callback_->Run(); | 530 seek_callback_->Run(); |
| 527 } | 531 } |
| 528 seek_callback_.reset(); | 532 seek_callback_.reset(); |
| 529 filter_factory_ = NULL; | 533 filter_factory_ = NULL; |
| 530 | 534 |
| 531 // We no longer need to examine our previous state, set it to stopped. | 535 // We no longer need to examine our previous state, set it to stopped. |
| 532 state_ = kError; | 536 state_ = kError; |
| 533 | 537 |
| 534 // Destroy every filter and reset the pipeline as well. | 538 // Destroy every filter and reset the pipeline as well. |
| 535 DestroyFilters(); | 539 DestroyFilters(); |
| 540 |
| 541 // If our owner has requested to be notified of an error, execute |
| 542 // |error_callback_| unless we have a "good" error. |
| 543 if (error_callback_.get() && error != PIPELINE_STOPPING) { |
| 544 error_callback_->Run(); |
| 545 } |
| 536 } | 546 } |
| 537 | 547 |
| 538 void PipelineImpl::PlaybackRateChangedTask(float playback_rate) { | 548 void PipelineImpl::PlaybackRateChangedTask(float playback_rate) { |
| 539 DCHECK_EQ(MessageLoop::current(), message_loop_); | 549 DCHECK_EQ(MessageLoop::current(), message_loop_); |
| 540 for (FilterVector::iterator iter = filters_.begin(); | 550 for (FilterVector::iterator iter = filters_.begin(); |
| 541 iter != filters_.end(); | 551 iter != filters_.end(); |
| 542 ++iter) { | 552 ++iter) { |
| 543 (*iter)->SetPlaybackRate(playback_rate); | 553 (*iter)->SetPlaybackRate(playback_rate); |
| 544 } | 554 } |
| 545 } | 555 } |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 | 802 |
| 793 // Reset the pipeline, which will decrement a reference to this object. | 803 // Reset the pipeline, which will decrement a reference to this object. |
| 794 // We will get destroyed as soon as the remaining tasks finish executing. | 804 // We will get destroyed as soon as the remaining tasks finish executing. |
| 795 // To be safe, we'll set our pipeline reference to NULL. | 805 // To be safe, we'll set our pipeline reference to NULL. |
| 796 filters_.clear(); | 806 filters_.clear(); |
| 797 filter_types_.clear(); | 807 filter_types_.clear(); |
| 798 STLDeleteElements(&filter_threads_); | 808 STLDeleteElements(&filter_threads_); |
| 799 } | 809 } |
| 800 | 810 |
| 801 } // namespace media | 811 } // namespace media |
| OLD | NEW |