| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/base/null_video_sink.h" | 5 #include "media/base/null_video_sink.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 base::ResetAndReturn(&stop_cb_).Run(); | 49 base::ResetAndReturn(&stop_cb_).Run(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void NullVideoSink::CallRender() { | 52 void NullVideoSink::CallRender() { |
| 53 DCHECK(task_runner_->BelongsToCurrentThread()); | 53 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 54 DCHECK(started_); | 54 DCHECK(started_); |
| 55 | 55 |
| 56 const base::TimeTicks end_of_interval = current_render_time_ + interval_; | 56 const base::TimeTicks end_of_interval = current_render_time_ + interval_; |
| 57 scoped_refptr<VideoFrame> new_frame = callback_->Render( | 57 scoped_refptr<VideoFrame> new_frame = callback_->Render( |
| 58 current_render_time_, end_of_interval, background_render_); | 58 current_render_time_, end_of_interval, background_render_); |
| 59 DCHECK(new_frame); |
| 59 const bool is_new_frame = new_frame != last_frame_; | 60 const bool is_new_frame = new_frame != last_frame_; |
| 60 last_frame_ = new_frame; | 61 last_frame_ = new_frame; |
| 61 if (is_new_frame && !new_frame_cb_.is_null()) | 62 if (is_new_frame && !new_frame_cb_.is_null()) |
| 62 new_frame_cb_.Run(new_frame); | 63 new_frame_cb_.Run(new_frame); |
| 63 | 64 |
| 64 current_render_time_ += interval_; | 65 current_render_time_ += interval_; |
| 65 | 66 |
| 66 if (clockless_) { | 67 if (clockless_) { |
| 67 task_runner_->PostTask(FROM_HERE, cancelable_worker_.callback()); | 68 task_runner_->PostTask(FROM_HERE, cancelable_worker_.callback()); |
| 68 return; | 69 return; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 86 task_runner_->PostDelayedTask(FROM_HERE, cancelable_worker_.callback(), | 87 task_runner_->PostDelayedTask(FROM_HERE, cancelable_worker_.callback(), |
| 87 delay); | 88 delay); |
| 88 } | 89 } |
| 89 | 90 |
| 90 void NullVideoSink::PaintFrameUsingOldRenderingPath( | 91 void NullVideoSink::PaintFrameUsingOldRenderingPath( |
| 91 const scoped_refptr<VideoFrame>& frame) { | 92 const scoped_refptr<VideoFrame>& frame) { |
| 92 new_frame_cb_.Run(frame); | 93 new_frame_cb_.Run(frame); |
| 93 } | 94 } |
| 94 | 95 |
| 95 } // namespace media | 96 } // namespace media |
| OLD | NEW |