| 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/video_renderer_base.h" | 5 #include "media/filters/video_renderer_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 159 } |
| 160 | 160 |
| 161 #if defined(OS_WIN) | 161 #if defined(OS_WIN) |
| 162 // Bump up our priority so our sleeping is more accurate. | 162 // Bump up our priority so our sleeping is more accurate. |
| 163 // TODO(scherkus): find out if this is necessary, but it seems to help. | 163 // TODO(scherkus): find out if this is necessary, but it seems to help. |
| 164 ::SetThreadPriority(thread_, THREAD_PRIORITY_ABOVE_NORMAL); | 164 ::SetThreadPriority(thread_, THREAD_PRIORITY_ABOVE_NORMAL); |
| 165 #endif // defined(OS_WIN) | 165 #endif // defined(OS_WIN) |
| 166 init_cb.Run(PIPELINE_OK); | 166 init_cb.Run(PIPELINE_OK); |
| 167 } | 167 } |
| 168 | 168 |
| 169 bool VideoRendererBase::HasEnded() { | |
| 170 base::AutoLock auto_lock(lock_); | |
| 171 return state_ == kEnded; | |
| 172 } | |
| 173 | |
| 174 // PlatformThread::Delegate implementation. | 169 // PlatformThread::Delegate implementation. |
| 175 void VideoRendererBase::ThreadMain() { | 170 void VideoRendererBase::ThreadMain() { |
| 176 base::PlatformThread::SetName("CrVideoRenderer"); | 171 base::PlatformThread::SetName("CrVideoRenderer"); |
| 177 | 172 |
| 178 // The number of milliseconds to idle when we do not have anything to do. | 173 // The number of milliseconds to idle when we do not have anything to do. |
| 179 // Nothing special about the value, other than we're being more OS-friendly | 174 // Nothing special about the value, other than we're being more OS-friendly |
| 180 // than sleeping for 1 millisecond. | 175 // than sleeping for 1 millisecond. |
| 181 // | 176 // |
| 182 // TOOD(scherkus): switch to pure event-driven frame timing instead of this | 177 // TOOD(scherkus): switch to pure event-driven frame timing instead of this |
| 183 // kIdleTimeDelta business http://crbug.com/106874 | 178 // kIdleTimeDelta business http://crbug.com/106874 |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 | 573 |
| 579 int VideoRendererBase::NumFrames_Locked() const { | 574 int VideoRendererBase::NumFrames_Locked() const { |
| 580 lock_.AssertAcquired(); | 575 lock_.AssertAcquired(); |
| 581 int outstanding_frames = | 576 int outstanding_frames = |
| 582 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + | 577 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + |
| 583 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); | 578 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); |
| 584 return ready_frames_.size() + outstanding_frames; | 579 return ready_frames_.size() + outstanding_frames; |
| 585 } | 580 } |
| 586 | 581 |
| 587 } // namespace media | 582 } // namespace media |
| OLD | NEW |