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/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/condition_variable.h" | 10 #include "base/condition_variable.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 volume)); | 207 volume)); |
208 } | 208 } |
209 } | 209 } |
210 | 210 |
211 base::TimeDelta PipelineImpl::GetCurrentTime() const { | 211 base::TimeDelta PipelineImpl::GetCurrentTime() const { |
212 // TODO(scherkus): perhaps replace checking state_ == kEnded with a bool that | 212 // TODO(scherkus): perhaps replace checking state_ == kEnded with a bool that |
213 // is set/get under the lock, because this is breaching the contract that | 213 // is set/get under the lock, because this is breaching the contract that |
214 // |state_| is only accessed on |message_loop_|. | 214 // |state_| is only accessed on |message_loop_|. |
215 AutoLock auto_lock(lock_); | 215 AutoLock auto_lock(lock_); |
216 base::TimeDelta elapsed = clock_.Elapsed(); | 216 base::TimeDelta elapsed = clock_.Elapsed(); |
217 if (state_ == kEnded || | 217 if (state_ == kEnded || elapsed > duration_) { |
218 (duration_.ToInternalValue() && (elapsed > duration_))) { | |
219 return duration_; | 218 return duration_; |
220 } | 219 } |
221 return elapsed; | 220 return elapsed; |
222 } | 221 } |
223 | 222 |
224 base::TimeDelta PipelineImpl::GetBufferedTime() const { | 223 base::TimeDelta PipelineImpl::GetBufferedTime() const { |
225 AutoLock auto_lock(lock_); | 224 AutoLock auto_lock(lock_); |
226 | 225 |
227 // If buffered time was set, we report that value directly. | 226 // If buffered time was set, we report that value directly. |
228 if (buffered_time_.ToInternalValue() > 0) | 227 if (buffered_time_.ToInternalValue() > 0) |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 | 990 |
992 // Reset the pipeline, which will decrement a reference to this object. | 991 // Reset the pipeline, which will decrement a reference to this object. |
993 // We will get destroyed as soon as the remaining tasks finish executing. | 992 // We will get destroyed as soon as the remaining tasks finish executing. |
994 // To be safe, we'll set our pipeline reference to NULL. | 993 // To be safe, we'll set our pipeline reference to NULL. |
995 filters_.clear(); | 994 filters_.clear(); |
996 filter_types_.clear(); | 995 filter_types_.clear(); |
997 STLDeleteElements(&filter_threads_); | 996 STLDeleteElements(&filter_threads_); |
998 } | 997 } |
999 | 998 |
1000 } // namespace media | 999 } // namespace media |
OLD | NEW |