| 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 "content/renderer/media/html_video_element_capturer_source.h" | 5 #include "content/renderer/media/html_video_element_capturer_source.h" |
| 6 | 6 |
| 7 #include "base/location.h" |
| 7 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/single_thread_task_runner.h" |
| 8 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
| 10 #include "content/public/renderer/render_thread.h" | 12 #include "content/public/renderer/render_thread.h" |
| 11 #include "content/renderer/media/media_stream_video_source.h" | 13 #include "content/renderer/media/media_stream_video_source.h" |
| 12 #include "content/renderer/media/webrtc_uma_histograms.h" | 14 #include "content/renderer/media/webrtc_uma_histograms.h" |
| 13 #include "media/base/limits.h" | 15 #include "media/base/limits.h" |
| 14 #include "media/blink/webmediaplayer_impl.h" | 16 #include "media/blink/webmediaplayer_impl.h" |
| 15 #include "skia/ext/platform_canvas.h" | 17 #include "skia/ext/platform_canvas.h" |
| 16 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 18 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 17 #include "third_party/WebKit/public/platform/WebRect.h" | 19 #include "third_party/WebKit/public/platform/WebRect.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 if (next_capture_time_.is_null()) { | 183 if (next_capture_time_.is_null()) { |
| 182 next_capture_time_ = current_time + frame_interval; | 184 next_capture_time_ = current_time + frame_interval; |
| 183 } else { | 185 } else { |
| 184 next_capture_time_ += frame_interval; | 186 next_capture_time_ += frame_interval; |
| 185 // Don't accumulate any debt if we are lagging behind - just post next frame | 187 // Don't accumulate any debt if we are lagging behind - just post next frame |
| 186 // immediately and continue as normal. | 188 // immediately and continue as normal. |
| 187 if (next_capture_time_ < current_time) | 189 if (next_capture_time_ < current_time) |
| 188 next_capture_time_ = current_time; | 190 next_capture_time_ = current_time; |
| 189 } | 191 } |
| 190 // Schedule next capture. | 192 // Schedule next capture. |
| 191 base::MessageLoop::current()->PostDelayedTask( | 193 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 192 FROM_HERE, base::Bind(&HtmlVideoElementCapturerSource::sendNewFrame, | 194 FROM_HERE, base::Bind(&HtmlVideoElementCapturerSource::sendNewFrame, |
| 193 weak_factory_.GetWeakPtr()), | 195 weak_factory_.GetWeakPtr()), |
| 194 next_capture_time_ - current_time); | 196 next_capture_time_ - current_time); |
| 195 } | 197 } |
| 196 | 198 |
| 197 } // namespace content | 199 } // namespace content |
| OLD | NEW |