| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 volume_ = volume; | 195 volume_ = volume; |
| 196 if (running_) { | 196 if (running_) { |
| 197 message_loop_->PostTask(FROM_HERE, | 197 message_loop_->PostTask(FROM_HERE, |
| 198 NewRunnableMethod(this, &PipelineImpl::VolumeChangedTask, | 198 NewRunnableMethod(this, &PipelineImpl::VolumeChangedTask, |
| 199 volume)); | 199 volume)); |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 | 202 |
| 203 base::TimeDelta PipelineImpl::GetCurrentTime() const { | 203 base::TimeDelta PipelineImpl::GetCurrentTime() const { |
| 204 AutoLock auto_lock(lock_); | 204 AutoLock auto_lock(lock_); |
| 205 return clock_.Elapsed(); | 205 base::TimeDelta elapsed = clock_.Elapsed(); |
| 206 if (elapsed > duration_) { |
| 207 return duration_; |
| 208 } |
| 209 return elapsed; |
| 206 } | 210 } |
| 207 | 211 |
| 208 base::TimeDelta PipelineImpl::GetBufferedTime() const { | 212 base::TimeDelta PipelineImpl::GetBufferedTime() const { |
| 209 AutoLock auto_lock(lock_); | 213 AutoLock auto_lock(lock_); |
| 210 return buffered_time_; | 214 return buffered_time_; |
| 211 } | 215 } |
| 212 | 216 |
| 213 base::TimeDelta PipelineImpl::GetDuration() const { | 217 base::TimeDelta PipelineImpl::GetDuration() const { |
| 214 AutoLock auto_lock(lock_); | 218 AutoLock auto_lock(lock_); |
| 215 return duration_; | 219 return duration_; |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 | 808 |
| 805 // Reset the pipeline, which will decrement a reference to this object. | 809 // Reset the pipeline, which will decrement a reference to this object. |
| 806 // We will get destroyed as soon as the remaining tasks finish executing. | 810 // We will get destroyed as soon as the remaining tasks finish executing. |
| 807 // To be safe, we'll set our pipeline reference to NULL. | 811 // To be safe, we'll set our pipeline reference to NULL. |
| 808 filters_.clear(); | 812 filters_.clear(); |
| 809 filter_types_.clear(); | 813 filter_types_.clear(); |
| 810 STLDeleteElements(&filter_threads_); | 814 STLDeleteElements(&filter_threads_); |
| 811 } | 815 } |
| 812 | 816 |
| 813 } // namespace media | 817 } // namespace media |
| OLD | NEW |