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

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

Issue 2478273002: Bug Fix: Logitech C930 On Linux Results In Freezing Video [M55] (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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 556
557 if (HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_DQBUF, &buffer)) < 0) { 557 if (HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_DQBUF, &buffer)) < 0) {
558 SetErrorState(FROM_HERE, "Failed to dequeue capture buffer"); 558 SetErrorState(FROM_HERE, "Failed to dequeue capture buffer");
559 return; 559 return;
560 } 560 }
561 561
562 buffer_tracker_pool_[buffer.index]->set_payload_size(buffer.bytesused); 562 buffer_tracker_pool_[buffer.index]->set_payload_size(buffer.bytesused);
563 const scoped_refptr<BufferTracker>& buffer_tracker = 563 const scoped_refptr<BufferTracker>& buffer_tracker =
564 buffer_tracker_pool_[buffer.index]; 564 buffer_tracker_pool_[buffer.index];
565 565
566 base::TimeDelta timestamp = 566 // There's a wide-spread issue where the kernel does not report accurate,
567 base::TimeDelta::FromSeconds(buffer.timestamp.tv_sec) + 567 // monotonically-increasing timestamps in the v4l2_buffer::timestamp
568 base::TimeDelta::FromMicroseconds(buffer.timestamp.tv_usec); 568 // field (goo.gl/Nlfamz).
569 client_->OnIncomingCapturedData( 569 // Until this issue is fixed, just use the reference clock as a source of
570 buffer_tracker->start(), buffer_tracker->payload_size(), 570 // media timestamps.
571 capture_format_, rotation_, base::TimeTicks::Now(), timestamp); 571 const base::TimeTicks now = base::TimeTicks::Now();
572 if (first_ref_time_.is_null())
573 first_ref_time_ = now;
574 const base::TimeDelta timestamp = now - first_ref_time_;
575 client_->OnIncomingCapturedData(buffer_tracker->start(),
576 buffer_tracker->payload_size(),
577 capture_format_, rotation_, now, timestamp);
572 578
573 while (!take_photo_callbacks_.empty()) { 579 while (!take_photo_callbacks_.empty()) {
574 VideoCaptureDevice::TakePhotoCallback cb = 580 VideoCaptureDevice::TakePhotoCallback cb =
575 std::move(take_photo_callbacks_.front()); 581 std::move(take_photo_callbacks_.front());
576 take_photo_callbacks_.pop(); 582 take_photo_callbacks_.pop();
577 583
578 mojom::BlobPtr blob = 584 mojom::BlobPtr blob =
579 Blobify(buffer_tracker->start(), buffer.bytesused, capture_format_); 585 Blobify(buffer_tracker->start(), buffer.bytesused, capture_format_);
580 if (blob) 586 if (blob)
581 cb.Run(std::move(blob)); 587 cb.Run(std::move(blob));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 DLOG(ERROR) << "Error mmap()ing a V4L2 buffer into userspace"; 624 DLOG(ERROR) << "Error mmap()ing a V4L2 buffer into userspace";
619 return false; 625 return false;
620 } 626 }
621 start_ = static_cast<uint8_t*>(start); 627 start_ = static_cast<uint8_t*>(start);
622 length_ = buffer.length; 628 length_ = buffer.length;
623 payload_size_ = 0; 629 payload_size_ = 0;
624 return true; 630 return true;
625 } 631 }
626 632
627 } // namespace media 633 } // 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