| 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 // we ensure that frames_queued() doesn't get excessive. | 690 // we ensure that frames_queued() doesn't get excessive. |
| 691 return algorithm_->EffectiveFramesQueued() >= kMaxVideoFrames || | 691 return algorithm_->EffectiveFramesQueued() >= kMaxVideoFrames || |
| 692 algorithm_->frames_queued() >= 3 * kMaxVideoFrames; | 692 algorithm_->frames_queued() >= 3 * kMaxVideoFrames; |
| 693 } | 693 } |
| 694 | 694 |
| 695 return ready_frames_.size() >= kMaxVideoFrames; | 695 return ready_frames_.size() >= kMaxVideoFrames; |
| 696 } | 696 } |
| 697 | 697 |
| 698 void VideoRendererImpl::StartSink() { | 698 void VideoRendererImpl::StartSink() { |
| 699 DCHECK(task_runner_->BelongsToCurrentThread()); | 699 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 700 CHECK_GT(algorithm_->frames_queued(), 0u); |
| 700 sink_->Start(this); | 701 sink_->Start(this); |
| 701 sink_started_ = true; | 702 sink_started_ = true; |
| 702 was_background_rendering_ = false; | 703 was_background_rendering_ = false; |
| 703 } | 704 } |
| 704 | 705 |
| 705 void VideoRendererImpl::StopSink() { | 706 void VideoRendererImpl::StopSink() { |
| 706 DCHECK(task_runner_->BelongsToCurrentThread()); | 707 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 707 sink_->Stop(); | 708 sink_->Stop(); |
| 708 sink_started_ = false; | 709 sink_started_ = false; |
| 709 was_background_rendering_ = false; | 710 was_background_rendering_ = false; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 738 base::TimeTicks VideoRendererImpl::ConvertMediaTimestamp( | 739 base::TimeTicks VideoRendererImpl::ConvertMediaTimestamp( |
| 739 base::TimeDelta media_time) { | 740 base::TimeDelta media_time) { |
| 740 std::vector<base::TimeDelta> media_times(1, media_time); | 741 std::vector<base::TimeDelta> media_times(1, media_time); |
| 741 std::vector<base::TimeTicks> wall_clock_times; | 742 std::vector<base::TimeTicks> wall_clock_times; |
| 742 if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times)) | 743 if (!wall_clock_time_cb_.Run(media_times, &wall_clock_times)) |
| 743 return base::TimeTicks(); | 744 return base::TimeTicks(); |
| 744 return wall_clock_times[0]; | 745 return wall_clock_times[0]; |
| 745 } | 746 } |
| 746 | 747 |
| 747 } // namespace media | 748 } // namespace media |
| OLD | NEW |