| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 207 } |
| 208 | 208 |
| 209 #if defined(OS_WIN) | 209 #if defined(OS_WIN) |
| 210 // Bump up our priority so our sleeping is more accurate. | 210 // Bump up our priority so our sleeping is more accurate. |
| 211 // TODO(scherkus): find out if this is necessary, but it seems to help. | 211 // TODO(scherkus): find out if this is necessary, but it seems to help. |
| 212 ::SetThreadPriority(thread_, THREAD_PRIORITY_ABOVE_NORMAL); | 212 ::SetThreadPriority(thread_, THREAD_PRIORITY_ABOVE_NORMAL); |
| 213 #endif // defined(OS_WIN) | 213 #endif // defined(OS_WIN) |
| 214 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); | 214 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); |
| 215 } | 215 } |
| 216 | 216 |
| 217 void VideoRendererBase::PrepareForShutdownHack() { | |
| 218 base::AutoLock auto_lock(lock_); | |
| 219 if (decoder_) | |
| 220 decoder_->PrepareForShutdownHack(); | |
| 221 } | |
| 222 | |
| 223 // PlatformThread::Delegate implementation. | 217 // PlatformThread::Delegate implementation. |
| 224 void VideoRendererBase::ThreadMain() { | 218 void VideoRendererBase::ThreadMain() { |
| 225 base::PlatformThread::SetName("CrVideoRenderer"); | 219 base::PlatformThread::SetName("CrVideoRenderer"); |
| 226 | 220 |
| 227 // The number of milliseconds to idle when we do not have anything to do. | 221 // The number of milliseconds to idle when we do not have anything to do. |
| 228 // Nothing special about the value, other than we're being more OS-friendly | 222 // Nothing special about the value, other than we're being more OS-friendly |
| 229 // than sleeping for 1 millisecond. | 223 // than sleeping for 1 millisecond. |
| 230 // | 224 // |
| 231 // TOOD(scherkus): switch to pure event-driven frame timing instead of this | 225 // TOOD(scherkus): switch to pure event-driven frame timing instead of this |
| 232 // kIdleTimeDelta business http://crbug.com/106874 | 226 // kIdleTimeDelta business http://crbug.com/106874 |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 | 621 |
| 628 int VideoRendererBase::NumFrames_Locked() const { | 622 int VideoRendererBase::NumFrames_Locked() const { |
| 629 lock_.AssertAcquired(); | 623 lock_.AssertAcquired(); |
| 630 int outstanding_frames = | 624 int outstanding_frames = |
| 631 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + | 625 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + |
| 632 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); | 626 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); |
| 633 return ready_frames_.size() + outstanding_frames; | 627 return ready_frames_.size() + outstanding_frames; |
| 634 } | 628 } |
| 635 | 629 |
| 636 } // namespace media | 630 } // namespace media |
| OLD | NEW |