OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderers/video_renderer_impl.h" | 5 #include "media/renderers/video_renderer_impl.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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 259 |
260 void VideoRendererImpl::OnFrameDropped() { | 260 void VideoRendererImpl::OnFrameDropped() { |
261 base::AutoLock auto_lock(lock_); | 261 base::AutoLock auto_lock(lock_); |
262 DCHECK(use_new_video_renderering_path_); | 262 DCHECK(use_new_video_renderering_path_); |
263 algorithm_->OnLastFrameDropped(); | 263 algorithm_->OnLastFrameDropped(); |
264 } | 264 } |
265 | 265 |
266 void VideoRendererImpl::CreateVideoThread() { | 266 void VideoRendererImpl::CreateVideoThread() { |
267 // This may fail and cause a crash if there are too many threads created in | 267 // This may fail and cause a crash if there are too many threads created in |
268 // the current process. See http://crbug.com/443291 | 268 // the current process. See http://crbug.com/443291 |
269 CHECK(base::PlatformThread::Create(0, this, &thread_)); | 269 const base::ThreadPriority priority = |
270 | |
271 #if defined(OS_WIN) | 270 #if defined(OS_WIN) |
272 // Bump up our priority so our sleeping is more accurate. | 271 // Bump up our priority so our sleeping is more accurate. |
273 // TODO(scherkus): find out if this is necessary, but it seems to help. | 272 // TODO(scherkus): find out if this is necessary, but it seems to help. |
274 ::SetThreadPriority(thread_.platform_handle(), THREAD_PRIORITY_ABOVE_NORMAL); | 273 base::ThreadPriority::DISPLAY; |
275 #endif // defined(OS_WIN) | 274 #else |
| 275 base::ThreadPriority::NORMAL; |
| 276 #endif |
| 277 CHECK(base::PlatformThread::CreateWithPriority(0, this, &thread_, priority)); |
276 } | 278 } |
277 | 279 |
278 void VideoRendererImpl::OnVideoFrameStreamInitialized(bool success) { | 280 void VideoRendererImpl::OnVideoFrameStreamInitialized(bool success) { |
279 DCHECK(task_runner_->BelongsToCurrentThread()); | 281 DCHECK(task_runner_->BelongsToCurrentThread()); |
280 base::AutoLock auto_lock(lock_); | 282 base::AutoLock auto_lock(lock_); |
281 DCHECK_EQ(state_, kInitializing); | 283 DCHECK_EQ(state_, kInitializing); |
282 | 284 |
283 if (!success) { | 285 if (!success) { |
284 state_ = kUninitialized; | 286 state_ = kUninitialized; |
285 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); | 287 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 base::TimeTicks VideoRendererImpl::ConvertMediaTimestamp( | 776 base::TimeTicks VideoRendererImpl::ConvertMediaTimestamp( |
775 base::TimeDelta media_time) { | 777 base::TimeDelta media_time) { |
776 std::vector<base::TimeDelta> media_times(1, media_time); | 778 std::vector<base::TimeDelta> media_times(1, media_time); |
777 std::vector<base::TimeTicks> wall_clock_times; | 779 std::vector<base::TimeTicks> wall_clock_times; |
778 if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times)) | 780 if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times)) |
779 return base::TimeTicks(); | 781 return base::TimeTicks(); |
780 return wall_clock_times[0]; | 782 return wall_clock_times[0]; |
781 } | 783 } |
782 | 784 |
783 } // namespace media | 785 } // namespace media |
OLD | NEW |