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

Unified Diff: media/capture/video/linux/v4l2_capture_delegate.cc

Issue 2463853002: Bug Fix: Logitech C930 On Linux Results In Freezing Video (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/capture/video/linux/v4l2_capture_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/capture/video/linux/v4l2_capture_delegate.cc
diff --git a/media/capture/video/linux/v4l2_capture_delegate.cc b/media/capture/video/linux/v4l2_capture_delegate.cc
index 87068547c926ab0910724ea51d75e871a5cd5e71..5f0466bfc577df8e3e61565b317c67fa239d4c6e 100644
--- a/media/capture/video/linux/v4l2_capture_delegate.cc
+++ b/media/capture/video/linux/v4l2_capture_delegate.cc
@@ -575,9 +575,16 @@ void V4L2CaptureDelegate::DoCapture() {
const scoped_refptr<BufferTracker>& buffer_tracker =
buffer_tracker_pool_[buffer.index];
- base::TimeDelta timestamp =
- base::TimeDelta::FromSeconds(buffer.timestamp.tv_sec) +
- base::TimeDelta::FromMicroseconds(buffer.timestamp.tv_usec);
+ // There's a wide-spread issue where the kernel does not report accurate,
+ // monotonically-increasing timestamps in the v4l2_buffer::timestamp
+ // field (goo.gl/Nlfamz).
+ // Until this issue is fixed, just use the reference clock as a source of
+ // media timestamps.
+ const base::TimeTicks now = base::TimeTicks::Now();
+ if (first_ref_time_.is_null())
+ first_ref_time_ = now;
+ const base::TimeDelta timestamp = now - first_ref_time_;
+
#ifdef V4L2_BUF_FLAG_ERROR
if (buffer.flags & V4L2_BUF_FLAG_ERROR) {
LOG(ERROR) << "Dequeued v4l2 buffer contains corrupted data ("
@@ -587,7 +594,7 @@ void V4L2CaptureDelegate::DoCapture() {
#endif
client_->OnIncomingCapturedData(
buffer_tracker->start(), buffer_tracker->payload_size(),
- capture_format_, rotation_, base::TimeTicks::Now(), timestamp);
+ capture_format_, rotation_, now, timestamp);
while (!take_photo_callbacks_.empty()) {
VideoCaptureDevice::TakePhotoCallback cb =
« no previous file with comments | « media/capture/video/linux/v4l2_capture_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698