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/filters/audio_renderer_base.h" | 5 #include "media/filters/audio_renderer_base.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 state_ = kStopped; | 63 state_ = kStopped; |
64 algorithm_.reset(NULL); | 64 algorithm_.reset(NULL); |
65 time_cb_.Reset(); | 65 time_cb_.Reset(); |
66 underflow_cb_.Reset(); | 66 underflow_cb_.Reset(); |
67 } | 67 } |
68 if (!callback.is_null()) { | 68 if (!callback.is_null()) { |
69 callback.Run(); | 69 callback.Run(); |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 void AudioRendererBase::Seek(base::TimeDelta time, const FilterStatusCB& cb) { | 73 void AudioRendererBase::Seek(base::TimeDelta time, const PipelineStatusCB& cb) { |
74 base::AutoLock auto_lock(lock_); | 74 base::AutoLock auto_lock(lock_); |
75 DCHECK_EQ(kPaused, state_); | 75 DCHECK_EQ(kPaused, state_); |
76 DCHECK(!pending_read_) << "Pending read must complete before seeking"; | 76 DCHECK(!pending_read_) << "Pending read must complete before seeking"; |
77 DCHECK(pause_cb_.is_null()); | 77 DCHECK(pause_cb_.is_null()); |
78 DCHECK(seek_cb_.is_null()); | 78 DCHECK(seek_cb_.is_null()); |
79 state_ = kSeeking; | 79 state_ = kSeeking; |
80 seek_cb_ = cb; | 80 seek_cb_ = cb; |
81 seek_timestamp_ = time; | 81 seek_timestamp_ = time; |
82 | 82 |
83 // Throw away everything and schedule our reads. | 83 // Throw away everything and schedule our reads. |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 base::AutoLock auto_lock(lock_); | 303 base::AutoLock auto_lock(lock_); |
304 return algorithm_->playback_rate(); | 304 return algorithm_->playback_rate(); |
305 } | 305 } |
306 | 306 |
307 bool AudioRendererBase::IsBeforeSeekTime(const scoped_refptr<Buffer>& buffer) { | 307 bool AudioRendererBase::IsBeforeSeekTime(const scoped_refptr<Buffer>& buffer) { |
308 return (state_ == kSeeking) && buffer && !buffer->IsEndOfStream() && | 308 return (state_ == kSeeking) && buffer && !buffer->IsEndOfStream() && |
309 (buffer->GetTimestamp() + buffer->GetDuration()) < seek_timestamp_; | 309 (buffer->GetTimestamp() + buffer->GetDuration()) < seek_timestamp_; |
310 } | 310 } |
311 | 311 |
312 } // namespace media | 312 } // namespace media |
OLD | NEW |