Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: media/video/capture/file_video_capture_device.cc

Issue 1170573003: FileVideoCaptureDevice: If frames are lagging behind, don't try to catch up (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/video/capture/file_video_capture_device.h" 5 #include "media/video/capture/file_video_capture_device.h"
6 6
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 capture_format_, 242 capture_format_,
243 0, 243 0,
244 current_time); 244 current_time);
245 // Reschedule next CaptureTask. 245 // Reschedule next CaptureTask.
246 const base::TimeDelta frame_interval = 246 const base::TimeDelta frame_interval =
247 base::TimeDelta::FromMicroseconds(1E6 / capture_format_.frame_rate); 247 base::TimeDelta::FromMicroseconds(1E6 / capture_format_.frame_rate);
248 if (next_frame_time_.is_null()) { 248 if (next_frame_time_.is_null()) {
249 next_frame_time_ = current_time + frame_interval; 249 next_frame_time_ = current_time + frame_interval;
250 } else { 250 } else {
251 next_frame_time_ += frame_interval; 251 next_frame_time_ += frame_interval;
252 // Don't accumulate any debt if we are lagging behind - just post next frame
253 // immediately and continue as normal.
254 if (next_frame_time_ < current_time)
255 next_frame_time_ = current_time;
252 } 256 }
253 base::MessageLoop::current()->PostDelayedTask( 257 base::MessageLoop::current()->PostDelayedTask(
254 FROM_HERE, 258 FROM_HERE,
255 base::Bind(&FileVideoCaptureDevice::OnCaptureTask, 259 base::Bind(&FileVideoCaptureDevice::OnCaptureTask,
256 base::Unretained(this)), 260 base::Unretained(this)),
257 next_frame_time_ - current_time); 261 next_frame_time_ - current_time);
258 } 262 }
259 263
260 } // namespace media 264 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698