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

Side by Side Diff: media/capture/video/linux/v4l2_capture_delegate.cc

Issue 2487483002: Bug Fix: Logitech C930 On Linux Results In Freezing Video [M54] (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « media/capture/video/linux/v4l2_capture_delegate.h ('k') | 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 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/capture/video/linux/v4l2_capture_delegate.h" 5 #include "media/capture/video/linux/v4l2_capture_delegate.h"
6 6
7 #include <poll.h> 7 #include <poll.h>
8 #include <sys/fcntl.h> 8 #include <sys/fcntl.h>
9 #include <sys/ioctl.h> 9 #include <sys/ioctl.h>
10 #include <sys/mman.h> 10 #include <sys/mman.h>
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 if (HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_DQBUF, &buffer)) < 0) { 388 if (HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_DQBUF, &buffer)) < 0) {
389 SetErrorState(FROM_HERE, "Failed to dequeue capture buffer"); 389 SetErrorState(FROM_HERE, "Failed to dequeue capture buffer");
390 return; 390 return;
391 } 391 }
392 392
393 buffer_tracker_pool_[buffer.index]->set_payload_size(buffer.bytesused); 393 buffer_tracker_pool_[buffer.index]->set_payload_size(buffer.bytesused);
394 const scoped_refptr<BufferTracker>& buffer_tracker = 394 const scoped_refptr<BufferTracker>& buffer_tracker =
395 buffer_tracker_pool_[buffer.index]; 395 buffer_tracker_pool_[buffer.index];
396 396
397 base::TimeDelta timestamp = 397 const base::TimeTicks now = base::TimeTicks::Now();
398 base::TimeDelta::FromSeconds(buffer.timestamp.tv_sec) + 398 if (first_ref_time_.is_null())
399 base::TimeDelta::FromMicroseconds(buffer.timestamp.tv_usec); 399 first_ref_time_ = now;
400 client_->OnIncomingCapturedData( 400 const base::TimeDelta timestamp = now - first_ref_time_;
401 buffer_tracker->start(), buffer_tracker->payload_size(), 401
402 capture_format_, rotation_, base::TimeTicks::Now(), timestamp); 402 client_->OnIncomingCapturedData(buffer_tracker->start(),
403 buffer_tracker->payload_size(),
404 capture_format_, rotation_, now, timestamp);
403 405
404 if (HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_QBUF, &buffer)) < 0) { 406 if (HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_QBUF, &buffer)) < 0) {
405 SetErrorState(FROM_HERE, "Failed to enqueue capture buffer"); 407 SetErrorState(FROM_HERE, "Failed to enqueue capture buffer");
406 return; 408 return;
407 } 409 }
408 } 410 }
409 411
410 v4l2_task_runner_->PostTask( 412 v4l2_task_runner_->PostTask(
411 FROM_HERE, base::Bind(&V4L2CaptureDelegate::DoCapture, this)); 413 FROM_HERE, base::Bind(&V4L2CaptureDelegate::DoCapture, this));
412 } 414 }
(...skipping 25 matching lines...) Expand all
438 DLOG(ERROR) << "Error mmap()ing a V4L2 buffer into userspace"; 440 DLOG(ERROR) << "Error mmap()ing a V4L2 buffer into userspace";
439 return false; 441 return false;
440 } 442 }
441 start_ = static_cast<uint8_t*>(start); 443 start_ = static_cast<uint8_t*>(start);
442 length_ = buffer.length; 444 length_ = buffer.length;
443 payload_size_ = 0; 445 payload_size_ = 0;
444 return true; 446 return true;
445 } 447 }
446 448
447 } // namespace media 449 } // namespace media
OLDNEW
« 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