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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/threading/platform_thread.h" | 7 #include "base/threading/platform_thread.h" |
8 #include "media/base/buffers.h" | 8 #include "media/base/buffers.h" |
9 #include "media/base/filter_host.h" | 9 #include "media/base/filter_host.h" |
10 #include "media/base/limits.h" | 10 #include "media/base/limits.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 base::PlatformThread::Join(thread_to_join); | 84 base::PlatformThread::Join(thread_to_join); |
85 | 85 |
86 callback.Run(); | 86 callback.Run(); |
87 } | 87 } |
88 | 88 |
89 void VideoRendererBase::SetPlaybackRate(float playback_rate) { | 89 void VideoRendererBase::SetPlaybackRate(float playback_rate) { |
90 base::AutoLock auto_lock(lock_); | 90 base::AutoLock auto_lock(lock_); |
91 playback_rate_ = playback_rate; | 91 playback_rate_ = playback_rate; |
92 } | 92 } |
93 | 93 |
94 void VideoRendererBase::Seek(base::TimeDelta time, const FilterStatusCB& cb) { | 94 void VideoRendererBase::Seek(base::TimeDelta time, const PipelineStatusCB& cb) { |
95 base::AutoLock auto_lock(lock_); | 95 base::AutoLock auto_lock(lock_); |
96 DCHECK_EQ(state_, kFlushed) << "Must flush prior to seeking."; | 96 DCHECK_EQ(state_, kFlushed) << "Must flush prior to seeking."; |
97 DCHECK(!cb.is_null()); | 97 DCHECK(!cb.is_null()); |
98 DCHECK(seek_cb_.is_null()); | 98 DCHECK(seek_cb_.is_null()); |
99 | 99 |
100 state_ = kSeeking; | 100 state_ = kSeeking; |
101 seek_cb_ = cb; | 101 seek_cb_ = cb; |
102 seek_timestamp_ = time; | 102 seek_timestamp_ = time; |
103 AttemptRead_Locked(); | 103 AttemptRead_Locked(); |
104 } | 104 } |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 491 |
492 int VideoRendererBase::NumFrames_Locked() const { | 492 int VideoRendererBase::NumFrames_Locked() const { |
493 lock_.AssertAcquired(); | 493 lock_.AssertAcquired(); |
494 int outstanding_frames = | 494 int outstanding_frames = |
495 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + | 495 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + |
496 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); | 496 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); |
497 return ready_frames_.size() + outstanding_frames; | 497 return ready_frames_.size() + outstanding_frames; |
498 } | 498 } |
499 | 499 |
500 } // namespace media | 500 } // namespace media |
OLD | NEW |